468,291 Members | 1,604 Online

# tic tac toe

im been googling around on how to programme the ai part for this game and alot mentioned about rotating the board... how do i rotate this board.
thnks
Mar 5 '09 #1
8 3101
Dormilich
8,651 Expert Mod 8TB
you mean like rotating 90/180/270 degrees?
180° invert the col and row numbers
90°/270° switch col/row numbers and invert col numbers
Mar 5 '09 #2
oh yea switchin the values....meanin?

0 1 2
a
b
c

a b c
0
1
2
then ? if rotate again 012 will be at bottom same as beginin
Mar 5 '09 #3
Dormilich
8,651 Expert Mod 8TB
let's assume your IDs are like in the thread: b00, b01, b02, b10, ...
Expand|Select|Wrap|Line Numbers
1. 00 01 02           20 10 00
2. 10 11 12  becomes  21 11 01
3. 20 21 22           22 12 02
Mar 5 '09 #4
so after tht the other two will be
Expand|Select|Wrap|Line Numbers
1. 20 21 22
2. 10 11 12
3. 00 01 02
4.
5.
6.
7. 00 10 20
8. 01 11 21
9. 02 12 22
10.
right?
Mar 5 '09 #5
Dormilich
8,651 Expert Mod 8TB
very close, but both can not be reached by rotation alone.
Mar 5 '09 #6
huh wht do you mean?
Mar 5 '09 #7
Dormilich
8,651 Expert Mod 8TB
make a sheet of paper, write down the IDs and turn it by 90°. you'll see, how the numbers will change places correctly.

background: symmetry operations
a plain square belongs to the Point Group D(4h) (which essentially tells you, what symmetry operations are possible). from that you can conclude, that there are 8 possibilities to switch the fields without losing the relative positioning (in the end you have a 4fold axis (rotation by 90°) making 4 positionings and the mirror images of these making a total of 8)
Mar 5 '09 #8
hmhm i think i got it....will think abt it tmr (kinda late from where i'm at)
thanks alot! and for bein patience with my ques !! :D
Mar 5 '09 #9