Find the answer to your Linux question:
Page 1 of 2 1 2 LastLast
Results 1 to 10 of 15
I am making a quite simple tic tac toe game in flash. How should i make an AI to play against? Isn't there a smarter way than a lot of ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Mar 2005
    Location
    Roskilde, Denmark
    Posts
    93

    Artificial intelligence


    I am making a quite simple tic tac toe game in flash. How should i make an AI to play against?
    Isn't there a smarter way than a lot of if-arguments?

    By the way, sorry if I am posting in the wrong forum...

  2. #2
    Linux User
    Join Date
    Dec 2004
    Location
    Speed School of Engineering
    Posts
    267
    I had to do something like this before for a class.
    First, we wrote a simple program that first checked to see if the other player was about to win, and if so, so block the move. Otherwise, it made a random move.

    Then we wrote another program that began by making random moves. at the end of the game, if it won, then it would add a "point" to that sequence of moves, thereby increasing the chance of choosing that sequence of moves the next game. so it would "learn" what was a good move and what was a bad move. Then we set the two programs to play several thousand games against each other, and afterwards, the "learning" program played a pretty good game of tic-tac-toe

  3. #3
    Just Joined!
    Join Date
    Mar 2005
    Location
    Roskilde, Denmark
    Posts
    93
    thanks, that is a lot better than what I thougt of.

  4. #4
    Just Joined!
    Join Date
    Feb 2005
    Location
    Delft, Holland
    Posts
    95
    What were you thinking of?

  5. #5
    Just Joined!
    Join Date
    Mar 2005
    Location
    Roskilde, Denmark
    Posts
    93
    I would make an if-argument for every combination. You would end up with a whole lot of if arguments that way, if you should cover all posibilities, so I decided that there had to be a better way of doing it.

  6. #6
    Linux User
    Join Date
    Dec 2004
    Location
    Speed School of Engineering
    Posts
    267
    Quote Originally Posted by Veli
    I would make an if-argument for every combination. You would end up with a whole lot of if arguments that way, if you should cover all posibilities, so I decided that there had to be a better way of doing it.
    ah ha! the brute-force method. Long and tedious, but when you finish, you have an unbeatable tic tac toe game

  7. #7
    Just Joined!
    Join Date
    Feb 2005
    Location
    Delft, Holland
    Posts
    95
    I would make an if-argument for every combination. You would end up with a whole lot of if arguments that way, if you should cover all posibilities, so I decided that there had to be a better way of doing it.
    But that isn't AI, it's not Intelligent.

  8. #8
    Linux Newbie
    Join Date
    Nov 2004
    Posts
    239
    maybe you dont have to be intelligent to play tic tac toe


    I had to do a similar thing, I think we used game trees, which are binary trees with branches for every condition in the game....the trees start off massive but you can prune them down until you have a clear path to victory

  9. #9
    Linux User
    Join Date
    Dec 2004
    Location
    Speed School of Engineering
    Posts
    267
    if your doing this on flash, and it will be online, make an *actual* learning program that will learn by playing against real humans, rather than a simulated opponent. That way, the longer the game is online, the better the AI will become

  10. #10
    Linux Guru
    Join Date
    Apr 2003
    Location
    London, UK
    Posts
    3,284
    does anyone have any AI links they could put foward as "recommend reading"? ..maybe sites you've found useful in the past.

    This sounds like some interesting stuff

Page 1 of 2 1 2 LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •