0% found this document useful (0 votes)
50 views

Sudoku v2.0

This document contains the code for a Sudoku game program called Sudoku v2.0. It includes classes for Players and Puzzles, along with functions for gameplay features like generating the board, allowing input, checking for valid moves, and calculating scores. When the program is run, it displays an opening screen and menu where the user can sign up as a new player, log in as an existing player, or play as a guest.

Uploaded by

Siddhartha
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
50 views

Sudoku v2.0

This document contains the code for a Sudoku game program called Sudoku v2.0. It includes classes for Players and Puzzles, along with functions for gameplay features like generating the board, allowing input, checking for valid moves, and calculating scores. When the program is run, it displays an opening screen and menu where the user can sign up as a new player, log in as an existing player, or play as a guest.

Uploaded by

Siddhartha
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 31

Sudoku v2.

0
/*
Sudoku v2.0
Computer Science Project
AISSCE 2016-17

*/

Made by :
Siddhartha,
The Mother's International School
#include<iostream.h>
#include<fstream.h>
#include<stdlib.h>
#include<string.h>
#include<stdio.h>
#include<conio.h>
#include<math.h>
#include<time.h>
#include<dos.h>
#define UNASSIGNED 0
#pragma
#pragma
#pragma
#pragma

warn
warn
warn
warn

-inl
-rvl
-aus
-use

class Player
{
private:
char name[8];
char pas[5];
double score;
public:
void getname()
{
gets(name);
}
void putname(char array[8])
{
strcpy(array, name);
}
void getscore(int a)
{
score=a;
}
int putscore()

{
return score;
}
void getpas()
{
gets(pas);
}
void putpas(char array[5])
{
strcpy(array, pas);
}
}A, B, C, D, E;
class Puzzle
{
private:
int
int
int
int

code;
row[81];
col[81];
no[81];

public:
Puzzle()
{
code=0;
for(int i=0; i<=80; i++)
{
row[i]=0;
col[i]=0;
no[i]=0;
}
}
void getcode()
{
cin>>code;
}
int putcode()
{
return code;
}
void getdata(int i, int a, int b, int c)
{
row[i]=a;
col[i]=b;
no[i]=c;
}
void putdata(int i, int array[9][9])
{
array[row[i]][col[i]]=no[i];
}
~Puzzle()

}a, b;

{}
int scorecalc(int a)
{
int score;
if(a<=300)
{
score=10000;
}
else if(a>=1500)
{
score=500;
}
else
{
}
}

score=(1500-a)*7+500;
return score;
int findzero(int array[9][9], int &row, int &col);
int issafe(int array[9][9], int row, int col, int number);
int checksol(int array[9][9])
{
int row, col;
if (!findzero(array, row, col))
return 1;
for (int number = 1; number <= 9; number++)
{
if (issafe(array, row, col, number))
{
array[row][col] = number;
if (checksol(array))
return 1;
}
}

array[row][col] = UNASSIGNED;
}
return 0;
int findzero(int array[9][9], int &row, int &col)
{
for (row = 0; row <=8; row++)
for (col = 0; col <=8; col++)
if (array[row][col] == UNASSIGNED)
return 1;
return 0;
}

int foundrow(int array[9][9], int row, int number)


{
for (int col = 0; col <=8; col++)
if (array[row][col] == number)
return 1;
return 0;
}
int foundcol(int array[9][9], int col, int number)
{
for (int row = 0; row <=8; row++)
if (array[row][col] == number)
return 1;
return 0;
}
int foundbox(int array[9][9], int boxrow, int boxcol, int number)
{
for (int row = 0; row < 3; row++)
for (int col = 0; col < 3; col++)
if (array[row+boxrow][col+boxcol] == number)
return 1;
return 0;
}
int issafe(int array[9][9], int row, int col, int number);int issafe(int
array[9][9], int row, int col, int number)
{
return !foundrow(array, row, number) && !foundcol(array, col, number) &&
!foundbox(array, row - row%3 , col - col%3, number);
}
void rectangle(int col, int row, int length, int colour)
{
textcolor(colour);//Color of box
for(int i=col; i<=col+length; i++)
{
if(i==col)
{
gotoxy(i, row);
cprintf("%c", 201);
gotoxy(i, row+1);
cprintf("%c", 186);

gotoxy(i, row+2);
cprintf("%c", 200);
else if(i==col+length)
{
gotoxy(i, row);
cprintf("%c", 187);
gotoxy(i, row+1);
cprintf("%c", 186);
gotoxy(i, row+2);
cprintf("%c", 188);

}
else
{

gotoxy(i, row);
cprintf("%c", 205);
gotoxy(i, row+2);
cprintf("%c", 205);

void boxes(int n)
{
int row, col;
textcolor(n);
for(col=18; col<=63; col++)
{
for(row=5; row<=23; row+=2)
{
gotoxy(col, row);
switch(row)
{
case 5:
case 11:
case 17:
case 23:
cprintf("%c", 205);
break;
default:

cprintf("%c", 196);

for(row=5; row<=23; row++)


{
for(col=18; col<=63; col+=5)
{
gotoxy(col, row);
switch(col)
{
case 18:
case 33:
case 48:
case 63:
cprintf("%c", 186);
break;
default:
cprintf("%c", 179);

}
}
for(row=7; row<=21; row+=2)
{
for(col=23; col<=58; col+=5)
{
gotoxy(col, row);
cprintf("%c", 197);
}
}
for(row=5; row<=23; row+=2)
{
for(col=33; col<=48; col+=15)
{
gotoxy(col, row);
cprintf("%c", 215);
}
}
for(col=18; col<=63; col+=5)
{
for(row=11; row<=17; row+=6)
{
gotoxy(col, row);
cprintf("%c", 216);
}
}
for(col=23; col<=58; col+=5)
{
switch(col)
{
case 33:
case 48:
gotoxy(col, 5);
cprintf("%c", 203);
gotoxy(col, 23);
cprintf("%c", 202);
break;
default:
gotoxy(col, 5);
cprintf("%c", 209);

gotoxy(col, 23);
cprintf("%c", 207);

for(row=7; row<=21; row+=2)


{
switch(row)
{
case 11:

case 17:
gotoxy(18, row);
cprintf("%c", 204);
gotoxy(63, row);
cprintf("%c", 185);
break;
default:
gotoxy(18, row);
cprintf("%c", 199);
gotoxy(63, row);
cprintf("%c", 182);
}

}
gotoxy(33, 11);
cprintf("%c", 206);
gotoxy(33, 17);
cprintf("%c", 206);
gotoxy(48, 11);
cprintf("%c", 206);
gotoxy(48, 17);
cprintf("%c", 206);
gotoxy(18, 5);
cprintf("%c", 201);
gotoxy(63, 5);
cprintf("%c", 187);
gotoxy(18, 23);
cprintf("%c", 200);

gotoxy(63, 23);
cprintf("%c", 188);
int getkey()
{
int ch;
ch=getch();
if(ch==0)
{
ch=getch();
}

return ch;

return ch;
}

void getarray(int array[9][9], int n)


{
clrscr();
for(int i=0; i<=8; i++)
{
for(int j=0; j<=8; j++)
{
array[i][j]=0;
}
}
boxes(n);
int x=20, y=6;
gotoxy(x, y);
Starta:
int a;
gotoxy(x, y);
a=getkey();
textcolor(2);
boxes(n);
if(a==72)
{
boxes(n);
if(y==6)
y=22;
else
y-=2;
}

goto Starta;
else if(a==75)
{
boxes(n);
if(x==20)
x=60;
else

x-=5;
goto Starta;
else if(a==80)
{
boxes(n);
if(y==22)
y=6;

else
y+=2;
}

goto Starta;
else if(a==77)
{
boxes(n);
if(x==60)
x=20;
else

x+=5;
goto Starta;
else if(a>=49 && a<=58)
{
boxes(n);
gotoxy(x, y);
array[(y-6)/2][(x-20)/5]=a-48;
textcolor(14);
cout<<a-48;
goto Starta;
}
else if(a==8)
{
boxes(n);
gotoxy(x, y);
array[(y-6)/2][(x-20)/5]=0;
cout<<" ";
}

goto Starta;
else if(a==13)
{
goto Continue;
}
else

goto Starta;
Continue:
void putarray(int array[9][9], int t=0)
{
for(int i=0; i<=8; i++)
{

for(int j=0; j<=8; j++)


{
gotoxy(20+j*5, 6+i*2);
textcolor(15);
if(array[i][j]==0)
cout<<" ";
else
cout<<array[i][j];

delay(t);

void main()
{
clrscr();
randomize();
char name1[8];
char name2[8];
int selected_play;
int score2;
Start:
int color[4]={4, 2, 6, 14};
int color_option=3, color_box=6;
char colorname[7][12]={
"Green", "Red", "Brown", "Light_Green", "Light_Red",
"Yellow", "White"
};
int colorcode[7]={ 2, 4, 6, 10, 12, 14, 15 };

"Sudoku".

for(int i=0; i<=2; i++)


{
textcolor(color[i]);//This function changes the color of
gotoxy(11,5);
cprintf(" SSSSSS

UU

UU

DDDDDDD

OOOOOO

KK

UU

UU

DDDDDDDD

OOOOOOOO

KK

UU

UU

DD

OO

KK

KK

UU

UU");
delay(50);

UU");

gotoxy(11, 6);
cprintf("SSSSSSSS

KK

UU

delay(50);

UU");

gotoxy(11, 7);
cprintf("SS
delay(50);

DD

OO

KK

UU

gotoxy(11, 8);
cprintf("SS
UU");

UU

UU

DD

DD

OO

OO

KK KK

UU

UU

UU

DD

DD

OO

OO

KKKK

UU

UU

UU

DD

DD

OO

OO

KKKK

UU

UU

UU

DD

DD

OO

OO

KK KK

UU

UU

UU

DD

DD

OO

OO

KK

UU

delay(50);
gotoxy(11, 9);
cprintf("SSSSSSS
UU");
delay(50);
gotoxy(11, 10);
cprintf(" SSSSSSS
UU");
delay(50);
gotoxy(11, 11);
cprintf("
SS
UU");
delay(50);
gotoxy(11, 12);
cprintf("
SS
UU");

KK

delay(50);

UUUUUUUU");

gotoxy(11, 13);
cprintf("SSSSSSSS

UUUUUUUU

DDDDDDDD

OOOOOOOO

KK

UUUUUU

DDDDDDD

OOOOOO

KK

KK

delay(50);
gotoxy(11, 14);
cprintf(" SSSSSS
UUUUUU ");
}

delay(50);
delay(1000);
textcolor(2);
gotoxy(28, 20);
cprintf("Press");
textcolor(2+BLINK);
gotoxy(34, 20);
cprintf("ENTER");
textcolor(2);
gotoxy(40, 20);
cprintf("to Continue");

KK

textcolor(4);
gotoxy(28, 21);
cprintf("Press");
textcolor(4+BLINK);
gotoxy(34, 21);
cprintf("ESC");
textcolor(4);
gotoxy(38, 21);
cprintf("to Exit");
Input:
{
int input;
input=getkey();
switch(input)
{
case 13:
clrscr();
gotoxy(35, 12);
textcolor(6);
cprintf("Loading");
textcolor(2);
for(int fg=0; fg<=100; fg++)
{
gotoxy(55, 8);
cprintf("%d", fg);
if(fg<12)
delay(100);
else if(fg==12)
delay(2000);
else if(fg<32)
delay(50);
else if(fg==32)
delay(2000);
else if(fg<=50)
delay(90);
else if(fg<96)
delay(35);
else if(fg==96)
delay(1500);
else

delay(25);
}
clrscr();
textcolor(3);
gotoxy(30, 11);
cprintf("%c", 62);
textcolor(2);
gotoxy(36, 11);
cprintf("Sign up!");
rectangle(32, 10, 16, 2);
textcolor(2);
gotoxy(37, 15);
cprintf("Login!");
rectangle(32, 14, 16, 4);
textcolor(2);
gotoxy(34, 19);
cprintf("Play as guest");
rectangle(32, 18, 16, 4);
int option, selected, col=32, row=10;
Option_Play:
{
option=getkey();
textcolor(14);
switch(option)
{
case 72:
textcolor(4);
gotoxy(col-2, row+1);
cprintf(" ");
rectangle(col, row, 16, 4);
if(row==10)
row=18;
else
row-=4;
textcolor(3);
gotoxy(col-2, row+1);
cprintf("%c", 62);
rectangle(col, row, 16, 2);

goto Option_Play;
case 80:
textcolor(14);
gotoxy(col-2, row+1);
cprintf(" ");
rectangle(col, row, 16, 4);
if(row==18)
row=10;
else
row+=4;
textcolor(3);
gotoxy(col-2, row+1);
cprintf("%c", 62);
rectangle(col, row, 16, 2);
goto Option_Play;
case 13:
selected_play=(row-6)/4;
}
clrscr();

ios::binary);

if(selected_play==1)
{
ofstream f1;
f1.open("Player.dat", ios::out | ios::app |
textcolor(6);

5 character password");

gotoxy(5, 2);
cprintf("Please enter a 8 character name and
textcolor(2);
gotoxy(20, 11);
cprintf("Name: ");
rectangle(41, 10, 19, 6);
textcolor(2);
gotoxy(20, 15);
cprintf("Password: ");
rectangle(41, 14, 19, 6);
textcolor(2);

textcolor(14);
gotoxy(38, 20);
cprintf("Enter!");
textcolor(15);
gotoxy(42, 11);
A.getname();
gotoxy(42, 15);
A.getpas();
f1.write((char*) &A, sizeof(A));
rectangle(36, 19, 9, 6);
delay(2000);
clrscr();
gotoxy(5, 5);
textcolor(4);
cprintf("The Game must Restart to incorporate
the Changes");
delay(5000);
clrscr();
f1.close();
goto Start;
}

ios::binary);

else if(selected_play==2)
{
ifstream f2;
f2.open("Player.dat", ios:: in |
textcolor(6);
char in_name[8], in_name2[8];
char in_pas[5], in_pas2[5];

details");

gotoxy(5, 2);
cprintf("Please enter the following
textcolor(2);
gotoxy(20, 7);
cprintf("Name: ");
rectangle(41, 6, 19, 6);
textcolor(2);
gotoxy(20, 11);
cprintf("Password: ");

rectangle(41, 10, 19, 6);


textcolor(2);
gotoxy(38, 20);
cprintf("Enter!");
gotoxy(42, 7);
textcolor(2);
gets(in_name);
gotoxy(42, 11);
textcolor(2);
gets(in_pas);
int report=0;
while(!f2.eof())
{
f2.read((char*) &B, sizeof(B));
B.putname(in_name2);
if(strcmp(in_name2, in_name)==0)
{

B.putpas(in_pas2);
if(strcmp(in_pas, in_pas2))
{
report=1;
break;
}
}
if(report==1)
{
rectangle(36, 19, 9, 6);
delay(2000);
f2.close();
strcpy(name1, in_name);
goto Screen1;
}
else
{
clrscr();
textcolor(4);
gotoxy(35, 12);
cprintf("Error");
textcolor(132);
gotoxy(45, 12);
cprintf("x");
delay(2000);
clrscr();
f2.close();

goto Start;
}
}
else
{
textcolor(4);
gotoxy(20, 7);
cout<<"Warning:";

gotoxy(20, 8);
cout<<"Your progress won't be saved at all";
}
getch();
textcolor(3);
clrscr();
gotoxy(35, 12);
cprintf("Let's Begin %s", name1);
delay(2000);
clrscr();
goto Screen1;
case 27:
clrscr();
textcolor(4);
gotoxy(35, 12);
cprintf("Exiting");
textcolor(132);
gotoxy(45, 12);
cprintf("x");
delay(5000);
exit(0);
default:
clrscr();
textcolor(4);
gotoxy(35, 12);
cprintf("Error");

textcolor(132);
gotoxy(45, 12);
cprintf("x");
delay(2000);
clrscr();
}

goto Start;
}
Screen1:
{
//Different options as the game begins.
clrscr();
textcolor(2);
gotoxy(55, 10);
cprintf("Play");
textcolor(2);
gotoxy(55, 12);
cprintf("Create Puzzle");
textcolor(2+BLINK);
gotoxy(55, 14);
cprintf("Sudoku Solver");
textcolor(2);
gotoxy(55, 16);
cprintf("Your recent score");
textcolor(4);
gotoxy(55, 18);
cprintf("Options");
textcolor(6);
gotoxy(55, 20);
cprintf("Instructions");
textcolor(6);
gotoxy(55, 22);
cprintf("About");
textcolor(4);
gotoxy(55, 24);
cprintf("Exit");
textcolor(14);

gotoxy(53, 10);
cprintf("%c", 62);
int y=2;
for(int g=0; g<=3; g++)
{
textcolor(color[g]);
gotoxy(10, y++);
cprintf("SSSS U

DDD

gotoxy(10, y++);
cprintf("S
U

gotoxy(10, y++);
cprintf("SSSS U

gotoxy(10, y++);
cprintf("
S U

gotoxy(10, y++);
cprintf("SSSS UUUU
}

OO

DDD

U");

K K

U");

KK

U");

K K

U");

OO

y++;
int option, selected, col=53, row=10;
Option:
{
option=getkey();
textcolor(14);
switch(option)
{
case 72:
gotoxy(col, row);
cprintf(" ");
if(row==10)
row=24;
else
row-=2;
gotoxy(col, row);
cprintf("\a%c", 62);
goto Option;
case 80:
gotoxy(col, row);
cprintf(" ");
if(row==24)
row=10;
else

UUUU");

row+=2;
gotoxy(col, row);
cprintf("\a%c", 62);
goto Option;
case 13:
selected=(row-8)/2;
goto Selected;
default:
}

goto Option;
Selected:
switch(selected)
{
case 1:
{
clrscr();
int recordcount=0;
int game[9][9], game2[9][9];
ifstream f3;
f3.open("PUZZLE.dat", ios::in | ios:: binary);
while(!f3.eof())
{
f3.read((char*)&a, sizeof(a));
recordcount ++;
}
f3.seekg(0, ios::beg);
int record=rand() % recordcount;
while(!f3.eof())
{
f3.read((char *)&a, sizeof(a));
record--;

if(record==0)
break;
int k=0;
for(int i=0; i<=8; i++)
{
for(int j=0; j<=8; j++)
{
a.putdata(k, game);
k++;
}
}

boxes(2);
putarray(game);
for(i=0; i<=8; i++)
{
for(int j=0; j<=8; j++)
{
game2[i][j]=game[i][j];
}
}
checksol(game2);
const clock_t begin_time = clock();
boxes(4);
int x=20, y=6;
gotoxy(x, y);
Start2:
int a;
a=getkey();
textcolor(2);
boxes(color_box);
if(a==72)
{
boxes(4);
if(y==6)
{
y=22;
if(x==20)
x=60;
else

}
else
{

x-=5;
goto Skip72;

y-=2;
Skip72:
{
while(game[(y-6)/2][(x-20)/5]!=0)
{
if(y==6)
{
y=22;
if(x==20)
x=60;

else

}
else

x-=5;
goto Skip72;
y-=2;

gotoxy(x, y);
cout<<" ";
}

goto Start2;
else if(a==75)
{
boxes(color_box);
if(x==20)
{
x=60;
if(y==6)
y=22;
else
y-=2;
goto Skip75;
}
else
{
x-=5;
Skip75:
{
while(game[(y-6)/2][(x-20)/5]!=0)
{
if(x==20)
{
x=60;
if(y==6)
y=22;
else

}
else

gotoxy(x, y);

y-=2;
goto Skip75;
x-=5;

cout<<" ";
}

goto Start2;
else if(a==80)
{
boxes(4);
if(y==22)
{
y=6;
if(x==60)
x=20;
else
x+=5;
}
else
{

goto Skip80;

y+=2;
Skip80:
{
while(game[(y-6)/2][(x-20)/5]!=0)
{
if(y==22)
{
y=6;
if(x==60)
x=20;
else

}
else
}

}
}
gotoxy(x, y);
cout<<" ";
}

goto Start2;
else if(a==77)
{
boxes(color_box);
if(x==60)
{
x=20;

x+=5;
goto Skip80;
y+=2;

if(y==22)
y=6;
else

}
else
{

y+=2;
goto Skip77;

x+=5;
Skip77:
{
while(game[(y-6)/2][(x-20)/5]!=0)
{
if(x==60)
{
x=20;
if(y==22)
y=6;
else

}
else

y+=2;
goto Skip77;
x+=5;
}

gotoxy(x, y);
cout<<" ";
}

goto Start2;
else if(a>=49 && a<=58)
{
game[(y-6)/2][(x-20)/5]=a-48;
gotoxy(x,y);
cout<<game[(y-6)/2][(x-20)/5];
}

goto Start2;
else if(a==8)
{
game[(y-6)/2][(x-20)/5]=0;

cout<<" ";
goto Start2;
else if(a==13)

{
goto Start2;
}
else
{
}

goto End;
End:
getch();

CLOCKS_PER_SEC;

int correct=1;
int timediff= float( clock () - begin_time ) /
for(i=0; i<=8; i++)
{
for(int j=0; j<=8; j++)
{
if(game[i][j]-game2[i][j]!=0)
{
correct=0;
break;
}
}
}
if(correct==1)
{
textcolor(2);
gotoxy(5, 5);
cout<<"Time taken by you is "<<timediff;
textcolor(2);
gotoxy(5, 7);
cout<<"Your score is "<<scorecalc(timediff);
if(selected_play==3)
{
//Do nothing;
}
else
{
| ios::binary);

fstream f5;
f5.open("PLAYER.dat", ios::in | ios::out
while(!f5.eof())
{
f5.read((char*)&D, sizeof(D));
D.putname(name2);
if(strcmp(name1, name2)==0)
{
D.getscore(scorecalc(timediff));
}

score2=scorecalc(timediff);
}
f5.close();

}
getch();
}
else
{

textcolor(4);
gotoxy(7, 7);
cout<<"Sorry better luck next time.";
clrscr();
goto Screen1;
}

ios::binary);

case 2:
{
ofstream f4;
f4.open("PUZZLE.dat", ios::out | ios::app |
int array[9][9];
char name[10];
for(int i=0; i<=8; i++)
{
for(int j=0; j<=8; j++)
{
array[j][i]=0;
}
}
getarray(array, color_box);
int k=0;
for(i=0; i<=8; i++)
{
for(int j=0; j<=8; j++)
{
b.getdata(k, i, j, array[j][i]);
k++;
}
}

f4.write((char *) &b, sizeof(b));


f4.close();
case 3:
{
clrscr();

spots.");

int array[9][9];
gotoxy(5, 5);
textcolor(14);
cprintf("Please Enter a Sudoku in the allocated
gotoxy(5, 7);
textcolor(14);

cprintf("Don't Enter 0 for blank space. just leave


it blank.");
delay(1000);
gotoxy(7, 10);
textcolor(2+BLINK);
cprintf("Press any key to continue");
getch();
clrscr();
boxes(color_box);
getarray(array, color_box);
clrscr();
gotoxy(33, 13);
cout<<"Generating solution";
delay(5000);
if (checksol(array) == 1)
{
boxes(4);
putarray(array, 150);
}
else
{
clrscr();

gotoxy(33, 13);
cout<<"No solution exists";
getch();
goto Screen1;
case 4:
clrscr();
textcolor(14);
gotoxy(5, 5);
ifstream f6;
f6.open("PLAYER.dat", ios::in | ios::binary);
while(!f6.eof())
{
f6.read((char*)&E, sizeof(E));
E.putname(name2);
if(strcmp(name1,name2)==0)
{
break;
}
}
f6.close();

"<<E.putscore();

cout<<"Your Latest score out of 10000 is


delay(5000);
clrscr();
goto Screen1;
case 5:
Settings:
clrscr();
textcolor(2);
gotoxy(2, 8);
cprintf("Settings");
textcolor(14);

arrow keys.");

gotoxy(4, 10);
cprintf("Scroll amongst colors using

up and down

gotoxy(4, 11);
cprintf("Press Enter to choose.");
gotoxy(4, 12);
cprintf("Press Esc to go back.");
gotoxy(4, 13);
cprintf("Press Right arrow key to see how the
Sudoku box would look like");
textcolor(6);
gotoxy(4, 15);
cprintf("Color of Sudoku box: Brown");
Color_input:
int color_input;
color_input=getkey();
switch(color_input)
{
case 72:
if(color_option==0)
color_option=6;
else
color_option--;
textcolor(colorcode[color_option]);
for(int j=25; j<=36; j++)
{
gotoxy(j, 15);

cprintf("%c",
colorname[color_option][j-25]);
}
goto Color_input;
case 80:
if(color_option==6)
color_option=0;
else
color_option++;
textcolor(colorcode[color_option]);

colorname[color_option][j-25]);

for(j=25; j<=36; j++)


{
gotoxy(j, 15);
cprintf("%c",
}
goto Color_input;
case 13:
clrscr();
gotoxy(5, 5);
color_box=colorcode[color_option];
textcolor(4);
incorporate the Changes");

cprintf("The Game must Restart to


delay(5000);
clrscr();
goto Screen1;
case 27:
clrscr();
goto Screen1;
case 77:
clrscr();
boxes(4);
delay(5000);
clrscr();
goto Settings;

default:
}

goto Color_input;
case 6:
clrscr();
textcolor(2);
gotoxy(2, 9);
cprintf("Instructions");
textcolor(6);

digits 1-9 only once.");

gotoxy(2, 12);
cprintf("1. Each Row and coloumn must have the
textcolor(6);
gotoxy(2, 14);
cprintf("2. Each block (marked by double lines)
must contain digits 1-9 only once.");
delay(5000);
clrscr();
goto Screen1;
case 7:
clrscr();
for(i=23; i>=5; i--)
{
clrscr();
textcolor(4);
gotoxy(2, 3);
cprintf("Press Esc once to return to main
menu");
textcolor(2);
gotoxy(32, i);
cprintf("SUDOKU v2.0.0(a)");
textcolor(6);
gotoxy(31, i+2);
cprintf("Made by Siddhartha");
}

delay(250);
delay(50);

Response:
int response=getkey();
switch(response)
{
case 27:
clrscr();
goto Screen1;
default:
}

goto Response;
case 8:
clrscr();
textcolor(4);
gotoxy(35, 12);
cprintf("Exiting");
textcolor(132);
gotoxy(45, 12);
cprintf("x");
delay(5000);
exit(0);

}
}

}
getch();

default:
;

You might also like