در این بازی از پروتوتایپهای stdio.h , stdlib.h , conio.h و string.h استفاده شده است

    #include<stdio.h>
#include<conio.h>
#include<stdlib.h>
#include<string.h>
void cadr1(void);
void cadr2(void);
int selector(int);
int show(int);
int wordproc(void);
void main(void)
{
int a,b,y;
clrscr();
cadr1();
while(a!='n')
{
cadr2();
b=selector(y);
show(b);
wordproc();
a=getch();
while(a!='n' && a!='y')
a=getch();
}
}
void cadr1()
{
int a,c=205,i;
textcolor(12);
printf("\n\n\n\n\n");
printf(" ");
c=201;
cprintf("%c",c);
c=205;
for(i=1;i<=58;i++)
cprintf("%c",c);
c=187;
cprintf("%c",c);
c=186;
printf("\n");
cprintf(" %c %c\r\n",c,c);
cprintf(" %c %c\r\n",c,c);
cprintf(" %c *** WORD GUESS *** %c\r\n",c,c);
cprintf(" %c Version : 1.00 %c\r\n",c,c);
cprintf(" %c Created By : mina.t %c\r\n",c,c);
cprintf(" %c Course : Computer Science (Software) %c\r\n",c,c);
cprintf(" %c %c\r\n",c,c);
cprintf(" %c %c\r\n",c,c);
printf(" ");
c=204;
cprintf("%c",c);
c=205;
for(i=1;i<=58;i++)
cprintf("%c",c);
c=185;
cprintf("%c",c);
printf("\n");
c=186;
cprintf(" %c %c\r\n",c,c);
cprintf(" %c Press any key to continue %c\r\n",c,c);
cprintf(" %c %c\r\n",c,c);
printf(" ");
c=200;
cprintf("%c",c);
c=205;
for(i=1;i<=58;i++)
cprintf("%c",c);
c=188;
cprintf("%c",c);
printf("\n\n\n\n\n\n");
a=getch();
if(a==27)
exit(1);
}
void cadr2()
{
int c,i;
clrscr();
textcolor(12);
printf("\n\n\n");
printf(" ");
c=201;
cprintf("%c",c);
c=205;
for(i=1;i<=57;i++)
cprintf("%c",c);
c=187;
cprintf("%c",c);
c=186;
printf("\n");
cprintf(" %c %c\r\n",c,c);
cprintf(" %c Which of the following topics refers to your word? %c\r\n",c,c);
cprintf(" %c %c\r\n",c,c);
printf(" ");
c=204;
cprintf("%c",c);
c=205;
for(i=1;i<=57;i++)
cprintf("%c",c);
c=185;
cprintf("%c",c);
c=186;
printf("\n");
cprintf(" %c %c\r\n",c,c);
cprintf(" %c %c\r\n",c,c);
cprintf(" %c %c\r\n",c,c);
cprintf(" %c %c\r\n",c,c);
cprintf(" %c %c\r\n",c,c);
cprintf(" %c %c\r\n",c,c);
cprintf(" %c %c\r\n",c,c);
cprintf(" %c %c\r\n",c,c);
cprintf(" %c %c\r\n",c,c);
cprintf(" %c %c\r\n",c,c);
cprintf(" %c %c\r\n",c,c);
cprintf(" %c %c\r\n",c,c);
cprintf(" %c %c\r\n",c,c);
printf(" ");
c=200;
cprintf("%c",c);
c=205;
for(i=1;i<=57;i++)
cprintf("%c",c);
c=188;
cprintf("%c",c);
textcolor(15);
gotoxy(32,10);
textbackground(12);
cprintf(" Space \n");
gotoxy(32,12);
textbackground(0);
cprintf(" Nature \n");
gotoxy(32,14);
textbackground(0);
cprintf(" Animals \n");
gotoxy(32,16);
textbackground(0);
cprintf(" Objects \n");
gotoxy(32,18);
textbackground(0);
cprintf(" Transport Means \n");
gotoxy(32,20);
textbackground(0);
cprintf(" Other \n");
gotoxy(65,6);
}
int selector(int y)
{
int q,z=0,x=0,c=0,v=0,b=0,n=0;
y=1;
while(q!=13)
{
q=getch();
switch(q)
{
case 80:
{
y++;
if(y==7)
y=1;
if(y==0)
y=6;
if(y==1)
{z=12;x=0;c=0;v=0;b=0;n=0;}
if(y==2)
{z=0;x=12;c=0;v=0;b=0;n=0;}
if(y==3)
{z=0;x=0;c=12;v=0;b=0;n=0;}
if(y==4)
{z=0;x=0;c=0;v=12;b=0;n=0;}
if(y==5)
{z=0;x=0;c=0;v=0;b=12;n=0;}
if(y==6)
{z=0;x=0;c=0;v=0;b=0;n=12;}
textcolor(15);
gotoxy(32,10);
textbackground(z);
cprintf(" Space \n");
gotoxy(32,12);
textbackground(x);
cprintf(" Nature \n");
gotoxy(32,14);
textbackground(c);
cprintf(" Animals \n");
gotoxy(32,16);
textbackground(v);
cprintf(" Objects \n");
gotoxy(32,18);
textbackground(b);
cprintf(" Transport Means \n");
gotoxy(32,20);
textbackground(n);
cprintf(" Other \n");
break;
}
case 72:
{
y--;
if(y==7)
y=1;
if(y==0)
y=6;
if(y==1)
{z=12;x=0;c=0;v=0;b=0;n=0;}
if(y==2)
{z=0;x=12;c=0;v=0;b=0;n=0;}
if(y==3)
{z=0;x=0;c=12;v=0;b=0;n=0;}
if(y==4)
{z=0;x=0;c=0;v=12;b=0;n=0;}
if(y==5)
{z=0;x=0;c=0;v=0;b=12;n=0;}
if(y==6)
{z=0;x=0;c=0;v=0;b=0;n=12;}
textcolor(15);
gotoxy(32,10);
textbackground(z);
cprintf(" Space \n");
gotoxy(32,12);
textbackground(x);
cprintf(" Nature \n");
gotoxy(32,14);
textbackground(c);
cprintf(" Animals \n");
gotoxy(32,16);
textbackground(v);
cprintf(" Objects \n");
gotoxy(32,18);
textbackground(b);
cprintf(" Transport Means \n");
gotoxy(32,20);
textbackground(n);
cprintf(" Other \n");
break;

}
case 27:
{
exit(1);
}
}
gotoxy(65,6);
}
return y;
}
int show(int b)
{
int c,i;
clrscr();
gotoxy(1,3);
textcolor(12);
printf(" ");
c=201;
cprintf("%c",c);
c=205;
for(i=1;i<=27;i++)
cprintf("%c",c);
c=187;
cprintf("%c",c);
c=186;
printf("\n");
cprintf(" %c %c\r\n",c,c);
cprintf(" %c %c\r\n",c,c);
cprintf(" %c %c\r\n",c,c);
printf(" ");
c=204;
cprintf("%c",c);
c=205;
for(i=1;i<=27;i++)
cprintf("%c",c);
c=185;
cprintf("%c",c);
c=186;
printf("\n");
cprintf(" %c %c\r\n",c,c);
cprintf(" %c Enter your word below %c\r\n",c,c);
cprintf(" %c %c\r\n",c,c);
printf(" ");
c=204;
cprintf("%c",c);
c=205;
for(i=1;i<=27;i++)
cprintf("%c",c);
c=185;
cprintf("%c",c);
if(b==1)
{
gotoxy(34,5);
printf("*** Space ***");
}
if(b==2)
{
gotoxy(34,5);
printf("*** Nature ***");
}
if(b==3)
{
gotoxy(33,5);
printf("*** Animals ***");
}
if(b==4)
{
gotoxy(33,5);
printf("*** Objects ***");
}
if(b==5)
{
gotoxy(29,5);
printf("*** Transport Means ***");
}
if(b==6)
{
gotoxy(34,5);
printf("*** Other ***");
}
return 0;
}
int wordproc()
{
int c=186,k,i,j,l,p1,p2,p3,sw,count;
char ch,s[30],t[30],letter;
for(i=0;i<30;i++)
t[i]='\0';
while(1)
{
for(i=0;i<30;i++)
s[i]='\0';
gotoxy(1,12);
cprintf(" %c %c\r\n",c,c);
cprintf(" %c %c\r\n",c,c);
cprintf(" %c %c\r\n",c,c);
printf(" ");
c=204;
cprintf("%c",c);
c=205;
for(k=1;k<=27;k++)
cprintf("%c",c);
c=185;
cprintf("%c",c);
c=186;
printf("\n");
cprintf(" %c %c\r\n",c,c);
cprintf(" %c Guess word(10): %c\r\n",c,c);
cprintf(" %c %c\r\n",c,c);
printf(" ");
c=204;
cprintf("%c",c);
c=205;
for(k=1;k<=27;k++)
cprintf("%c",c);
c=185;
cprintf("%c",c);
c=186;
printf("\n");
cprintf(" %c %c\r\n",c,c);
cprintf(" %c %c\r\n",c,c);
cprintf(" %c %c\r\n",c,c);
printf(" ");
c=200;
cprintf("%c",c);
c=205;
for(k=1;k<=27;k++)
cprintf("%c",c);
c=188;
cprintf("%c",c);
c=186;
printf("\n");
gotoxy(30,13);
i=0;
while(1)
{
ch=getch();
if(ch<97 || ch>122)
break;
if(ch==13)
break;
printf("*");
s[i]=ch;
i++;
}
if(s[0]!='\0' && ch==13)
break;
}
strcpy(t,s);
p1=80-strlen(s);
p2=p1/2;
gotoxy(p2,21);
for(i=0;i<strlen(s);i++)
printf("*");
count=10;
i=0;
l=41;
while(letter)
{
sw=0;
if(count<10)
l=42;
gotoxy(l,17);
printf("%d",count);
gotoxy(45,17);
scanf("%c",&letter);
if(letter!='.')
{
for(j=0;j<strlen(s);j++)
if(letter==s[j])
{
p3=j;
sw=1;
gotoxy(p2+p3,21);
printf("%c",letter);
s[j]='.';
i++;
break;
}
}
if(sw==0)
{
gotoxy(41,17);
count--;
gotoxy(41,17);
printf("0");
}
if(sw==0)
if(letter=='\n')
count++;
if(count==0)
{
clrscr();
gotoxy(1,7);
textcolor(12);
printf(" ");
c=201;
cprintf("%c",c);
c=205;
for(i=1;i<=35;i++)
cprintf("%c",c);
c=187;
cprintf("%c",c);
c=186;
printf("\n");
cprintf(" %c %c\r\n",c,c);
cprintf(" %c You lose the game %c\r\n",c,c);
cprintf(" %c The word is %c\r\n",c,c);
cprintf(" %c %c\r\n",c,c);
cprintf(" %c %c\r\n",c,c);
printf(" ");
c=204;
cprintf("%c",c);
c=205;
for(i=1;i<=35;i++)
cprintf("%c",c);
c=185;
cprintf("%c",c);
c=186;
printf("\n");
cprintf(" %c %c\r\n",c,c);
cprintf(" %c Do you want to continue?(Y/N) %c\r\n",c,c);
cprintf(" %c %c\r\n",c,c);
printf(" ");
c=200;
cprintf("%c",c);
c=205;
for(i=1;i<=35;i++)
cprintf("%c",c);
c=188;
cprintf("%c",c);
c=186;
printf("\n");
gotoxy(p2+1,11);
puts(t);
gotoxy(1,1);
return 0;
}
if(i==strlen(s))
{
clrscr();
gotoxy(1,8);
textcolor(12);
printf(" ");
c=201;
cprintf("%c",c);
c=205;
for(i=1;i<=35;i++)
cprintf("%c",c);
c=187;
cprintf("%c",c);
c=186;
printf("\n");
cprintf(" %c %c\r\n",c,c);
cprintf(" %c You win the game %c\r\n",c,c);
cprintf(" %c %c\r\n",c,c);
printf(" ");
c=204;
cprintf("%c",c);
c=205;
for(i=1;i<=35;i++)
cprintf("%c",c);
c=185;
cprintf("%c",c);
c=186;
printf("\n");
cprintf(" %c %c\r\n",c,c);
cprintf(" %c Do you want to continue?(Y/N) %c\r\n",c,c);
cprintf(" %c %c\r\n",c,c);
printf(" ");
c=200;
cprintf("%c",c);
c=205;
for(i=1;i<=35;i++)
cprintf("%c",c);
c=188;
cprintf("%c",c);
c=186;
printf("\n");
gotoxy(1,1);
return 0;
}
}
return 0;
}