Thread: An efficient approach to TicTacToe AI?

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Programming Wraith GReaper's Avatar
    Join Date
    Apr 2009
    Location
    Greece
    Posts
    2,738
    Just follow the usual steps when you play tictactoe.
    Devoted my life to programming...

  2. #2
    Registered User
    Join Date
    Jan 2011
    Posts
    4
    I know that, I just don't know how to link my steps with each other in a code...
    I was thinking of making a counter-defense way of thinking for the AI - analyze horizontally, diagonally and vertically if there are two of the player's marks ('x'/'o') and put a counter-move to that ('o'/'x') but if there are none - play offensively. But I think that would also require lots of ifs and loops (the defensive part). I would also have to take into account the tricky moves where you put the opponent in a "fork" where I have two places to put my mark that are a winning situation. Something like this:

    (ugh, spaces seem to be ignored so I put _ instead

    -------------
    | x | _ | x |
    | _ | o | _ |
    | x | _ | o |
    -------------

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. where to get algorithm of TicTacToe in approach w/ C
    By llinocoe in forum C Programming
    Replies: 2
    Last Post: 08-18-2008, 10:04 AM
  2. TicTacToe AI
    By Loic in forum C++ Programming
    Replies: 9
    Last Post: 05-28-2007, 01:37 PM
  3. chess ai contest
    By Raven Arkadon in forum Contests Board
    Replies: 7
    Last Post: 07-09-2005, 06:38 AM
  4. AI Contest Proposal
    By MadCow257 in forum Contests Board
    Replies: 4
    Last Post: 03-13-2005, 03:27 PM
  5. Game Design Topic #1 - AI Behavior
    By TechWins in forum Game Programming
    Replies: 13
    Last Post: 10-11-2002, 10:35 AM