|
|
|
@ -6,13 +6,7 @@
|
|
|
|
|
#define M 3
|
|
|
|
|
#define N 18
|
|
|
|
|
#define Max 10000
|
|
|
|
|
void draw(int map[20][20]);
|
|
|
|
|
int mg[20][20]={0} ; //这是搜索算法要用的地图
|
|
|
|
|
void gotoxy(int x, int y) {
|
|
|
|
|
COORD pos = {x,y};
|
|
|
|
|
HANDLE hOut = GetStdHandle(STD_OUTPUT_HANDLE);// 获取标准输出设备句柄
|
|
|
|
|
SetConsoleCursorPosition(hOut, pos);//两个参数分别是指定哪个窗体,具体位置
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
struct
|
|
|
|
|
{
|
|
|
|
|
int i,j; //块的位置
|
|
|
|
@ -234,4 +228,28 @@ int main(void)
|
|
|
|
|
}
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void draw(int map[20][20])
|
|
|
|
|
{
|
|
|
|
|
int i,j;
|
|
|
|
|
system("cls") ; //清屏操作
|
|
|
|
|
printf("游戏开始 : WASD移动, R键重新开始, T键获得提示(按‘WSAD’返回)\n");
|
|
|
|
|
for(i=0;i<20;i++,printf("\n")) //切记不要忘了换行
|
|
|
|
|
{
|
|
|
|
|
for(j=0;j<20;j++)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
if(map[i][j]==0) printf(" ");
|
|
|
|
|
if(map[i][j]==1) printf("人");
|
|
|
|
|
if(map[i][j]==2) printf("■");
|
|
|
|
|
if(i==18&&j==3) printf("终");
|
|
|
|
|
|
|
|
|
|
if(map[i][j]==4) printf(" ");
|
|
|
|
|
if(map[i][j]==5) printf("☆");
|
|
|
|
|
if(i==18&&j==4) printf(" ");
|
|
|
|
|
printf("\33[?25l") ; //使光标不再出现
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|