How to enumerate all possible configurations of a tictactoe game modulo symmetries?

252 Views Asked by At

Is there an easy way to list all different configurations of a tictactoe game? For the first turn it is still quite simple, e.g. all these

x - -    - - x    - - -    - - -           x = 1st player 
- - -    - - -    - - -    - - -           o = 2nd player
- - -    - - -    - - x    x - -           - = empty

are the same configuration, because of the rotational symmetry and there are only 3 "different" ones for the first turn:

x - -    - x -    - - -  
- - -    - - -    - x -  
- - -    - - -    - - - 

However, already for the second turn I can't think of anything more clever than brute force trying all moves and check them against all symmetries. Is there any efficient way to get a list of all configurations that can occur in a normal tictactoe game (ie once one player has 3 in a row, the game is over)?