#include <bits/stdc++.h>
using namespace std;
string l1[99]={{" "},{" .................."},{" .################."},{" .................."},{" ########..########"},{" .................."},{" .################."},{" .................."},{" ########..########"},{" .................."},{" .################."},{" .................."},{" ########..########"},{" .................."},{" .################."},{" .................."},{" ########..########"},{" ########..########"},{" ########.P########"}};
string l2[99]={{" "},{" .................."},{" #################."},{" #################."},{" .................."},{" .#################"},{" .................."},{" #################."},{" .................."},{" .#################"},{" .................."},{" #################."},{" .................."},{" .#################"},{" .................."},{" #################."},{" .................."},{" .#################"},{" .................P"}};
string l3[99]={{" "},{" .................."},{" #################."},{" ...#.............."},{" S#...############."},{" #################."},{" #################."},{" #################."},{" #################."},{" #################."},{" S.......##..|....."},{" #######....######."},{" #################."},{" #################."},{" #################."},{" #################."},{" #################."},{" #################."},{" P...........|....."}};
string l4[99]={{" "},{" ..............|||P"},{" ########.#########"},{" ########.#########"},{" ########.#########"},{" ########.#########"},{" ########.#########"},{" ########.#########"},{" ########.#########"},{" ########.#########"},{" S........#########"},{" ########.#########"},{" ########.#########"},{" ########.#########"},{" ########.#########"},{" ########.........S"},{" ########.#########"},{" ########.#########"},{" ########S#########"}};
string l5[99]={{" "},{" A................."},{" #################."},{" #################."},{" #################."},{" #################."},{" #################."},{" #################."},{" #################."},{" #################."},{" #################."},{" #################."},{" #################."},{" #################."},{" #################."},{" #################."},{" #################."},{" #################."},{" .................."}};
string l6[99]={{" "},{" S################."},{" S################."},{" S################."},{" S################."},{" S################."},{" S################."},{" S################."},{" S################."},{" S################."},{" S################."},{" S################."},{" S################."},{" S################."},{" S################."},{" S################."},{" S################."},{" .################."},{" .||||||||||||||||A"}};
string l7[99]={{" "},{" ##################"},{" ..............#.|."},{" #.###########.#.#."},{" #...#.#S#...#.#.#."},{" ###.#.#.#.#.#.#.#."},{" #.#...#.#.#.#.#.#."},{" #.#####.#.#.#.#.#."},{" #.#.......#...#.#A"},{" #.#.###########.##"},{" #...#...#.#......."},{" #.###.#.#.#.#####."},{" #.....#.#.....#..."},{" #######.#######.#."},{" #.....#.......#.#."},{" #.###########.#.#."},{" #...#.....#...#.#."},{" #.#.#.#.###.###.#."},{" #S#...#......|..#."}};
signed main()
{
int x,y;
srand(time(0));
x=y=1;
while(l1[x][y]!='P')
{
cout<<"Level 1:"<<endl;
cout<<". :empty space"<<endl;
cout<<"Y :you"<<endl;
cout<<"# :wall"<<endl;
cout<<"P :portal"<<endl;
for(int i=1;i<=18;i++)
{
for(int j=1;j<=18;j++)
{
if(i==x&&j==y) cout<<'Y';
else cout<<l1[i][j];
}
cout<<endl;
}
char k;
k=_getwch();
if(k=='w'&&x>1&&l1[x-1][y]!='#') x--;
if(k=='a'&&y>1&&l1[x][y-1]!='#') y--;
if(k=='d'&&y<18&&l1[x][y+1]!='#') y++;
if(k=='s'&&x<18&&l1[x+1][y]!='#') x++;
system("cls");
}
cout<<"Teleporting..."<<endl;
system("pause");
system("cls");
x=y=1;
while(l2[x][y]!='P')
{
cout<<"Level 2:"<<endl;
cout<<". :empty space"<<endl;
cout<<"Y :you"<<endl;
cout<<"# :wall"<<endl;
cout<<"P :portal"<<endl;
for(int i=1;i<=18;i++)
{
for(int j=1;j<=18;j++)
{
if(i==x&&j==y) cout<<'Y';
else cout<<l2[i][j];
}
cout<<endl;
}
char k;
k=_getwch();
if(k=='w'&&x>1&&l2[x-1][y]!='#') x--;
if(k=='a'&&y>1&&l2[x][y-1]!='#') y--;
if(k=='d'&&y<18&&l2[x][y+1]!='#') y++;
if(k=='s'&&x<18&&l2[x+1][y]!='#') x++;
system("cls");
}
cout<<"Teleporting..."<<endl;
system("pause");
system("cls");
x=y=1;
while(l3[x][y]!='P')
{
cout<<"Level 3:"<<endl;
cout<<". :empty space"<<endl;
cout<<"Y :you"<<endl;
cout<<"# :wall"<<endl;
cout<<"P :portal"<<endl;
cout<<"S :switch"<<endl;
cout<<"| :door"<<endl;
for(int i=1;i<=18;i++)
{
for(int j=1;j<=18;j++)
{
if(i==x&&j==y) cout<<'Y';
else cout<<l3[i][j];
}
cout<<endl;
}
char k;
k=_getwch();
if(k=='w'&&x>1&&l3[x-1][y]!='#'&&l3[x-1][y]!='|') x--;
if(k=='a'&&y>1&&l3[x][y-1]!='#'&&l3[x][y-1]!='|') y--;
if(k=='d'&&y<18&&l3[x][y+1]!='#'&&l3[x][y+1]!='|') y++;
if(k=='s'&&x<18&&l3[x+1][y]!='#'&&l3[x+1][y]!='|') x++;
if(x==4&&y==1)
{
l3[4][1]='.';
l3[10][13]='.';
}
if(x==10&&y==1)
{
l3[10][1]='.';
l3[18][13]='.';
}
system("cls");
}
cout<<"Teleporting..."<<endl;
system("pause");
system("cls");
x=y=1;
while(l4[x][y]!='P')
{
cout<<"Level 4:"<<endl;
cout<<". :empty space"<<endl;
cout<<"Y :you"<<endl;
cout<<"# :wall"<<endl;
cout<<"P :portal"<<endl;
cout<<"S :switch"<<endl;
cout<<"| :door"<<endl;
for(int i=1;i<=18;i++)
{
for(int j=1;j<=18;j++)
{
if(i==x&&j==y) cout<<'Y';
else cout<<l4[i][j];
}
cout<<endl;
}
char k;
k=_getwch();
if(k=='w'&&x>1&&l4[x-1][y]!='#'&&l4[x-1][y]!='|') x--;
if(k=='a'&&y>1&&l4[x][y-1]!='#'&&l4[x][y-1]!='|') y--;
if(k=='d'&&y<18&&l4[x][y+1]!='#'&&l4[x][y+1]!='|') y++;
if(k=='s'&&x<18&&l4[x+1][y]!='#'&&l4[x+1][y]!='|') x++;
if(x==10&&y==1)
{
l4[10][1]='.';
l4[1][15]='.';
}
if(x==15&&y==18)
{
l4[15][18]='.';
l4[1][16]='.';
}
if(x==18&&y==9)
{
l4[18][9]='.';
l4[1][17]='.';
}
system("cls");
}
cout<<"Teleporting..."<<endl;
system("pause");
system("cls");
x=18;
y=1;
while(l5[x][y]!='P')
{
cout<<"Level 5:"<<endl;
cout<<". :empty space"<<endl;
cout<<"Y :you"<<endl;
cout<<"# :wall"<<endl;
cout<<"P :portal"<<endl;
cout<<"S :switch"<<endl;
cout<<"| :door"<<endl;
cout<<"A :portal activator"<<endl;
for(int i=1;i<=18;i++)
{
for(int j=1;j<=18;j++)
{
if(i==x&&j==y) cout<<'Y';
else cout<<l5[i][j];
}
cout<<endl;
}
char k;
k=_getwch();
if(k=='w'&&x>1&&l5[x-1][y]!='#'&&l5[x-1][y]!='|') x--;
if(k=='a'&&y>1&&l5[x][y-1]!='#'&&l5[x][y-1]!='|') y--;
if(k=='d'&&y<18&&l5[x][y+1]!='#'&&l5[x][y+1]!='|') y++;
if(k=='s'&&x<18&&l5[x+1][y]!='#'&&l5[x+1][y]!='|') x++;
if(x==1&&y==1)
{
l5[1][1]='.';
l5[18][1]='P';
}
system("cls");
}
cout<<"Teleporting..."<<endl;
system("pause");
system("cls");
x=18;
y=1;
while(l6[x][y]!='P')
{
cout<<"Level 6:"<<endl;
cout<<". :empty space"<<endl;
cout<<"Y :you"<<endl;
cout<<"# :wall"<<endl;
cout<<"P :portal"<<endl;
cout<<"S :switch"<<endl;
cout<<"| :door"<<endl;
cout<<"A :portal activator"<<endl;
for(int i=1;i<=18;i++)
{
for(int j=1;j<=18;j++)
{
if(i==x&&j==y) cout<<'Y';
else cout<<l6[i][j];
}
cout<<endl;
}
char k;
k=_getwch();
if(k=='w'&&x>1&&l6[x-1][y]!='#'&&l6[x-1][y]!='|') x--;
if(k=='a'&&y>1&&l6[x][y-1]!='#'&&l6[x][y-1]!='|') y--;
if(k=='d'&&y<18&&l6[x][y+1]!='#'&&l6[x][y+1]!='|') y++;
if(k=='s'&&x<18&&l6[x+1][y]!='#'&&l6[x+1][y]!='|') x++;
if(x==1&&y==1)
{
l6[1][1]='.';
l6[18][2]='.';
}
if(x==2&&y==1)
{
l6[2][1]='.';
l6[18][3]='.';
}
if(x==3&&y==1)
{
l6[3][1]='.';
l6[18][4]='.';
}
if(x==4&&y==1)
{
l6[4][1]='.';
l6[18][5]='.';
}
if(x==5&&y==1)
{
l6[5][1]='.';
l6[18][6]='.';
}
if(x==6&&y==1)
{
l6[6][1]='.';
l6[18][7]='.';
}
if(x==7&&y==1)
{
l6[7][1]='.';
l6[18][8]='.';
}
if(x==8&&y==1)
{
l6[8][1]='.';
l6[18][9]='.';
}
if(x==9&&y==1)
{
l6[9][1]='.';
l6[18][10]='.';
}
if(x==10&&y==1)
{
l6[10][1]='.';
l6[18][11]='.';
}
if(x==11&&y==1)
{
l6[11][1]='.';
l6[18][12]='.';
}
if(x==12&&y==1)
{
l6[12][1]='.';
l6[18][13]='.';
}
if(x==13&&y==1)
{
l6[13][1]='.';
l6[18][14]='.';
}
if(x==14&&y==1)
{
l6[14][1]='.';
l6[18][15]='.';
}
if(x==15&&y==1)
{
l6[15][1]='.';
l6[18][16]='.';
}
if(x==16&&y==1)
{
l6[16][1]='.';
l6[18][17]='.';
}
if(x==18&&y==18)
{
l6[18][18]='.';
l6[1][18]='P';
}
system("cls");
}
cout<<"Teleporting..."<<endl;
system("pause");
system("cls");
x=2;
y=1;
while(l7[x][y]!='P')
{
cout<<"Level 7:"<<endl;
cout<<". :empty space"<<endl;
cout<<"Y :you"<<endl;
cout<<"# :wall"<<endl;
cout<<"P :portal"<<endl;
cout<<"S :switch"<<endl;
cout<<"| :door"<<endl;
cout<<"A :portal activator"<<endl;
for(int i=1;i<=18;i++)
{
for(int j=1;j<=18;j++)
{
if(i==x&&j==y) cout<<'Y';
else cout<<l7[i][j];
}
cout<<endl;
}
char k;
k=_getwch();
if(k=='w'&&x>1&&l7[x-1][y]!='#'&&l7[x-1][y]!='|') x--;
if(k=='a'&&y>1&&l7[x][y-1]!='#'&&l7[x][y-1]!='|') y--;
if(k=='d'&&y<18&&l7[x][y+1]!='#'&&l7[x][y+1]!='|') y++;
if(k=='s'&&x<18&&l7[x+1][y]!='#'&&l7[x+1][y]!='|') x++;
if(x==18&&y==2)
{
l7[18][2]='.';
l7[2][17]='.';
}
if(x==8&&y==18)
{
l7[8][18]='.';
l7[2][1]='P';
}
if(x==4&&y==8)
{
l7[4][8]='.';
l7[18][14]='.';
}
system("cls");
}
system("cls");
cout<<"You escaped!"<<endl;
return 0;
}Maze
这是 2025年10月18日 存档的第 1 版,不是当前版本。查看当前版本