Write a program that outputs all possible Tic Tac Toe positions including the corresponding game outcome. Avoid duplicate output of equal positions.
The program takes no input.
Rules:
- A position output must consist of 9 characters, using
X
andO
for the taken squares, and an arbitrary non-whitespace character for the blank squares - Each position must be printed in 3 lines/columns, with a blank line as a separator between two positions.
- Additional whitespace / blank lines / box drawing characters are welcome
- Player X goes first
The outcome can be either of:
- X has won
- O has won
- Draw
- Game in progress
You are free to choose a suitable visualization of the position's outcome, e.g. as colored text, or as textual annotation, as long as it is placed near the corresponding position
- Positions are considered equal if one can be obtained from the other by rotation or mirroring. Duplicate positions must not be printed. (In other words, print the equality classes only.)
For example, print only one of the following:
X•• ••X ••• •••
••• ••• ••• •••
••• ••• X•• ••X
- This is code-golf, so shortest code wins!
Sample output:
•••
•••
••• -
X••
•••
••• -
•X•
•••
••• -
•••
•X•
••• -
[…]
XXO
OOX
XXO /
OXO
XXX
OXO X
Hint: There are 765 positions, with 91 wins for X, 44 wins for O, and 3 draws.
A similar question has been asked before, but this one is different.