-
Ai
Hi,
I'm creating a small noughts and crosses game (tic tac toe) and it works fine for 2 players. However I would like to be able to play vs a computer. I was just wondering if any one could direct me, on how to even approach this... I've never writen a piece of AI code. Thanks in a advanced.
Steve
-
Re: Ai
Tic-Tac-Toe is a simple game and doesn't require the implementation of AI technologies, you'll have to write conditional code for that
-
Re: Ai
Because the problem space is not very large for a tic tac toe game, a simple solution is to recursively play out the game based on any possible moves, then pick the initial move that had ended up 'best' based on some metric like (wins + .5 * ties) / (wins + ties + losses). If you want, you can then add some element of randomization into it so that the game plays a little differently each time.