include <iostream>
#include <stdlib.h>
using namespace std; // Whatever the hell that means.
int main(int argc, char *argv[]) // It was like this when I started. Dont touch!
{
// INT the position variables :-p
int L1_R1 = 0;
int L1_R2 = 0;
int L1_R3 = 0;
int L2_R1 = 0;
int L2_R2 = 0;
int L2_R3 = 0;
int L3_R1 = 0;
int L3_R2 = 0;
int L3_R3 = 0;
int US_ER = 0;
int CO_NM = 0;
int CA_NO = 0;
// Intro the user, untill they fall asleep... *yahn*
cout<<"-=[ TIC-TAC-TOE ]=-"<<endl;
cout<<"-By Cameron Garvie-"<<endl<<endl;
cout<<"I assume you know how to play Tic-Tac-Toe, and this is no different."<<endl;
cout<<"I show you the board, and ask for your position. Then I update it."<<endl;
cout<<"The first player to get three in a row wins. Although I am unbeatable."<<endl;
cout<<endl<<"The main format for your position is the width then the height.";
cout<<endl<<"Here is an example, 22. This will put a 8 in the center.";
cout<<endl<<"You can be 8's. I will be 4's. There is no difference. Don't complain.";
cout<<endl<<"Zero's mean that the space is empty and you may go there.";
cout<<endl<<endl;
// You mean we actually "play" the game? lol.
cout<<"Let's begin! Here is the board:"<<endl;
while (CO_NM<5)
{
// What a ghetto looking board.
cout<<" "<<L1_R1<<"|"<<L2_R1<<"|"<<L3_R1<<endl;
cout<<" "<<"- - -"<<endl;
cout<<" "<<L1_R2<<"|"<<L2_R2<<"|"<<L3_R2<<endl;
cout<<" "<<"- - -"<<endl;
cout<<" "<<L1_R3<<"|"<<L2_R3<<"|"<<L3_R3<<endl;
cout<<"So what is your choice? ";
cin>>US_ER;
// What the hell did they say?
if (US_ER == 11) { L1_R1 = 8; }
if (US_ER == 12) { L1_R2 = 8; }
if (US_ER == 13) { L1_R3 = 8; }
if (US_ER == 21) { L2_R1 = 8; }
if (US_ER == 22) { L2_R2 = 8; }
if (US_ER == 23) { L2_R3 = 8; }
if (US_ER == 31) { L3_R1 = 8; }
if (US_ER == 32) { L3_R2 = 8; }
if (US_ER == 33) { L3_R3 = 8; }
// Backing up that "Unbeatable" comment!
CA_NO = 0;
if (CA_NO == 0) { if (L1_R1 == 8) { if (L1_R2 == 8) { if (L1_R3 == 0) {
L1_R3 = 4; CA_NO = 1; } } } }
if (CA_NO == 0) { if (L1_R1 == 8) { if (L2_R1 == 8) { if (L3_R1 == 0) {
L3_R1 = 4; CA_NO = 1; } } } }
if (CA_NO == 0) { if (L1_R1 == 8) { if (L2_R2 == 8) { if (L3_R3 == 0) {
L3_R3 = 4; CA_NO = 1; } } } }
if (CA_NO == 0) { if (L1_R1 == 0) { L1_R1 = 4; CA_NO = 1; } }
if (CA_NO == 0) { if (L2_R2 == 0) { L2_R2 = 4; CA_NO = 1; } }
if (CA_NO == 0) { if (L3_R3 == 0) { L3_R3 = 4; CA_NO = 1; } }
if (CA_NO == 0) { if (L1_R2 == 0) { L1_R2 = 4; CA_NO = 1; } }
if (CA_NO == 0) { if (L1_R3 == 0) { L1_R3 = 4; CA_NO = 1; } }
if (CA_NO == 0) { if (L2_R1 == 0) { L2_R1 = 4; CA_NO = 1; } }
if (CA_NO == 0) { if (L2_R3 == 0) { L2_R3 = 4; CA_NO = 1; } }
// Add to the move count...
CO_NM = CO_NM + 1;
}
// Lets wrap this up!
cout<<endl<<endl;
cout<<"Well thats it... this was just a little game i made to learn C++!"<<endl;
cout<<"I hope you enjoyed it! Please help me with the AI. I should have "<<endl;
cout<<"used arrays. Then I could program better opponents. Well, goodbye."<<endl;
cout<<endl;
system("pause");
return 0;
}