Please test this Tic Tac Toe implementation

Check out my implementation of Tic Tac Toe. I had fun with this one, even though I had to change my methodology several times. I finally settled on a method based on a heuristic implementation. I do over-ride the heuristics if the computer makes the first move since the strict heuristics had it take the center position instead of a corner and this allows the human player additional moves playing to a draw, instead of the computer winning. Other than that one change, I let the heuristics do their thing, which really simplifies the code as it only has the one edge case.

The game is on Github, at:

https://marcnshapiro.github.io/tictactoe/index.html

3 Likes

I enjoyed the game and your code (with all those nice comments everywhere). I actually am going to revisit your code and I’m going to learn a lot from it. It’s just so enjoyable reading a code this well written and well documented. I chose the Monte Carlo method to predict the best move and I have to say it’s pretty unbeatable too. Congratulations on finishing this project!