Results 1 to 3 of 3

Thread: Tic Tac Toe Questions

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Jan 2000
    Posts
    123

    Post

    Yes. I recently made a program like this. What I did was make the user enter a selection as to who would go first. If the computer went first it would always move to the center square. If it was second it would first move to the center square and if not possible move to one of the corners. If the computer had made the first move and the player had made his first move it would search for a corner to move to. The only other time it would be nessacary to program a move other than the logic moves mentioned in the second message is if the computer has the center square and the player ocuppies 2 squares directly adjacent on the same plain. By this move the program should be able to check for a block and be able to almost randomly select a move in a dead end game to keep the player on their toes. By the way, using this statagy will allow the computer to make 85% of games tie and win 5% and lose 10%.(or at least that is what I have calculated) Try it! Also the source code is not currently availabe for me to show you, unfortuatly the game got wiped out when I formated! O well, shows you why you should make back up copies!

  2. #2
    Junior Member
    Join Date
    May 1999
    Location
    N/A, N/A, England
    Posts
    21

    Post

    Play yourself or a friend a number of times.

    Think about each move of each game and write down why you put your O or X in each square.

    E.G: Player one places an X in the top left corner. So I place my O in the bottom right which prevents a win win situation for X in two moves.

    After a number of games you'll have a series of AI routines written in English (if your 1st language is english, not if it's not but you get the idea).

    (hard bit) Code it so that the computer makes the decisions you did.

    ------------------
    Third year Software Engineering Student.

    On placement at the University of Manchester
    playing with expensive cool things...
    http://drinky.u4l.com
    [email protected]



  3. #3

    Thread Starter
    Lively Member
    Join Date
    Jan 2000
    Posts
    123

    Post

    I agree! The same procedure metioned above gave me a very complex If Then procedure if I ploted evry game. You would definatly condense the code into something useable. After the first 4 moves(9 moves to a game) the logical procedures from #1 will last the game.

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