Results 1 to 3 of 3

Thread: Ai

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Nov 2005
    Posts
    76

    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

  2. #2
    Arabic Poster ComputerJy's Avatar
    Join Date
    Nov 2005
    Location
    Happily misplaced
    Posts
    2,513

    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

  3. #3
    PowerPoster sunburnt's Avatar
    Join Date
    Feb 2001
    Location
    Boulder, Colorado
    Posts
    1,403

    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
  •  



Click Here to Expand Forum to Full Width