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,0,1,0,1,1,1,0,1,0,1,1,1,1,1,1,1,0,1,1,1,1,1,0,1,
1,0,1,0,0,0,1,0,1,0,1,0,0,0,0,0,1,0,1,0,0,0,0,0,1,
1,0,1,1,1,1,1,0,1,0,1,0,1,0,1,1,1,0,1,1,1,1,1,1,1,
1,0,1,0,0,0,0,0,1,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,1,
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1
} ;
temp=a[x][y];
a[x][y]=2;
for (i=0;i<24;i++)
{
for (j=0;j<25;j++)
printf("%c",a[i][j]);
printf("\n");
}
a[x][y]=temp;
loop: while(kbhit()==0);
k=getch();
if(!k){
k=getch();
while (k!=0)
{
switch (k)
{
case 75: if (a[x][y-1]==0) y=y-1;else goto loop ;break;
case 77: if (a[x][y+1]==0) y=y+1;else goto loop ;break;
case 72: if (a[x-1][y]==0 ) x=x-1;else goto loop ;break;
case 80: if (a[x+1][y]==0 ) x=x+1;else goto loop ;break;
default :goto loop;
}
system("cls");
temp=a[x][y];
a[x][y]=2;
if (a[0][1]==2) {printf("great job! put any key out\n"); getch(); break;}
for (i=0;i<24;i++)
{
for (j=0;j<25;j++)
printf("%c",a[i][j]);
printf("\n");
}
a[x][y]=temp;
goto loop;
}
}
}
正文
tc下的迷宫游戏2006-08-07 16:24:00
【评论】 【打印】 【字体:大 中 小】 本文链接:http://blog.pfan.cn/elva6401/17379.html
阅读(4757) | 评论(1)
版权声明:编程爱好者网站为此博客服务提供商,如本文牵涉到版权问题,编程爱好者网站不承担相关责任,如有版权问题请直接与本文作者联系解决。谢谢!
评论