|
Thread: Ai
-
Oct 17th, 2007, 05:15 AM
#1
Thread Starter
Lively Member
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
-
Oct 17th, 2007, 10:40 AM
#2
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
"I'm not normally a praying man, but if you're up there, save me... Superman!" - Homer Simpson
My Blog
-
Oct 18th, 2007, 04:56 PM
#3
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.
Every passing hour brings the Solar System forty-three thousand miles closer to Globular Cluster M13 in Hercules -- and still there are some misfits who insist that there is no such thing as progress.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|