We need you!

We're working hard on the next version of Developer Fusion. Let us know what you think we should be up to!

Members

Technology Zones

Articles

Hosted By

MaximumASP

Info

Rated
Read 22,408 times

Contents

Downloads

Related Categories

AI 2 - Game Playing (Artificial intelligence) - Introduction

qwijibow

Introduction

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

O O X
X X O
O O X

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

Comments

  • ?windows.h?

    Posted by abhaysaxena31 on 12 Sep 2005

    wher do i get the windows.h header file? the main.cpp code doesnt seem to work and has quite a few errors. help please!:)

  • saving to a file

    Posted by oyetih on 07 Aug 2005

    after you get this code to run i need to know how to be able to save to a file and replay the game play before. if the player is starting a new game he/she should be prompted to enter their name and i...