Original Post
There's alot of TicTacToe games out there...mostly 2 player. But im trying to get mine to work and it be a one player game. Programming AI isn't too fun
. But could someone help me out here? The "AI()" function is blank..thats where the AI programming goes. The code is messy but it shouldn't be impossible to read
BTW, its C++
#include <iostream>
#include <string>
#include <stdlib.h>
using namespace std;
////////////////////////////////////
char Top[4]= "000";
char Mid[4]= "000";
char Bot[4]= "000";
////////////////////////////////////
void GameInst();
void Board();
void Player();
////////////////////////////////////
int main()
{
cout<<"\n\t\t\tTicTacToe";
cout<<"\n\t\tCreated by Tom Williams (DarkWhoppy)";
GameInst();
system("Pause");
}
void GameInst()
{
cout<<"\n\n\n\nHow to play.\n"
<<"q w e\n\n"
<<"a s d\n\n"
<<"z x c";
cout<<"\n\nThat should look like a TTT board...\n\n";
system("Pause");
system("cls");
Board();
Player();
}
/////////////////////////////////////////////////////////////////
void Board()
{
cout<<"\t\t\t---Board---\n\n";
cout<<"\t\t\t"<<Top<<"\n";
cout<<"\t\t\t"<<Mid<<"\n";
cout<<"\t\t\t"<<Bot<<"\n";
}
////////////////////////////////////////////////////////////////
void Player()
{
char picked;
cout<<"Pick'a spot, you know the keys: ";
cin>>picked;
if(picked == 'q' && Top[0] == '0')
{ Top[0] = 'X'; }
if(picked == 'w' && Top[1] == '0')
{ Top[1] = 'X'; }
if(picked == 'e' && Top[2] == '0')
{ Top[2] = 'X'; }
if(picked == 'a' && Mid[0] == '0')
{ Mid[0] = 'X'; }
if(picked == 's' && Mid[1] == '0')
{ Mid[1] = 'X'; }
if(picked == 'd' && Mid[2] == '0')
{ Mid[2] = 'X'; }
if(picked == 'z' && Bot[0] == '0')
{ Mid[0] = 'X'; }
if(picked == 'x' && Bot[1] == '0')
{ Bot[1] = 'X'; }
if(picked == 'c' && Bot[2] == '0')
{ Bot[2] = 'X'; }
system("cls");
Board();
}
//////////////////////////////////////////////////////////
void AI()
{
}
[edited by - DarkWhoppy on August 1, 2003 10:35:35 PM]