AI 2 - Game Playing (Artificial intelligence)


This is my second post on the topic of AI. The first covered AI basics, and was used to solve a simple single player game. In this article, I'm going to explain the minni-max method, which will enable you to take what you learned in the first article, and extend it to make multi-player games. If you didnt read my first article, dont wory, you should still be able to understand this, however having a quick read over it may be useful.

In this article, we are going to program a console naughts and cross' game (tic tac toe for those not in the UK). For those of you who dont know, the rules of tic tac toe are as follows...

You Start with a 3 by 3 grid...


Then the 2 players take it in turns to place a there marker on the board (one players uses the 'X' marker, the other uses the 'O' marker). The winner is the player who gets 3 of there markers in a row, eg...

X O  
  X O
O   X

X wins.

Another possibility, is that no1 wins. eg...


On the next page, I will begin to explain the theory.

You might also like...



Why not write for us? Or you could submit an event or a user group in your area. Alternatively just tell us what you think!

Our tools

We've got automatic conversion tools to convert C# to VB.NET, VB.NET to C#. Also you can compress javascript and compress css and generate sql connection strings.

“Never trust a programmer in a suit.” - Anonymous