6

Is there any algorithm for tic tac toe that does not rely on a lookahead algorithm that is perfect for any sized boards?

Edit: For boards larger than $3 \times 3$, we have to find the best move for a $k$ in a row where $k < n$ and we have a $n \times n$ board.

Michael T
  • 1,742
picakhu
  • 4,994
  • What leads you to think there is? – apnorton Jul 17 '14 at 15:21
  • 2
    @anorton, I came across this http://freecode.com/projects/tictactoe and I also seem to recall this particular problem presented at a conference but I do not recall the details as it was presented about 10 years ago. – picakhu Jul 17 '14 at 15:59
  • Can you explain what you want the rules to be for larger boards? How many in a row are required to win? Since clearly the first player can win easily if you only need three in a row on a board of size $\ge 4$. – mjqxxxx Aug 06 '14 at 18:14
  • And by "is perfect", do you mean (a) never loses or (b) makes a winning move whenever a win can be forced? The link you provided seems to refer only to the former… i.e., it tries to achieve a draw. This is obviously much easier, and I suspect an algorithm could be provided that forces a draw for $N\times N$ tic-tac-toe where $N$-in-a-row wins. – mjqxxxx Aug 06 '14 at 18:18
  • @mjqxxxx either is alright as long as it is accompanied with a proof. – picakhu Aug 07 '14 at 21:48
  • There is yet another meaning to "perfect" play: In a theoretically drawn (or lost) position, give the opponent the maximum number of plausible ways to go wrong. – TonyK Aug 08 '14 at 18:16

1 Answers1

1

For a $4 \times 4$ board or larger, the player 2 can force a tie (which is the best you can hope for if player 1 is playing optimally) by first playing on the two diagonals (or the center if the board size is odd and the center is not taken), and then always playing in a row or column where player 1 has the most squares taken and player 2 has not played yet. The only way player 1 can win is by having two lines each of which are full except for one empty square (where the empty square is not shared). But the largest number of squares player 1 can take in a given line without player 2 taking a square in that line is 3, which can be proved by induction, noting that it's never possible for player 1 to make a move that creates 2 lines with 3 squares (assuming player 2's strategy).

user2566092
  • 26,450
  • It is certainly not true that the largest number of squares player $1$ can take in a given line is $3$ (or else no one would bother playing go-moku). – mjqxxxx Aug 10 '14 at 19:23
  • @mjqxxxx That was a typo, what I meant was that the most squares that player 1 can have in a line WITHOUT having player 2 having any squares in that line is 3, if player 2 follows the strategy. I'll edit to make it clear. If you're the one that down-voted, I hope you'll reconsider. – user2566092 Aug 10 '14 at 20:35