Initial Tic Tac Toe Game done. I still would need to improve it with a implementation of the minimax algorithm for the values of the computer next to the first. But this comes a long way from my present skills.
Still it is been hard work for what I would apreciate any comment about that, whichever.
Tic Tac Toe GAME
I like the game…nice transitions in the interface. I have a few constructive criticisms:
- Bug: when you win the game, it doesn’t necessarily highlight the 3 cells in a row that win. It seems to pick any 3 adjacent cells
- Minor UI issue: when X or O is placed in the cell it causes the grid to resize slightly. It is somewhat distracting
- Nitpick: The AI is bad - is it completely random? It didn’t even try to block my moves. Tic-tac-toe is a solved game. You can look into the minimax algorithm to create an unbeatable AI. I used minimax with a small random chance of the computer making a mistake
Good job - keep improving!
Many thanks for the feed-back.
Very tough exercice.
Finally I implemented the famous mini-max algorihtm:
Computer looks for value in the following order:
1.- Value where computer wins and make the line.
2.- Value to avoid user winning
3.- Best option for second value: value in line where the first computer value is and there is not any user value.
4. Residual value when none of the above (for example first computer value)
I sorted the resizing if the grid making X and O placed in a new div overlaying the table.
I sorted the highlighting of the line.What highlights is the solution line only and not the array that was accumulating the winner tiles.