0
101 Jan 28, 2007 at 23:40

Hi,
I made a simple console game Tic Tac Toe using C++. I made it to be played by two humans using the keyboard. I want to make this game to be played by one human against computer’s artificial intelligence. I need some help, some ideas. I will post my game tomorrow.
Sorry for my english.

#### 9 Replies

0
101 Jan 29, 2007 at 00:09

This is probably the most trivial problem in AI. Its easy to work out the correct move if you just implement the rules http://en.wikipedia.org/wiki/Tic-tac-toe

To give the AI a difficulty use a random move and the smarter the AI, the less it makes random moves

0
101 Jan 29, 2007 at 23:38

Thank you for the link. I will read all that informations about tic tac toe strategy. Implementing rules for AI is pretty hard for me now, but i will learn how to do that.
I want to post my game, but how?
Should I upload it on a server?

0
101 May 14, 2007 at 17:12

When making a tic-tac-like game, the AI should work like this:

1. Check if there is a tile that you can win in 1 move
if there is no such tile:
2. Check if there is a tile that your opponent can win in 1 move
if there is no such tile:
3. Check if there is a tile that can make two tiles apply to the rule #1
if there is no such tile:
4. Check if there is a tile that your opponent can make two tiles apply to the rule #2
if there is no such tile:
5. implement your own AI form this point

You can see similiar scheme in javascript on my gomoku site http://gomoku.atspace.com

Peace

0
101 May 15, 2007 at 02:56

Alpha-beta pruning (http://en.wikipedia.org/wiki/Alpha-beta_pruning) is the way to really speed up the Minimax algorithm.

Regards,

zakaluka.

0
104 May 18, 2007 at 14:12

the whole game is so simple you could record every single counter
move for every square manually in a lookuptable.

u can do chess like this, but without as much success because there
is too many permutations.

0
101 May 18, 2007 at 14:31

Just a small tip: It’s also fun to have a tic-tac-toe game, where the player will have to try to loose instead of win. I remember having a big time in an adventure game (don’t remember it’s name right now…) where a quest involved letting the opponent win in a tic-tac-toe game. Unfortunatelly, that opponent was doing everything so blatamly wrong that it was actually quite tricky to do.

0
101 Dec 21, 2007 at 04:55

i’ve implemented a tic tac toe game with a trainable neural network to play against and train. It took a while, but eventually it learned how to play as good as a human being, and even better.

0
167 Dec 21, 2007 at 06:22

I’m not really sure why anyone would implement a tic-tac-toe game with NNs. The game can easily be solved exactly using minimax search with alpha-beta pruning on modern machines. The strategy for this game is so simple that even humans can easily work out the optimal strategy with a little thought. Surely if one is trying to learn how to use NNs for game AI, there are better examples of applications?

0
101 Dec 22, 2007 at 03:37

I knot NN’s are the way to go in Tic Tac Toe, but i was learning about the theory behind NN and Tic Tac Toe was fairly easy and fast to implement, and ever better, the network was easy and fast to train, so it didn’t take long to see if my code actually worked as it should.