Connecting Tech Pros Worldwide Help | Site Map

tic tac toe

Newbie
 
Join Date: Mar 2007
Posts: 29
#1: Mar 5 '09
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
Dormilich's Avatar
Moderator
 
Join Date: Aug 2008
Location: Leipzig, Germany
Posts: 3,629
#2: Mar 5 '09

re: tic tac toe


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
Newbie
 
Join Date: Mar 2007
Posts: 29
#3: Mar 5 '09

re: tic tac toe


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
Dormilich's Avatar
Moderator
 
Join Date: Aug 2008
Location: Leipzig, Germany
Posts: 3,629
#4: Mar 5 '09

re: tic tac toe


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
Newbie
 
Join Date: Mar 2007
Posts: 29
#5: Mar 5 '09

re: tic tac toe


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?
Dormilich's Avatar
Moderator
 
Join Date: Aug 2008
Location: Leipzig, Germany
Posts: 3,629
#6: Mar 5 '09

re: tic tac toe


very close, but both can not be reached by rotation alone.
Newbie
 
Join Date: Mar 2007
Posts: 29
#7: Mar 5 '09

re: tic tac toe


huh wht do you mean?
Dormilich's Avatar
Moderator
 
Join Date: Aug 2008
Location: Leipzig, Germany
Posts: 3,629
#8: Mar 5 '09

re: tic tac toe


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)
Newbie
 
Join Date: Mar 2007
Posts: 29
#9: Mar 5 '09

re: tic tac toe


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
Reply


Similar Algorithms / Advanced Math bytes