PC guesses a number in 3 tries

I've came up with this idea from card trick but I don't know how to do it .
Player will think of a number, and PC will have to guess it.
So computer makes three columns: computer takes every natural number from 1, and raises it by 1. If number divides by 3, a new line is made. Numbers will rise until 36 is reached. So it would look like this:
1
2
3
4
5
6
7
8
1  2  3
4  5  6
7  8  9
10 11 12
13 14 15
16 17 18
...
34 35 36


Then a player picks a column where his number is located. The column will be placed in the middle of other two columns. Let's say we pick middle column.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
1
4
7
10
13
16
...
31
34

2
5
8
11
14
17
...
32
35

3
6
9
12
15
18
..
33
36 


After this, PC makes another three columns by taking numbers from that list starting from top column and places them one after another, and again, after it puts three numbers it will make a new line, so it would look like:

1
2
3
4
5
6
7
8
9
10
11
12
1  4  7
10 13 16
19 22 25
28 31 34
2  5  8
11 14 17
20 23 26
29 32 35
3  6  9
12 15 18
21 24 27
30 33 36 


After that player picks column he sees his number in again. Let's say it's the middle one. You get the point - column is added in the middle, numbers are placed one after another starting from the top. Result would be:

1
2
3
4
5
6
1  10 19
28 2  11
20 29 3
...
26 35 9
18 27 36


Then the player picks a column. We put the column in the middle of other columns again. Now the most important part: the number will be either 18th or 19th calculating from the top. (I don't know why the result differs).

Anyways, this might look confusing, but I know the code has to be simple. I'm just drawing a blank here. I tried to do it, but besides millions of if statements I can't do it right. I know arrays can/should/must be used here, but how? I'm not experienced in them either.
Thanks.
I have came up with this idea (note that this is no way a full code):

1
2
3
4
5
6
7
8
int column1[]= {1, 4, 7, 10, 13, 16, 19, 22, 25, 28, 31, 34};
int column2[]= {2, 5, 8, 11, 14, 17, 20, 23, 26, 29, 32, 35};
int column3[]= {3, 6, 9, 12, 15, 18, 21, 24, 27, 30, 33, 36};
int column4[12];
while (t<=11){
if ((column1[t]-1)%9==0) {column4[t]=column1[t];} else {column4[t]=0;} t++;}
t=0;
while (t<=11) {cout << column4[t] << endl; t++;}


As you can see it will cout zeroes for empty values. How do I push array members so there are no empty spots between them?
I managed to push them back somehow but that doesn't solve anything, I still have to manually create all the possibilities, which would make the code VERY long.
Topic archived. No new replies allowed.