Tic Tac Toe

Started by
18 comments, last by kango19 19 years, 10 months ago
quote:Original post by Venerable Vampire
whitespace *snort*
is that a joke?


There''s a Sokoban game implemented in sed script ferchrissake! Why should whitespace be a joke?

As for a Tic Tac Toe AI, it is pretty trivial to figure out how to finish a game in the second move. The first player can only play the center spot (leads to a stalemate if the second player isn''t totally dumb), on a side or in a corner (second player must play the center spot or lose). The "AI" just needs to know the openings and afterwards recognize a "threat" where a line needs to be blocked.
Advertisement
Zoltron, use Google first.

--
You''re Welcome,
Rick Wong
- Google | Google for GameDev.net | GameDev.net''s DirectX FAQ. (not as cool as the Graphics and Theory FAQ)
Okay, I've decided I'm going to post my code so far. This is so you can laugh at me, again, and then you can point out what I should do. I realize that this is horrible programming, doing basically everything in one function. I also understand it will be hard to read.

It's been a while since my last program, so you'll have to bear with me. I want to make TicTacToe a class, I think. But I forgot how to use classes properly. I also want main to mainly be just a bunch of function calls, and I want to get rid of all those if statements, and just put them in a single function that I can call over and over.

Anyways, here is what I have so far..all helpful suggestions welcome:

quote:#include <stdio.h>
#include <iostream>
#include <string>
#include <cstdlib>
#include <cctype>
#include <iomanip>

//Game Type functions:
void OnePlayerGame();
void TwoPlayerGame();

int main(int argc, char *argv[])
{
//Game Introduction...
int NumOfPlayers = 3;
bool LoopControl = 0;

cout << "Welcome to Tic Tac Toe by David Demaree.\n";

do
{
cout << "Would you like to play 1 or 2 players (enter 0 to quit)? ";
cin >> NumOfPlayers;

//Switch to game or quit game:
if (NumOfPlayers == 0)
{
LoopControl = 1;
}
else if (NumOfPlayers == 1)
{
OnePlayerGame();
}
else if (NumOfPlayers == 2)
{
TwoPlayerGame();
}
else
{
cout << "You have entered an unsupported game type. Please enter 1 or 2.\n";
}
}while(LoopControl == 0);

return 0;
}

void onePlayerGame()
{
int oney = 0;
cout << "Welcome to the 1 player game.\n";
cin >> Oney;
}

void TwoPlayerGame()
{
string XorO = "unspoiled";
int i = 0;
int BoardPlay = 10;
int TicTacToeArray[9];
string TicTacToeDisplay[9];
bool XOLoop = 0;
bool GameLoop = 0;

for (i = 0; i < 9; i++)
{
TicTacToeArray = 0;<br> }<br><br> TicTacToeDisplay[0] = "1";<br> TicTacToeDisplay[1] = "2";<br> TicTacToeDisplay[2] = "3";<br> TicTacToeDisplay[3] = "4";<br> TicTacToeDisplay[4] = "5";<br> TicTacToeDisplay[5] = "6";<br> TicTacToeDisplay[6] = "7";<br> TicTacToeDisplay[7] = "8";<br> TicTacToeDisplay[8] = "9";<br><br><br> cout << "Welcome to the 2 player game.\n";<br><br>do{<br> cout << "Would you like to be X's or O's? Enter X to be X's or O to be O's. ";<br> cin >> XorO;<br> cout << "This is what was received for XorO: " << XorO << endl;<br><br> if (XorO == "X" || XorO == "x")<br> {<br> cout << "You have chosen to be X's.\n";<br> XorO = "X";<br> XOLoop = 1;<br> }<br> else if (XorO == "O" || XorO == "o")<br> {<br> cout << "You have chosen to be O's.\n";<br> XorO = "O";<br> XOLoop = 1;<br> }<br> else<br> {<br> cout << "Please enter X or O. You entered an unsupported selection.\n";<br> XOLoop = 0;<br> }<br>}while(XOLoop == 0);<br><br> cout << "\n\n";<br> cout << " " << TicTacToeDisplay[6] << " | ";<br> cout << TicTacToeDisplay[7] << " | ";<br> cout << TicTacToeDisplay[8] << " " << endl;<br> cout << " ———–" << endl;<br> cout << " " << TicTacToeDisplay[3] << " | ";<br> cout << TicTacToeDisplay[4] << " | ";<br> cout << TicTacToeDisplay[5] << " " << endl;<br> cout << " ———–" << endl;<br> cout << " " << TicTacToeDisplay[0] << " | ";<br> cout << TicTacToeDisplay[1] << " | ";<br> cout << TicTacToeDisplay[2] << " " << endl << endl << endl;<br><br>do{<br> cout << "Player " << XorO << ", where would you like to put your " << XorO << "?\n";<br> cout << "Enter a space &#111;n the board 1-9 (enter 0 to stop playing). ";<br> cin >> BoardPlay;<br><br> if (BoardPlay >= 0 && BoardPlay < 10)<br> {<br> if (BoardPlay == 0)<br> {<br> GameLoop = 1;<br> }<br> else if (BoardPlay == 1 && TicTacToeArray[0] == 0)<br> {<br> if (XorO == "X")<br> {<br> TicTacToeArray[0] = 55;<br> TicTacToeDisplay[0] = "X";<br> XorO = "O";<br><br> cout << "\n\n";<br> cout << " " << TicTacToeDisplay[6] << " | ";<br> cout << TicTacToeDisplay[7] << " | ";<br> cout << TicTacToeDisplay[8] << " " << endl;<br> cout << " ———–" << endl;<br> cout << " " << TicTacToeDisplay[3] << " | ";<br> cout << TicTacToeDisplay[4] << " | ";<br> cout << TicTacToeDisplay[5] << " " << endl;<br> cout << " ———–" << endl;<br> cout << " " << TicTacToeDisplay[0] << " | ";<br> cout << TicTacToeDisplay[1] << " | ";<br> cout << TicTacToeDisplay[2] << " " << endl << endl << endl;<br> }<br> else if (XorO == "O")<br> {<br> TicTacToeArray[0] = 88;<br> TicTacToeDisplay[0] = "O";<br> XorO = "X";<br><br> cout << "\n\n";<br> cout << " " << TicTacToeDisplay[6] << " | ";<br> cout << TicTacToeDisplay[7] << " | ";<br> cout << TicTacToeDisplay[8] << " " << endl;<br> cout << " ———–" << endl;<br> cout << " " << TicTacToeDisplay[3] << " | ";<br> cout << TicTacToeDisplay[4] << " | ";<br> cout << TicTacToeDisplay[5] << " " << endl;<br> cout << " ———–" << endl;<br> cout << " " << TicTacToeDisplay[0] << " | ";<br> cout << TicTacToeDisplay[1] << " | ";<br> cout << TicTacToeDisplay[2] << " " << endl << endl << endl;<br> }<br> }<br> else if (BoardPlay == 2 && TicTacToeArray[1] == 0)<br> {<br> if (XorO == "X")<br> {<br> TicTacToeArray[1] = 55;<br> TicTacToeDisplay[1] = "X";<br> XorO = "O";<br><br> cout << "\n\n";<br> cout << " " << TicTacToeDisplay[6] << " | ";<br> cout << TicTacToeDisplay[7] << " | ";<br> cout << TicTacToeDisplay[8] << " " << endl;<br> cout << " ———–" << endl;<br> cout << " " << TicTacToeDisplay[3] << " | ";<br> cout << TicTacToeDisplay[4] << " | ";<br> cout << TicTacToeDisplay[5] << " " << endl;<br> cout << " ———–" << endl;<br> cout << " " << TicTacToeDisplay[0] << " | ";<br> cout << TicTacToeDisplay[1] << " | ";<br> cout << TicTacToeDisplay[2] << " " << endl << endl << endl;<br> }<br> else if (XorO == "O")<br> {<br> TicTacToeArray[1] = 88;<br> TicTacToeDisplay[1] = "O";<br> XorO = "X";<br><br> cout << "\n\n";<br> cout << " " << TicTacToeDisplay[6] << " | ";<br> cout << TicTacToeDisplay[7] << " | ";<br> cout << TicTacToeDisplay[8] << " " << endl;<br> cout << " ———–" << endl;<br> cout << " " << TicTacToeDisplay[3] << " | ";<br> cout << TicTacToeDisplay[4] << " | ";<br> cout << TicTacToeDisplay[5] << " " << endl;<br> cout << " ———–" << endl;<br> cout << " " << TicTacToeDisplay[0] << " | ";<br> cout << TicTacToeDisplay[1] << " | ";<br> cout << TicTacToeDisplay[2] << " " << endl << endl << endl;<br> }<br> }<br> else if (BoardPlay == 3 && TicTacToeArray[2] == 0)<br> {<br> if (XorO == "X")<br> {<br> TicTacToeArray[2] = 55;<br> TicTacToeDisplay[2] = "X";<br> XorO = "O";<br><br> cout << "\n\n";<br> cout << " " << TicTacToeDisplay[6] << " | ";<br> cout << TicTacToeDisplay[7] << " | ";<br> cout << TicTacToeDisplay[8] << " " << endl;<br> cout << " ———–" << endl;<br> cout << " " << TicTacToeDisplay[3] << " | ";<br> cout << TicTacToeDisplay[4] << " | ";<br> cout << TicTacToeDisplay[5] << " " << endl;<br> cout << " ———–" << endl;<br> cout << " " << TicTacToeDisplay[0] << " | ";<br> cout << TicTacToeDisplay[1] << " | ";<br> cout << TicTacToeDisplay[2] << " " << endl << endl << endl;<br> }<br> else if (XorO == "O")<br> {<br> TicTacToeArray[2] = 88;<br> TicTacToeDisplay[2] = "O";<br> XorO = "X";<br><br> cout << "\n\n";<br> cout << " " << TicTacToeDisplay[6] << " | ";<br> cout << TicTacToeDisplay[7] << " | ";<br> cout << TicTacToeDisplay[8] << " " << endl;<br> cout << " ———–" << endl;<br> cout << " " << TicTacToeDisplay[3] << " | ";<br> cout << TicTacToeDisplay[4] << " | ";<br> cout << TicTacToeDisplay[5] << " " << endl;<br> cout << " ———–" << endl;<br> cout << " " << TicTacToeDisplay[0] << " | ";<br> cout << TicTacToeDisplay[1] << " | ";<br> cout << TicTacToeDisplay[2] << " " << endl << endl << endl;<br> }<br> }<br> else if (BoardPlay == 4 && TicTacToeArray[3] == 0)<br> {<br> if (XorO == "X")<br> {<br> TicTacToeArray[3] = 55;<br> TicTacToeDisplay[3] = "X";<br> XorO = "O";<br><br> cout << "\n\n";<br> cout << " " << TicTacToeDisplay[6] << " | ";<br> cout << TicTacToeDisplay[7] << " | ";<br> cout << TicTacToeDisplay[8] << " " << endl;<br> cout << " ———–" << endl;<br> cout << " " << TicTacToeDisplay[3] << " | ";<br> cout << TicTacToeDisplay[4] << " | ";<br> cout << TicTacToeDisplay[5] << " " << endl;<br> cout << " ———–" << endl;<br> cout << " " << TicTacToeDisplay[0] << " | ";<br> cout << TicTacToeDisplay[1] << " | ";<br> cout << TicTacToeDisplay[2] << " " << endl << endl << endl;<br> }<br> else if (XorO == "O")<br> {<br> TicTacToeArray[3] = 88;<br> TicTacToeDisplay[3] = "O";<br> XorO = "X";<br><br> cout << "\n\n";<br> cout << " " << TicTacToeDisplay[6] << " | ";<br> cout << TicTacToeDisplay[7] << " | ";<br> cout << TicTacToeDisplay[8] << " " << endl;<br> cout << " ———–" << endl;<br> cout << " " << TicTacToeDisplay[3] << " | ";<br> cout << TicTacToeDisplay[4] << " | ";<br> cout << TicTacToeDisplay[5] << " " << endl;<br> cout << " ———–" << endl;<br> cout << " " << TicTacToeDisplay[0] << " | ";<br> cout << TicTacToeDisplay[1] << " | ";<br> cout << TicTacToeDisplay[2] << " " << endl << endl << endl;<br> }<br> }<br> else if (BoardPlay == 5 && TicTacToeArray[4] == 0)<br> {<br> if (XorO == "X")<br> {<br> TicTacToeArray[4] = 55;<br> TicTacToeDisplay[4] = "X";<br> XorO = "O";<br><br> cout << "\n\n";<br> cout << " " << TicTacToeDisplay[6] << " | ";<br> cout << TicTacToeDisplay[7] << " | ";<br> cout << TicTacToeDisplay[8] << " " << endl;<br> cout << " ———–" << endl;<br> cout << " " << TicTacToeDisplay[3] << " | ";<br> cout << TicTacToeDisplay[4] << " | ";<br> cout << TicTacToeDisplay[5] << " " << endl;<br> cout << " ———–" << endl;<br> cout << " " << TicTacToeDisplay[0] << " | ";<br> cout << TicTacToeDisplay[1] << " | ";<br> cout << TicTacToeDisplay[2] << " " << endl << endl << endl;<br> }<br> else if (XorO == "O")<br> {<br> TicTacToeArray[4] = 88;<br> TicTacToeDisplay[4] = "O";<br> XorO = "X";<br><br> cout << "\n\n";<br> cout << " " << TicTacToeDisplay[6] << " | ";<br> cout << TicTacToeDisplay[7] << " | ";<br> cout << TicTacToeDisplay[8] << " " << endl;<br> cout << " ———–" << endl;<br> cout << " " << TicTacToeDisplay[3] << " | ";<br> cout << TicTacToeDisplay[4] << " | ";<br> cout << TicTacToeDisplay[5] << " " << endl;<br> cout << " ———–" << endl;<br> cout << " " << TicTacToeDisplay[0] << " | ";<br> cout << TicTacToeDisplay[1] << " | ";<br> cout << TicTacToeDisplay[2] << " " << endl << endl << endl;<br> }<br> }<br> else if (BoardPlay == 6 && TicTacToeArray[5] == 0)<br> {<br> if (XorO == "X")<br> {<br> TicTacToeArray[5] = 55;<br> TicTacToeDisplay[5] = "X";<br> XorO = "O";<br><br> cout << "\n\n";<br> cout << " " << TicTacToeDisplay[6] << " | ";<br> cout << TicTacToeDisplay[7] << " | ";<br> cout << TicTacToeDisplay[8] << " " << endl;<br> cout << " ———–" << endl;<br> cout << " " << TicTacToeDisplay[3] << " | ";<br> cout << TicTacToeDisplay[4] << " | ";<br> cout << TicTacToeDisplay[5] << " " << endl;<br> cout << " ———–" << endl;<br> cout << " " << TicTacToeDisplay[0] << " | ";<br> cout << TicTacToeDisplay[1] << " | ";<br> cout << TicTacToeDisplay[2] << " " << endl << endl << endl;<br> }<br> else if (XorO == "O")<br> {<br> TicTacToeArray[5] = 88;<br> TicTacToeDisplay[5] = "O";<br> XorO = "X";<br><br> cout << "\n\n";<br> cout << " " << TicTacToeDisplay[6] << " | ";<br> cout << TicTacToeDisplay[7] << " | ";<br> cout << TicTacToeDisplay[8] << " " << endl;<br> cout << " ———–" << endl;<br> cout << " " << TicTacToeDisplay[3] << " | ";<br> cout << TicTacToeDisplay[4] << " | ";<br> cout << TicTacToeDisplay[5] << " " << endl;<br> cout << " ———–" << endl;<br> cout << " " << TicTacToeDisplay[0] << " | ";<br> cout << TicTacToeDisplay[1] << " | ";<br> cout << TicTacToeDisplay[2] << " " << endl << endl << endl;<br> }<br> }<br> else if (BoardPlay == 7 && TicTacToeArray[6] == 0)<br> {<br> if (XorO == "X")<br> {<br> TicTacToeArray[6] = 55;<br> TicTacToeDisplay[6] = "X";<br> XorO = "O";<br><br> cout << "\n\n";<br> cout << " " << TicTacToeDisplay[6] << " | ";<br> cout << TicTacToeDisplay[7] << " | ";<br> cout << TicTacToeDisplay[8] << " " << endl;<br> cout << " ———–" << endl;<br> cout << " " << TicTacToeDisplay[3] << " | ";<br> cout << TicTacToeDisplay[4] << " | ";<br> cout << TicTacToeDisplay[5] << " " << endl;<br> cout << " ———–" << endl;<br> cout << " " << TicTacToeDisplay[0] << " | ";<br> cout << TicTacToeDisplay[1] << " | ";<br> cout << TicTacToeDisplay[2] << " " << endl << endl << endl;<br> }<br> else if (XorO == "O")<br> {<br> TicTacToeArray[6] = 88;<br> TicTacToeDisplay[6] = "O";<br> XorO = "X";<br><br> cout << "\n\n";<br> cout << " " << TicTacToeDisplay[6] << " | ";<br> cout << TicTacToeDisplay[7] << " | ";<br> cout << TicTacToeDisplay[8] << " " << endl;<br> cout << " ———–" << endl;<br> cout << " " << TicTacToeDisplay[3] << " | ";<br> cout << TicTacToeDisplay[4] << " | ";<br> cout << TicTacToeDisplay[5] << " " << endl;<br> cout << " ———–" << endl;<br> cout << " " << TicTacToeDisplay[0] << " | ";<br> cout << TicTacToeDisplay[1] << " | ";<br> cout << TicTacToeDisplay[2] << " " << endl << endl << endl;<br> }<br> }<br> else if (BoardPlay == 8 && TicTacToeArray[7] == 0)<br> {<br> if (XorO == "X")<br> {<br> TicTacToeArray[7] = 55;<br> TicTacToeDisplay[7] = "X";<br> XorO = "O";<br><br> cout << "\n\n";<br> cout << " " << TicTacToeDisplay[6] << " | ";<br> cout << TicTacToeDisplay[7] << " | ";<br> cout << TicTacToeDisplay[8] << " " << endl;<br> cout << " ———–" << endl;<br> cout << " " << TicTacToeDisplay[3] << " | ";<br> cout << TicTacToeDisplay[4] << " | ";<br> cout << TicTacToeDisplay[5] << " " << endl;<br> cout << " ———–" << endl;<br> cout << " " << TicTacToeDisplay[0] << " | ";<br> cout << TicTacToeDisplay[1] << " | ";<br> cout << TicTacToeDisplay[2] << " " << endl << endl << endl;<br> }<br> else if (XorO == "O")<br> {<br> TicTacToeArray[7] = 88;<br> TicTacToeDisplay[7] = "O";<br> XorO = "X";<br><br> cout << "\n\n";<br> cout << " " << TicTacToeDisplay[6] << " | ";<br> cout << TicTacToeDisplay[7] << " | ";<br> cout << TicTacToeDisplay[8] << " " << endl;<br> cout << " ———–" << endl;<br> cout << " " << TicTacToeDisplay[3] << " | ";<br> cout << TicTacToeDisplay[4] << " | ";<br> cout << TicTacToeDisplay[5] << " " << endl;<br> cout << " ———–" << endl;<br> cout << " " << TicTacToeDisplay[0] << " | ";<br> cout << TicTacToeDisplay[1] << " | ";<br> cout << TicTacToeDisplay[2] << " " << endl << endl << endl;<br> }<br> }<br> else if (BoardPlay == 9 && TicTacToeArray[8] == 0)<br> {<br> if (XorO == "X")<br> {<br> TicTacToeArray[8] = 55;<br> TicTacToeDisplay[8] = "X";<br> XorO = "O";<br><br> cout << "\n\n";<br> cout << " " << TicTacToeDisplay[6] << " | ";<br> cout << TicTacToeDisplay[7] << " | ";<br> cout << TicTacToeDisplay[8] << " " << endl;<br> cout << " ———–" << endl;<br> cout << " " << TicTacToeDisplay[3] << " | ";<br> cout << TicTacToeDisplay[4] << " | ";<br> cout << TicTacToeDisplay[5] << " " << endl;<br> cout << " ———–" << endl;<br> cout << " " << TicTacToeDisplay[0] << " | ";<br> cout << TicTacToeDisplay[1] << " | ";<br> cout << TicTacToeDisplay[2] << " " << endl << endl << endl;<br> }<br> else if (XorO == "O")<br> {<br> TicTacToeArray[8] = 88;<br> TicTacToeDisplay[8] = "O";<br> XorO = "X";<br><br> cout << "\n\n";<br> cout << " " << TicTacToeDisplay[6] << " | ";<br> cout << TicTacToeDisplay[7] << " | ";<br> cout << TicTacToeDisplay[8] << " " << endl;<br> cout << " ———–" << endl;<br> cout << " " << TicTacToeDisplay[3] << " | ";<br> cout << TicTacToeDisplay[4] << " | ";<br> cout << TicTacToeDisplay[5] << " " << endl;<br> cout << " ———–" << endl;<br> cout << " " << TicTacToeDisplay[0] << " | ";<br> cout << TicTacToeDisplay[1] << " | ";<br> cout << TicTacToeDisplay[2] << " " << endl << endl << endl;<br> }<br> }<br> else<br> cout << "That spot is already occupied, choose another.\n";<br> }<br><br><br> else<br> {<br> cout << "You entered an unsupported selection.\n";<br> GameLoop = 0;<br> }<br> }while(GameLoop == 0);<br><br> }<hr height=1 noshade></SPAN></BLOCKQUOTE><br><br>I also think I might be way off target here. I'm just trying to make a simple Tic Tac Toe game that can be played 1 or 2 players. I haven't even started checking for the winner yet. The &#111;ne player game is not at all functional either at this point. <br><br><SPAN CLASS=editedby>[edited by - Zoltron_Laser on June 8, 2004 2:05:41 PM]</SPAN> <br><br><SPAN CLASS=editedby>[edited by - Zoltron_Laser on June 8, 2004 2:07:31 PM]</SPAN>
quote:
cout << "\n\n";
cout << " " << TicTacToeDisplay[6] << " | ";
cout << TicTacToeDisplay[7] << " | ";
cout << TicTacToeDisplay[8] << " " << endl;
cout << " -----------" << endl;
cout << " " << TicTacToeDisplay[3] << " | ";
cout << TicTacToeDisplay[4] << " | ";
cout << TicTacToeDisplay[5] << " " << endl;
cout << " -----------" << endl;
cout << " " << TicTacToeDisplay[0] << " | ";
cout << TicTacToeDisplay[1] << " | ";
cout << TicTacToeDisplay[2] << " " << endl << endl << endl;


You have this in your code so much it hurts . This would be great for a function. Like function DrawBoard(). You need to come up with a more general solution/algorithm too.
for x = 0 to lnum
for y = 0 to cnum - 1
print board(x,y) & " | "
next y
print board(x, cnum)
print "\n"
next y

Please adapt this psudo-basic-C codish thing into what you need.
lnum = the number of lines, cnum = number of cols.

For the Ai, go for a probabilistic ai,
for every square that isn''t taken, set its probability of being taken to a value in an array.
for every square that is taken, modify other squares''s probability by a value in an array.
Just put in a proportional random number generator and your set. (i''ve done this before, and it works great!, though i built a general purpouse ai engine dll!).

Hope this helps
DENC
Click here to patch the mozilla IDN exploit, or click Here then type in Network.enableidn and set its value to false. Restart the browser for the patches to work.
Thanks guys. That was helpful. I had the program running, but without the random numbers....so I fixed that part quickly.
Hi.
Don't listen to the guy who talks about c# or jhava, he's trying to fool you into going into Evil. This guy is Evil.
Use GCC or Dev-C++ (it's derived from GCC).
Good programming!!
Prog, Games & Rock'n'Roll :I don't like the Prog but the Prog likes me.
Just a tip for the future; when posting long bits of code use [source] tags instead of tags. It will put your code in a nice tiny little box instead of taking up a large piece of the page.

Wielder of the Sacred Wands
[Work - ArenaNet] [Epoch Language] [Scribblings]

On the AI front, Tic Tac Toe is a prime example of where to use the "Chess Tree Search". It is a planning algorithm that saves the board state and then searches each possible move for BOTH sides - each time saving the board state again and continuing on to the NEXT possible moves for THAT state. It only quits once it gets to an end game state (win for either side or a draw) and then rolls the win/loss back up the tree. Once you get done searching all the branches of the tree from the current state, the move with the highest number of win possibilities for your side is the move to take.

Obviously, it is quite a bit more complex than this but beats the hell outta some random placement algorithm. There are numerous references to how to do this... some of which are in the "Articles" section here.

One thing at a time, though.

Dave Mark - President and Lead Designer of Intrinsic Algorithm LLC
Professional consultant on game AI, mathematical modeling, simulation modeling
Co-founder and 10 year advisor of the GDC AI Summit
Author of the book, Behavioral Mathematics for Game AI
Blogs I write:
IA News - What's happening at IA | IA on AI - AI news and notes | Post-Play'em - Observations on AI of games I play

"Reducing the world to mathematical equations!"

http://www.gametutorials.com/Tutorials/GT/GT_Pg1.htm

source code for simple tic-tac-toe game (it is for VC++, but it may help you) player vs AI, with comments and explanations...

This topic is closed to new replies.

Advertisement