Enjoy an ad free experience by logging in. Not a member yet? Register.
1. ## 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. 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. thanks, that is a lot better than what I thougt of.

4. \$spacer_open \$spacer_close
5. What were you thinking of?

6. 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.

7. 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

8. 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.

9. 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

10. 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

11. 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

#### Posting Permissions

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