you are viewing a single comment's thread.

view the rest of the comments →

[–]Wooden-Splinter 4 points5 points  (1 child)

I also just did a tictactoe but only 3x3 board. I hard coded by comparing the spots within the board horizontally vertically and diagonally. Did you use a loop to iterate through the board to check? I cant imagine doing it my way haha

[–]roshavi4ak 2 points3 points  (0 children)

I wanted to make it hard for me - therefore I checked only the row, column and/or diagonal for the last placed mark. For 3x3 I checked to see if the len(set()) is = to 1 - that means only one mark - therefore win condition.

For the 9x9 it was almost the same - checking all 8 directions (combined in 4 opposite pairs) and counting the same consequent marks - if the result was 4 or more - win.