这个人很懒,什么都没写。
初二的人机一枚,请多多指教,欧耶! 迷宫代码小赏(本人几年前做):
#include <iostream>
#include <stdlib.h>
using namespace std;
int main()
{
char a[22][22]=
{
{'$','$','$','$','$','$','$','$','$','$','$','$','$','$','$','$','$','$','$','$','$','$'},
{'$','^','&','*','^','@','_','^','&','%','|','-','&','#','$','!','%','&','#','&','%','&'},
{'$','%','$','$','$','$','$','&','$','$','$','$','#','^','$','%','*','$','$','$','$','$'},
{'$','@','$','#','&','!','#','%','$','_','&','@','$','#','+','$','?','&','&','$','&','$'},
{'$','#','$','^','$','*','$','^','$','}','$','<','#','$','$','#','$','$','#','$','&','$'},
{'$','*','&','@','$','^','$','%','$',']','$','!','&','%','*',')','$','$','@','$','&','$'},
{'$','+','$','$','$','+','$','?','$','~','&','$','$','$','$','$','#','$','#','$','&','$'},
{'$','%','$','+','$','|','$','!','$','$','#','/','|','}','@','#','$','$','*','$','&','$'},
{'$','@','$',')','$',']','$','@','$','$','$','$','$','$','$','&','#','$','"','$','&','$'},
{'$','!','$','.','&','>','$','#','&','_','$','`','#','?','#','$','=','$','+','$','&','$'},
{'$','~','&','/','$','?','$','#','$','/','$','=','$','$','#','$','|','$','*','$','&','$'},
{'$','`','$',',','$','}','&','^','$','|','$','?','$',';','#','$','?','$','%','$','&','$'},
{'$','"','$','<','$','$','$','@','$','+','#','<','$',':','$','$','/','$','#','$','&','$'},
{'$','#','$','&','&','#','$','#','$','$','$','$','#','>','#','$','.','$','!','$','&','$'},
{'$','$','&','=','$','~','*','.','&',',',',','>','$','$','#','$',',','$','`','$','&','$'},
{'$','%','$','~','$','$','$','*','$','$','$','|','$','<','#','$','+','$','}','$','&','$'},
{'$','@','&','-','&','=','&','^','$','?','/','_','$','.','$','#','=','$','|','$','&','$'},
{'$','#','$','$','$','-','$','%','$','.','$','+','$',',','#','=','$','$',']','$','&','$'},
{'$','^','&','|','$','_','$',')','$','<','?','-','$','?','$','+','$','#','%','&','&','$'},
{'$','!','$','=','$','.','$','<','$','$','$','&','$','$','$','$','$','$','$','$','&','$'},
{'$','X','$','+','&','>','$',',','&','&','&','&','&','&','&','&','&','&','&','&','&','$'},
{'$','$','$','$','$','$','$','$','$','$','$','$','$','$','$','$','$','$','$','$','$','$'},
};
for (int i = 0;i <= 21;i++)
{
for (int j = 0;j <= 21;j++)
{
cout << a[i][j];
}
cout << endl;
}
int x = 20,y = 1;
char ch;
while(1)
{
cin >> ch;
system("cls");
if(ch == 's' && a[x+1][y] != '$')
{
a[x][y] = ' ';
x++;
a[x][y] = 'X';
}
if(ch == 'w' && a[x-1][y] != '$')
{
a[x][y] = ' ';
x--;
a[x][y] = 'X';
}
if(ch == 'a' && a[x][y-1] != '$')
{
a[x][y] = ' ';
y--;
a[x][y] = 'X';
}
if(ch == 'd' && a[x][y+1] != '$')
{
a[x][y] = ' ';
y++;
a[x][y] = 'X';
}
for (int i = 0;i <= 21;i++)
{
for (int j = 0;j <= 21;j++)
{
cout << a[i][j];
}
cout << endl;
}
if (x == 1 && y == 21)
{
system("cls");
cout << "666";
break;
}
}
return 0;
}