C++ Program Code Soduko game
Following is the Code for Soduko game written in C++.
//================================================
// written by Zain Aftab
//================================================
#include <iostream>
#include <cstdlib>
#include <time.h>
using namespace std;
int counter;
int arr[9][3][3];
void undo(int x,int y,int z)
{
arr[x][y][z] = 0;
}
bool validate(int x,int y,int z,int value)//checks the input
{
while(x>=9 || x<0)
{
cout << "Enter BOX (from 0 - 8): ";
cin >> x;
}
while(y>=3 || y<0)
{
cout << "Enter ROW (from 0 - 2) : ";
cin >> y;
}
while(z>=3 || z<0)
{
cout << "Enter COLUMN (from 0 - 2) : ";
cin >> z;
}
while(value <1 || value>9)
{
cout << "Enter value (from 1 - 9) : ";
cin >> value;
}
if(arr[x][y][z] != 0)
{
cout << "Place Not Empty....\n\n";
}
for (int i = 0 ; i < 3 ; i++)
{
for (int j = 0 ; j < 3 ; j++)
{
if(arr[x][i][j]==value)
{
cout << "In Box Value Exists.... \n\n";
return false;
}
}
}
// checks the value's existance in rows and columns
if( x == 0 || x == 3 || x == 6 )
{
if (x==0)
{
for (int j = 0 ; j < 3 ; j++)
{
if(arr[1][y][j]==value)
{
cout << "In row Value Exists....\n\n";
return false;
}
if(arr[2][y][j]==value)
{
cout << "In row Value Exists....\n\n";
return false;
}
if(arr[3][j][z]==value)
{
cout << "In column Value Exists....\n\n";
return false;
}
if(arr[6][j][z]==value)
{
cout << "In column Value Exists....\n\n";
return false;
}
}
}
else
{
if (x==3)
{
for (int j = 0 ; j < 3 ; j++)
{
if(arr[0][j][z]==value)
{
cout << "In column Value Exists....\n\n";
return false;
}
if(arr[4][y][j]==value)
{
cout << "In row Value Exists....\n\n";
return false;
}
if(arr[5][y][j]==value)
{
cout << "In row Value Exists....\n\n";
return false;
}
if(arr[6][j][z]==value)
{
cout << "In column Value Exists....\n\n";
return false;
}
}
}
else if (x==6)
{
for (int j = 0 ; j < 3 ; j++)
{
if(arr[0][j][z]==value)
{
cout << "In column Value Exists....\n\n";
return false;
}
if(arr[3][j][z]==value)
{
cout << "In column Value Exists....\n\n";
return false;
}
if(arr[7][y][j]==value)
{
cout << "In row Value Exists....\n\n";
return false;
}
if(arr[8][y][j]==value)
{
cout << "In row Value Exists....\n\n";
return false;
}
}
}
}
}
if( x == 1 || x == 4 || x == 7 )
{
if (x==1)
{
for (int j = 0 ; j < 3 ; j++)
{
if(arr[0][y][j]==value)
{
cout << "In row Value Exists....\n\n";
return false;
}
if(arr[2][y][j]==value)
{
cout << "In row Value Exists....\n\n";
return false;
}
if(arr[4][j][z]==value)
{
cout << "In column Value Exists....\n\n";
return false;
}
if(arr[7][j][z]==value)
{
cout << "In column Value Exists....\n\n";
return false;
}
}
}
else
{
if (x==4)
{
for (int j = 0 ; j < 3 ; j++)
{
if(arr[1][j][z]==value)
{
cout << "In column Value Exists....\n\n";
return false;
}
if(arr[3][y][j]==value)
{
cout << "In row Value Exists....\n\n";
return false;
}
if(arr[5][y][j]==value)
{
cout << "In row Value Exists....\n\n";
return false;
}
if(arr[7][j][z]==value)
{
cout << "In column Value Exists....\n\n";
return false;
}
}
}
else if (x==6)
{
for (int j = 0 ; j < 3 ; j++)
{
if(arr[1][j][z]==value)
{
cout << "In column Value Exists....\n\n";
return false;
}
if(arr[4][j][z]==value)
{
cout << "In column Value Exists....\n\n";
return false;
}
if(arr[6][y][j]==value)
{
cout << "In row Value Exists....\n\n";
return false;
}
if(arr[8][y][j]==value)
{
cout << "In row Value Exists....\n\n";
return false;
}
}
}
}
}
if( x == 2 || x == 5 || x == 8 )
{
if (x==2)
{
for (int j = 0 ; j < 3 ; j++)
{
if(arr[0][y][j]==value)
{
cout << "In row Value Exists....\n\n";
return false;
}
if(arr[1][y][j]==value)
{
cout << "In row Value Exists....\n\n";
return false;
}
if(arr[5][j][z]==value)
{
cout << "In column Value Exists....\n\n";
return false;
}
if(arr[8][j][z]==value)
{
cout << "In column Value Exists....\n\n";
return false;
}
}
}
else
{
if (x==5)
{
for (int j = 0 ; j < 3 ; j++)
{
if(arr[2][j][z]==value)
{
cout << "In column Value Exists....\n\n";
return false;
}
if(arr[3][y][j]==value)
{
cout << "In row Value Exists....\n\n";
return false;
}
if(arr[4][y][j]==value)
{
cout << "In row Value Exists....\n\n";
return false;
}
if(arr[8][j][z]==value)
{
cout << "In column Value Exists....\n\n";
return false;
}
}
}
else if (x==8)
{
for (int j = 0 ; j < 3 ; j++)
{
if(arr[2][j][z]==value)
{
cout << "In column Value Exists....\n\n";
return false;
}
if(arr[5][j][z]==value)
{
cout << "In column Value Exists....\n\n";
return false;
}
if(arr[6][y][j]==value)
{
cout << "In row Value Exists....\n\n";
return false;
}
if(arr[7][y][j]==value)
{
cout << "In row Value Exists....\n\n";
return false;
}
}
}
}
}
counter = counter + 1;
arr[x][y][z] = value;
return true;
}
void print()
{
int i = 0,chk=0;
cout <<endl<< "------------------------------" << endl;
//cout <<endl<< "---------- ---------- ----------" << endl;
while( i < 9 )
{
for(int j = 0 ; j<3 ; j++)
{
cout << "|";
for(int k = 0 ; k<3 ; k++)
{
if(arr[i][j][k] == 0)
cout << " ";
else
cout <<" "<< arr[i][j][k] ;
cout << "|";
}
//cout << " ";
cout << "|";
for(int k = 0 ; k<3 ; k++)
{
if(arr[i+1][j][k] == 0)
cout << " ";
else
cout <<" "<< arr[i+1][j][k];
cout << "|";
}
//cout << " ";
cout << "|";
for(int k = 0 ; k<3 ; k++)
{
if(arr[i+2][j][k] == 0)
cout << " ";
else
cout << " "<<arr[i+2][j][k] ;
cout << "|";
}
// cout <<endl<< "---------- ---------- ----------";
cout <<endl<< "------------------------------" << endl;
cout << endl;
}
i+=3;
if(i!=9)
{
// cout <<endl<< "---------- ---------- ----------"<<endl;
cout <<endl<< "------------------------------" << endl;
}
}
}
bool prepareBoard(int x, int y,int z,int value)
{
if(arr[x][y][z] != 0)
{
return false;
}
for (int i = 0 ; i < 3 ; i++)
{
for (int j = 0 ; j < 3 ; j++)
{
if(arr[x][i][j]==value)
{
return false;
}
}
}
// checks the value's existance in rows and columns
if( x == 0 || x == 3 || x == 6 )
{
if (x==0)
{
for (int j = 0 ; j < 3 ; j++)
{
if((arr[1][y][j]==value)||(arr[2][y][j]==value)||(arr[3][j][z]==value)||(arr[6][j][z]==value))
{
return false;
}
}
}
else
{
if (x==3)
{
for (int j = 0 ; j < 3 ; j++)
{
if ( (arr[0][j][z]==value)||(arr[4][y][j]==value)||(arr[5][y][j]==value)||(arr[6][j][z]==value))
{
return false;
}
}
}
else if (x==6)
{
for (int j = 0 ; j < 3 ; j++)
{
if((arr[0][j][z]==value)||(arr[3][j][z]==value)||(arr[7][y][j]==value)||(arr[8][y][j]==value))
{
return false;
}
}
}
}
}
if( x == 1 || x == 4 || x == 7 )
{
if (x==1)
{
for (int j = 0 ; j < 3 ; j++)
{
if( (arr[0][y][j]==value)||(arr[2][y][j]==value)||(arr[4][j][z]==value)||(arr[7][j][z]==value))
{
return false;
}
}
}
else
{
if (x==4)
{
for (int j = 0 ; j < 3 ; j++)
{
if( (arr[1][j][z]==value) || (arr[3][y][j]==value) ||(arr[5][y][j]==value)||(arr[7][j][z]==value))
{
return false;
}
}
}
else if (x==6)
{
for (int j = 0 ; j < 3 ; j++)
{
if((arr[1][j][z]==value)||(arr[4][j][z]==value)||(arr[6][y][j]==value)||(arr[8][y][j]==value))
{
return false;
}
}
}
}
}
if( x == 2 || x == 5 || x == 8 )
{
if (x==2)
{
for (int j = 0 ; j < 3 ; j++)
{
if((arr[0][y][j]==value)||(arr[1][y][j]==value)||(arr[5][j][z]==value)||(arr[8][j][z]==value))
{
return false;
}
}
}
else
{
if (x==5)
{
for (int j = 0 ; j < 3 ; j++)
{
if((arr[2][j][z]==value)||(arr[3][y][j]==value)||(arr[4][y][j]==value)||(arr[8][j][z]==value))
{
return false;
}
}
}
else if (x==8)
{
for (int j = 0 ; j < 3 ; j++)
{
if((arr[2][j][z]==value)||(arr[5][j][z]==value)||(arr[6][y][j]==value)||(arr[7][y][j]==value))
{
return false;
}
}
}
}
}
arr[x][y][z] = value;
return true;
}
void start(int level)// Initializing the board
{
for(int i = 0 ; i<9 ; i++)
for(int j = 0 ; j<3 ; j++)
for(int k = 0 ; k<3 ; k++)
arr[i][j][k] = 0;
srand(time(0));
counter=level;
while(counter>0)
{
if(prepareBoard(rand()%9,rand()%3,rand()%3,1+rand()%9))
counter=counter-1;
}
counter=level;
}
int main()
{
int undo_chk=false;
int x=0,y=0,z=0;
int val=0;
int choice=0;
int level=0;
while(1)
{
cout << "\nWhat do you want to do";
cout << "\n1) Play Game.";
cout << "\n2) Instructions";
cout << "\n3) Quit";
cout << "\n\nEnter Choice :: ";
cin >> choice;
switch (choice)
{
case 1:
system("cls");
while(level<1 || level > 3)
{
cout <<"\nChoose Level :: ";
cout << "\n1) Easy.";
cout << "\n2) Medium.";
cout << "\n3) Hard.";
cout << "\n\nEnter Choice >> ";
cin >> level;
switch(level)
{
case 1:
counter = 40;
break;
case 2:
counter = 27;
break;
case 3:
counter = 17;
break;
default:
cout << "\nInvalid choice.";
break;
}
}
start(counter);
while(counter!=81)
{
system("cls");
print();//prints whole board
cout << "\nWhat do you want to do";
cout << "\n1) Place Value.";
cout << "\n2) Undo Last Move.";
cout << "\n3) Quit.";
cout << "\n\nEnter Choice >> ";
cin >> choice;
switch(choice)
{
case 1:
cout << endl << "Enter Box : ";
cin >> x ;
cout << "Enter row : ";
cin >> y ;
cout << "Enter column : ";
cin >> z ;
cout << "Enter Value : ";
cin >> val;
undo_chk = validate(x,y,z,val);
break;
case 2:
if(undo_chk)
{
undo(x,y,z);
undo_chk=false;
}
else
{
cout<<"\nNo move to be undone";
}
break;
case 3:
exit(0);
break;
default:
cout << "\n\nYou have Entered an invalid choice";
break;
}
}
cout << "You won";
break;
case 2:
cout << "\t\t\t\t============\n";
cout << "\t\t\t\tINSTRUCTIONS\n";
cout << "\t\t\t\t============";
cout << "\n\n\n\t\tTo Play the game first select the Play game.\n\t\t A new menu will appear Select the level.";
cout << "\n\tA new Random board is generated having values according to\n\t\t\t the level selected.";
cout << "\n\tOnce the game is started you get the options of placing a \n\t\tvalue or undo last move and lastly exit game.";
cout << "\n\tWhile playing be careful when you place the values because you\n\t\t can only undo the latest move you made.\n";
break;
case 3:
exit(0);
break;
default:
cout << "\n\nYou have Entered an invalid choice";
break;
}
}
return 0;
}
//================================================
// written by Zain Aftab
//================================================
#include <iostream>
#include <cstdlib>
#include <time.h>
using namespace std;
int counter;
int arr[9][3][3];
void undo(int x,int y,int z)
{
arr[x][y][z] = 0;
}
bool validate(int x,int y,int z,int value)//checks the input
{
while(x>=9 || x<0)
{
cout << "Enter BOX (from 0 - 8): ";
cin >> x;
}
while(y>=3 || y<0)
{
cout << "Enter ROW (from 0 - 2) : ";
cin >> y;
}
while(z>=3 || z<0)
{
cout << "Enter COLUMN (from 0 - 2) : ";
cin >> z;
}
while(value <1 || value>9)
{
cout << "Enter value (from 1 - 9) : ";
cin >> value;
}
if(arr[x][y][z] != 0)
{
cout << "Place Not Empty....\n\n";
}
for (int i = 0 ; i < 3 ; i++)
{
for (int j = 0 ; j < 3 ; j++)
{
if(arr[x][i][j]==value)
{
cout << "In Box Value Exists.... \n\n";
return false;
}
}
}
// checks the value's existance in rows and columns
if( x == 0 || x == 3 || x == 6 )
{
if (x==0)
{
for (int j = 0 ; j < 3 ; j++)
{
if(arr[1][y][j]==value)
{
cout << "In row Value Exists....\n\n";
return false;
}
if(arr[2][y][j]==value)
{
cout << "In row Value Exists....\n\n";
return false;
}
if(arr[3][j][z]==value)
{
cout << "In column Value Exists....\n\n";
return false;
}
if(arr[6][j][z]==value)
{
cout << "In column Value Exists....\n\n";
return false;
}
}
}
else
{
if (x==3)
{
for (int j = 0 ; j < 3 ; j++)
{
if(arr[0][j][z]==value)
{
cout << "In column Value Exists....\n\n";
return false;
}
if(arr[4][y][j]==value)
{
cout << "In row Value Exists....\n\n";
return false;
}
if(arr[5][y][j]==value)
{
cout << "In row Value Exists....\n\n";
return false;
}
if(arr[6][j][z]==value)
{
cout << "In column Value Exists....\n\n";
return false;
}
}
}
else if (x==6)
{
for (int j = 0 ; j < 3 ; j++)
{
if(arr[0][j][z]==value)
{
cout << "In column Value Exists....\n\n";
return false;
}
if(arr[3][j][z]==value)
{
cout << "In column Value Exists....\n\n";
return false;
}
if(arr[7][y][j]==value)
{
cout << "In row Value Exists....\n\n";
return false;
}
if(arr[8][y][j]==value)
{
cout << "In row Value Exists....\n\n";
return false;
}
}
}
}
}
if( x == 1 || x == 4 || x == 7 )
{
if (x==1)
{
for (int j = 0 ; j < 3 ; j++)
{
if(arr[0][y][j]==value)
{
cout << "In row Value Exists....\n\n";
return false;
}
if(arr[2][y][j]==value)
{
cout << "In row Value Exists....\n\n";
return false;
}
if(arr[4][j][z]==value)
{
cout << "In column Value Exists....\n\n";
return false;
}
if(arr[7][j][z]==value)
{
cout << "In column Value Exists....\n\n";
return false;
}
}
}
else
{
if (x==4)
{
for (int j = 0 ; j < 3 ; j++)
{
if(arr[1][j][z]==value)
{
cout << "In column Value Exists....\n\n";
return false;
}
if(arr[3][y][j]==value)
{
cout << "In row Value Exists....\n\n";
return false;
}
if(arr[5][y][j]==value)
{
cout << "In row Value Exists....\n\n";
return false;
}
if(arr[7][j][z]==value)
{
cout << "In column Value Exists....\n\n";
return false;
}
}
}
else if (x==6)
{
for (int j = 0 ; j < 3 ; j++)
{
if(arr[1][j][z]==value)
{
cout << "In column Value Exists....\n\n";
return false;
}
if(arr[4][j][z]==value)
{
cout << "In column Value Exists....\n\n";
return false;
}
if(arr[6][y][j]==value)
{
cout << "In row Value Exists....\n\n";
return false;
}
if(arr[8][y][j]==value)
{
cout << "In row Value Exists....\n\n";
return false;
}
}
}
}
}
if( x == 2 || x == 5 || x == 8 )
{
if (x==2)
{
for (int j = 0 ; j < 3 ; j++)
{
if(arr[0][y][j]==value)
{
cout << "In row Value Exists....\n\n";
return false;
}
if(arr[1][y][j]==value)
{
cout << "In row Value Exists....\n\n";
return false;
}
if(arr[5][j][z]==value)
{
cout << "In column Value Exists....\n\n";
return false;
}
if(arr[8][j][z]==value)
{
cout << "In column Value Exists....\n\n";
return false;
}
}
}
else
{
if (x==5)
{
for (int j = 0 ; j < 3 ; j++)
{
if(arr[2][j][z]==value)
{
cout << "In column Value Exists....\n\n";
return false;
}
if(arr[3][y][j]==value)
{
cout << "In row Value Exists....\n\n";
return false;
}
if(arr[4][y][j]==value)
{
cout << "In row Value Exists....\n\n";
return false;
}
if(arr[8][j][z]==value)
{
cout << "In column Value Exists....\n\n";
return false;
}
}
}
else if (x==8)
{
for (int j = 0 ; j < 3 ; j++)
{
if(arr[2][j][z]==value)
{
cout << "In column Value Exists....\n\n";
return false;
}
if(arr[5][j][z]==value)
{
cout << "In column Value Exists....\n\n";
return false;
}
if(arr[6][y][j]==value)
{
cout << "In row Value Exists....\n\n";
return false;
}
if(arr[7][y][j]==value)
{
cout << "In row Value Exists....\n\n";
return false;
}
}
}
}
}
counter = counter + 1;
arr[x][y][z] = value;
return true;
}
void print()
{
int i = 0,chk=0;
cout <<endl<< "------------------------------" << endl;
//cout <<endl<< "---------- ---------- ----------" << endl;
while( i < 9 )
{
for(int j = 0 ; j<3 ; j++)
{
cout << "|";
for(int k = 0 ; k<3 ; k++)
{
if(arr[i][j][k] == 0)
cout << " ";
else
cout <<" "<< arr[i][j][k] ;
cout << "|";
}
//cout << " ";
cout << "|";
for(int k = 0 ; k<3 ; k++)
{
if(arr[i+1][j][k] == 0)
cout << " ";
else
cout <<" "<< arr[i+1][j][k];
cout << "|";
}
//cout << " ";
cout << "|";
for(int k = 0 ; k<3 ; k++)
{
if(arr[i+2][j][k] == 0)
cout << " ";
else
cout << " "<<arr[i+2][j][k] ;
cout << "|";
}
// cout <<endl<< "---------- ---------- ----------";
cout <<endl<< "------------------------------" << endl;
cout << endl;
}
i+=3;
if(i!=9)
{
// cout <<endl<< "---------- ---------- ----------"<<endl;
cout <<endl<< "------------------------------" << endl;
}
}
}
bool prepareBoard(int x, int y,int z,int value)
{
if(arr[x][y][z] != 0)
{
return false;
}
for (int i = 0 ; i < 3 ; i++)
{
for (int j = 0 ; j < 3 ; j++)
{
if(arr[x][i][j]==value)
{
return false;
}
}
}
// checks the value's existance in rows and columns
if( x == 0 || x == 3 || x == 6 )
{
if (x==0)
{
for (int j = 0 ; j < 3 ; j++)
{
if((arr[1][y][j]==value)||(arr[2][y][j]==value)||(arr[3][j][z]==value)||(arr[6][j][z]==value))
{
return false;
}
}
}
else
{
if (x==3)
{
for (int j = 0 ; j < 3 ; j++)
{
if ( (arr[0][j][z]==value)||(arr[4][y][j]==value)||(arr[5][y][j]==value)||(arr[6][j][z]==value))
{
return false;
}
}
}
else if (x==6)
{
for (int j = 0 ; j < 3 ; j++)
{
if((arr[0][j][z]==value)||(arr[3][j][z]==value)||(arr[7][y][j]==value)||(arr[8][y][j]==value))
{
return false;
}
}
}
}
}
if( x == 1 || x == 4 || x == 7 )
{
if (x==1)
{
for (int j = 0 ; j < 3 ; j++)
{
if( (arr[0][y][j]==value)||(arr[2][y][j]==value)||(arr[4][j][z]==value)||(arr[7][j][z]==value))
{
return false;
}
}
}
else
{
if (x==4)
{
for (int j = 0 ; j < 3 ; j++)
{
if( (arr[1][j][z]==value) || (arr[3][y][j]==value) ||(arr[5][y][j]==value)||(arr[7][j][z]==value))
{
return false;
}
}
}
else if (x==6)
{
for (int j = 0 ; j < 3 ; j++)
{
if((arr[1][j][z]==value)||(arr[4][j][z]==value)||(arr[6][y][j]==value)||(arr[8][y][j]==value))
{
return false;
}
}
}
}
}
if( x == 2 || x == 5 || x == 8 )
{
if (x==2)
{
for (int j = 0 ; j < 3 ; j++)
{
if((arr[0][y][j]==value)||(arr[1][y][j]==value)||(arr[5][j][z]==value)||(arr[8][j][z]==value))
{
return false;
}
}
}
else
{
if (x==5)
{
for (int j = 0 ; j < 3 ; j++)
{
if((arr[2][j][z]==value)||(arr[3][y][j]==value)||(arr[4][y][j]==value)||(arr[8][j][z]==value))
{
return false;
}
}
}
else if (x==8)
{
for (int j = 0 ; j < 3 ; j++)
{
if((arr[2][j][z]==value)||(arr[5][j][z]==value)||(arr[6][y][j]==value)||(arr[7][y][j]==value))
{
return false;
}
}
}
}
}
arr[x][y][z] = value;
return true;
}
void start(int level)// Initializing the board
{
for(int i = 0 ; i<9 ; i++)
for(int j = 0 ; j<3 ; j++)
for(int k = 0 ; k<3 ; k++)
arr[i][j][k] = 0;
srand(time(0));
counter=level;
while(counter>0)
{
if(prepareBoard(rand()%9,rand()%3,rand()%3,1+rand()%9))
counter=counter-1;
}
counter=level;
}
int main()
{
int undo_chk=false;
int x=0,y=0,z=0;
int val=0;
int choice=0;
int level=0;
while(1)
{
cout << "\nWhat do you want to do";
cout << "\n1) Play Game.";
cout << "\n2) Instructions";
cout << "\n3) Quit";
cout << "\n\nEnter Choice :: ";
cin >> choice;
switch (choice)
{
case 1:
system("cls");
while(level<1 || level > 3)
{
cout <<"\nChoose Level :: ";
cout << "\n1) Easy.";
cout << "\n2) Medium.";
cout << "\n3) Hard.";
cout << "\n\nEnter Choice >> ";
cin >> level;
switch(level)
{
case 1:
counter = 40;
break;
case 2:
counter = 27;
break;
case 3:
counter = 17;
break;
default:
cout << "\nInvalid choice.";
break;
}
}
start(counter);
while(counter!=81)
{
system("cls");
print();//prints whole board
cout << "\nWhat do you want to do";
cout << "\n1) Place Value.";
cout << "\n2) Undo Last Move.";
cout << "\n3) Quit.";
cout << "\n\nEnter Choice >> ";
cin >> choice;
switch(choice)
{
case 1:
cout << endl << "Enter Box : ";
cin >> x ;
cout << "Enter row : ";
cin >> y ;
cout << "Enter column : ";
cin >> z ;
cout << "Enter Value : ";
cin >> val;
undo_chk = validate(x,y,z,val);
break;
case 2:
if(undo_chk)
{
undo(x,y,z);
undo_chk=false;
}
else
{
cout<<"\nNo move to be undone";
}
break;
case 3:
exit(0);
break;
default:
cout << "\n\nYou have Entered an invalid choice";
break;
}
}
cout << "You won";
break;
case 2:
cout << "\t\t\t\t============\n";
cout << "\t\t\t\tINSTRUCTIONS\n";
cout << "\t\t\t\t============";
cout << "\n\n\n\t\tTo Play the game first select the Play game.\n\t\t A new menu will appear Select the level.";
cout << "\n\tA new Random board is generated having values according to\n\t\t\t the level selected.";
cout << "\n\tOnce the game is started you get the options of placing a \n\t\tvalue or undo last move and lastly exit game.";
cout << "\n\tWhile playing be careful when you place the values because you\n\t\t can only undo the latest move you made.\n";
break;
case 3:
exit(0);
break;
default:
cout << "\n\nYou have Entered an invalid choice";
break;
}
}
return 0;
}
Comments
Post a Comment