PUSHBOX Game in C | C Language Games | Fun in C Gaming

PUSHBOX Game in C | C Language Games | Fun in C Gaming


#include
#include
#include
#include
void display(char a[11][9]);
int pos(char a[11][9]);
void swap(char *a,char *b);
int final(char a[11][9]);
void main()
{

char a[11][9],ch;
for(i=0;i<11;i++)
for(j=0;j<9;j++)
a[i][j]='a';
}
{
a[i][8]='H';
for(i=0;i<9;i++)
a[0][i]='H';
}
{
{
a[i][j]='H';
}
a[1][7]='X';
a[9][7]='X';
a[4][5]='U';
a[6][5]='U';
a[1][2]='H';
a[1][6]='H';
a[7][2]='H';
a[7][6]='H';

/* You can change the designing part to customize your own puzzle  */
abc:;
final1=final(a);
if(final1==0)
clrscr();
printf("\\n\\n********Congrats Puzzle Solved********");
printf("\\n\\n********www.glearn.net / www.lernc.blogspot.com********");
clrscr();
upos=pos(a);
no=ch;

{
{

{
a[2][1]='O';
goto abc;
else if(a[2][7]=='U'&&a[3][7]=='O')
a[1][7]='a';
a[3][7]='a';
}
goto abc;

goto abc;

{
swap(&a[upos/9][upos%9],&a[(upos/9)-1][upos%9]);
else if(a[(upos/9)-1][upos%9]!='X')
}
}
{
{

{
a[8][1]='O';
}

{
a[8][7]='O';
}

goto abc;

goto abc;

{
swap(&a[upos/9][upos%9],&a[upos/9+1][upos%9]);
else if(a[(upos/9)+1][upos%9]!='X')
}

}
{
{

{
a[1][6]='O';
}

{
a[9][6]='O';
}

goto abc;

goto abc;

{
swap(&a[upos/9][upos%9],&a[upos/9][upos%9+1]);
else if(a[(upos/9)][upos%9+1]!='X')
}
}
{
{

{
a[1][2]='O';
}

{
a[9][2]='O';
}

goto abc;

goto abc;

{
swap(&a[upos/9][upos%9],&a[upos/9][upos%9-1]);
else if(a[(upos/9)][upos%9-1]!='X')
}
}

{
}
       else if(no==114)
                {
                       goto ab;
                 }
goto abc;
}

getch();      /* clean up */
closegraph();

}

void display(char a[11][9])
{

int poly[8];
{
{
{
poly[1]=poly[3]=y1;
poly[7]=poly[5]=y2;
setfillstyle(SOLID_FILL,RED);
}
{
poly[1]=poly[3]=y1+3;
poly[7]=poly[5]=y2-3;
setfillstyle(SOLID_FILL,YELLOW);
}
{
poly[1]=poly[3]=y1+3;
poly[7]=poly[5]=y2-3;
setfillstyle(SOLID_FILL,BLACK);
}
{
poly[1]=poly[3]=y1+3;
poly[7]=poly[5]=y2-3;
setfillstyle(SOLID_FILL,CYAN);
}
{
poly[1]=poly[3]=y1;
poly[7]=poly[5]=y2;
setfillstyle(SOLID_FILL,GREEN);
}
x2=x2+20;
x1=100;
y1=y1+20;
}
}

int pos(char a[11][9])
{
for(i=1;i<11;i++)
for(j=1;j<9;j++)
if(a[i][j]=='O')
pos=9*i+j;
}
}
}

void swap(char *a,char *b)
{
temp=*a;
*b=temp;
}

int final(char a[11][9])
{
{
{
{
return(final);
}
return(final);
}



2 comments: