I would like to generate a text file containing all 19,683 Tic-Tac-Toe board layouts in the structure of 0 = Blank, 1 = X, and 2 = O. Unfortunately math is not my strong su
Like an earlier solution, but easier to read and in Python.
for i in range(3**9): c = i for j in range(9): if j % 3 == 0: print("") print(str(c % 3) + " ", end='') c //= 3 print("")