DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

+ Reply to Thread
Results 1 to 2 of 2
  1. #1
    John Cruz Guest

    Help designing the AI in tictactoe



    can anyone help me think of the AI of tictactoe done in MFC. i know my base
    case should be that if the player won, or if all the cell are occupied then
    return then as for the general case i should check each move... then move
    the computer to that move. is this algorithm right??? if not can anyone give
    me an idea on what factors i should consider and stuff...
    anyways, thank you for your advice in advance

    John

  2. #2
    jonnin Guest

    Re: Help designing the AI in tictactoe


    this is not really ai, but just create a positions table (rotate to reduce
    to just a few cases) and point to the next best move. This includes draws
    and wins.

    IF you can't do this (not allowed that is) then do what you said. First
    see if its a win, then see if all done (draw). Do this after either side
    moves! For computer moves, you should search for a block of opponent win
    or dual (the place where if he goes there, he can win 2 ways and you can
    only block one). Block this, else find a dual for the compuer or a win for
    it.

    "John Cruz" <Baller187_69@hotmail.com> wrote:
    >
    >
    > can anyone help me think of the AI of tictactoe done in MFC. i know my

    base
    >case should be that if the player won, or if all the cell are occupied then
    >return then as for the general case i should check each move... then move
    >the computer to that move. is this algorithm right??? if not can anyone

    give
    >me an idea on what factors i should consider and stuff...
    >anyways, thank you for your advice in advance
    >
    >John



Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


Top DevX Stories

Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL


Sponsored Links