#include<bits/stdc++.h>
#include<conio.h>
#include<windows.h>
using namespace std;
int wi, wj;
int hi, hj;
int game = 1;
struct node{
int x, y;
int xx, yy;
}bg[]={{0, 0, 1, 1}, {6, 7, 1, 1}, {6, 7, 1, 1}, {6, 7, 1, 1}, {8, 11, 1, 1}, {8, 11, 1, 1}, {8, 11, 1, 1}, {8, 11, 1, 1}, {8, 11, 1, 1}, {8, 11, 1, 1}, {10, 21, 1, 1}, {10, 21, 1, 1}, {10, 21, 1, 1}, {10, 21, 2, 1}};
int bx[]={0, 1, 1, 2, 2, 2, 2, 3, 3, 5, 3, 10, 17, 8};
char op;
int player_i, player_j;
int vis[1010][1010];
/*
w: # 墙
p: @ 玩家
b: . 箱子
e: O 终点
q: % 被玩家
覆盖的终点
f: 0 被箱子
覆盖的终点
r: Q 门
F: F 钥匙
K: @ 被玩家
拾取的钥匙
*/
map<int, vector<string> > mp=
{
{1, {
"wwwwwwwww",
"wwwwwwwww",
"www ww",
"ww e ww",
"ww b ww",
"ww p ww",
"wwwwwwwww",
"wwwwwwwww"}},
{2, {
"wwwwwwwww",
"wwwwwwwww",
"wwww eww",
"ww www",
"ww b ww",
"www p ww",
"wwwwwwwww",
"wwwwwwwww"}},
{3, {
"wwwwwwwww",
"wwwwwwwww",
"wwe eww",
"ww www",
"ww b b ww",
"www p ww",
"wwwwwwwww",
"wwwwwwwww"}},
{4, {
"wwwwwwwwwwwww",
"wwwwwwwwwwwww",
"wwewe ww",
"ww ww b ww",
"ww w ww",
"ww ww b ww",
"ww w ww",
"ww pw ww",
"wwwwwwwwwwwww",
"wwwwwwwwwwwww"}},
{5, {
"wwwwwwwwwwwww",
"wwwwwwwwwwwww",
"wwe eww",
"wwwww wwwwww",
"ww w ww",
"ww b wb ww",
"wwwwww ww",
"wwp ww",
"wwwwwwwwwwwww",
"wwwwwwwwwwwww"}},
{6, {
"wwwwwwwwwwwww",
"wwwwwwwwwwwww",
"wwp w ww",
"ww w b ww",
"ww w ww",
"ww e w ww",
"ww w b ww",
"wwe w ww",
"wwwwwwwwwwwww",
"wwwwwwwwwwwww"}},
{7, {
"wwwwwwwwwwwww",
"wwwwwwwwwwwww",
"wwp ww ww",
"ww eww b ww",
"ww eww b ww",
"ww eww b ww",
"ww ww",
"ww ww",
"wwwwwwwwwwwww",
"wwwwwwwwwwwww"}},
{8, {
"wwwwwwwwwwwww",
"wwwwwwwwwwwww",
"wwe eww",
"ww wwwww ww",
"ww w b ww",
"ww bb w ww",
"ww wwwww ww",
"wwe pww",
"wwwwwwwwwwwww",
"wwwwwwwwwwwww"}},
{9, {
"wwwwwwwwwwwww",
"wwwwwwwwwwwww",
"ww ww",
"ww b ww",
"wwb ee bb ww",
"ww ee ww",
"ww b ww",
"ww pww",
"wwewwwwwwwwww",
"wwwwwwwwwwwww"}},
{10, {
"wwwwwwwwwwwwwwwwwwwwwww",
"wwwwwwwwwwwwwwwwwwwwwww",
"wwe b w ww",
"ww w ww",
"wwwwwwwwrwwww ww",
"ww w e ww",
"ww w ww",
"wwe w r b ww",
"ww w b w ww",
"ww w w pww",
"wwwwwwwwwwwwwwwwwwwwwww",
"wwwwwwwwwwwwwwwwwwwwwww"}},
{11, {
"wwwwwwwwwwwwwwwwwwwwwww",
"wwwwwwwwwwwwwwwwwwwwwww",
"ww wew wew wew wew weww",
"ww wbw wbw wbw wbw wbww",
"ww w w w w w w w w w ww",
"ww r r r r r r r r r ww",
"ww w w w w w w w w w ww",
"ww w w w w w w w w w ww",
"wwbw wbw wbw wbw wbw ww",
"wwew wew wew wew wewpww",
"wwwwwwwwwwwwwwwwwwwwwww",
"wwwwwwwwwwwwwwwwwwwwwww"}},
{12, {
"wwwwwwwwwwwwwwwwwwwwwww",
"wwwwwwwwwwwwwwwwwwwwwww",
"ww eeeeeeeeeeeeeeeee ww",
"ww ww",
"ww ww",
"wwwww wwwww",
"ww ww",
"ww ww",
"ww bbbbbbbbbbbbbbbbb ww",
"ww pww",
"wwwwwwwwwwwwwwwwwwwwwww",
"wwwwwwwwwwwwwwwwwwwwwww"}},
{13, {
"wwwwwwwwwwwwwwwwwwwwwww",
"wwwwwwwwwwwwwwwwwwwwwww",
"wweeee e r eww",
"ww w ww",
"wwbbbbb w bww",
"ww wwwwwwww ww",
"wwwwwrww wwrwwwww",
"ww w ww",
"ww w ww",
"ww e b web pww",
"wwrwwwwwwwwwwwwwwwwwwww",
"ww wwwwwwwwwwwwwwwwwwww",
"ww Fw ww",
"ww w ww",
"wwwrww ww",
"ww w ww",
"ww w ww",
"wwb r ww",
"ww w ww",
"wwe w ww",
"wwwwwwwwwwwwwwwwwwwwwww",
"wwwwwwwwwwwwwwwwwwwwwww"}},
};
char gt[1010][1010]={
"#######################",
"#_____________________#",
"#| | | | | | | | | | |#",
"#######################"
};
int gt_top=0;
void hideCursor(){
HANDLE sreen=GetStdHandle(STD_OUTPUT_HANDLE);
CONSOLE_CURSOR_INFO CursorInfo;
GetConsoleCursorInfo(sreen, &CursorInfo);
CursorInfo.bVisible = false;
SetConsoleCursorInfo(sreen, &CursorInfo);
}
void gotoxy(int x, int y){
HANDLE hOut = NULL;
COORD pos;
pos.X = x;
pos.Y = y;
SetConsoleCursorPosition(hOut, pos);
}
void init(){
int gg=1, hh=1;
int ii = wi*hi;
int jj = wj*hj;
if(hi!=1){
gg = wi+1;
}
if(hj!=1){
hh = wj+1;
}
for(int i = gg; i <= ii; i++){
for(int j = hh; j <= jj; j++){
gotoxy(i, j);
if(mp[game][i][j] == 'w'){
printf("#");
}else if(mp[game][i][j] == 'e'){
printf("O");
}else if(mp[game][i][j] == 'b'){
printf(".");
}else if(mp[game][i][j] == 'p'){
printf("@");
player_i = i;
player_j = j;
}else if(mp[game][i][j] == ' '){
printf(" ");
}else if(mp[game][i][j] == 'f'){
printf("0");
}else if(mp[game][i][j] == 'q'){
printf("%");
}else if(mp[game][i][j] == 'r'){
printf("Q");
}else if(mp[game][i][j] == 'F'){
printf("F");
}
}
cout << endl;
}
}
bool check(){
int gg=1, hh=1;
int ii = wi*hi;
int jj = wj*hj;
if(hi!=1){
gg = wi+1;
}
if(hj!=1){
hh = wj+1;
}
int x = 0;
for(int i = gg; i <= ii; i++){
for(int j = hh; j <= jj; j++){
if(mp[game][i][j] == 'f'){
if(vis[i][j] == 0){
for(int l = jj; l >= gg; l--){
int f = 0;
for(int k = ii; k >= hh; k--){
if(mp[game][k][l] == 'r'){
mp[game][k][l] = ' ';
f = 1;
break;
}
}
if(f){
break;
}
}
}
x++;
vis[i][j] = 1;
}
if(mp[game][i][j] == 'F'){
}
}
}
if(game == 13){
if(mp[game][11][2] == 'p'){
hi = bg[game].xx;
}else if(mp[game][10][2] == 'p'){
hi = 1;
}
}
if(x == bx[game]){
return true;
}
return false;
}
void move(int x, int y){
if(mp[game][player_i+x][player_j+y] == ' '){
mp[game][player_i+x][player_j+y] = 'p';
mp[game][player_i][player_j] = ' ';
player_i = player_i+x;
player_j = player_j+y;
}else if(mp[game][player_i+x][player_j+y] == 'b'){
if(mp[game][player_i+2*x][player_j+2*y] == 'w'){
}else if(mp[game][player_i+2*x][player_j+2*y] == 'e'){
mp[game][player_i+2*x][player_j+2*y] = 'f';
mp[game][player_i+x][player_j+y] = 'p';
mp[game][player_i][player_j] = ' ';
player_i = player_i+x;
player_j = player_j+y;
}else if(mp[game][player_i+2*x][player_j+2*y] == 'b'){
if(mp[game][player_i+3*x][player_j+3*y] == 'w'){
}else if(mp[game][player_i+3*x][player_j+3*y] == 'e'){
mp[game][player_i+3*x][player_j+3*y] = 'f';
mp[game][player_i+2*x][player_j+2*y] = 'b';
mp[game][player_i+x][player_j+y] = 'p';
mp[game][player_i][player_j] = ' ';
player_i = player_i+x;
player_j = player_j+y;
}else if(mp[game][player_i+3*x][player_j+3*y] == 'b'){
}else{
mp[game][player_i+3*x][player_j+3*y] = 'b';
mp[game][player_i+2*x][player_j+2*y] = 'b';
mp[game][player_i+x][player_j+y] = 'p';
mp[game][player_i][player_j] = ' ';
player_i = player_i+x;
player_j = player_j+y;
}
}else if(mp[game][player_i+2*x][player_j+2*y] == 'f'){
if(mp[game][player_i+3*x][player_j+3*y] == 'w'){
}else if(mp[game][player_i+3*x][player_j+3*y] == 'e'){
mp[game][player_i+3*x][player_j+3*y] = 'f';
mp[game][player_i+2*x][player_j+2*y] = 'f';
mp[game][player_i+x][player_j+y] = 'p';
mp[game][player_i][player_j] = ' ';
player_i = player_i+x;
player_j = player_j+y;
}else if(mp[game][player_i+3*x][player_j+3*y] == 'b'){
}else{
mp[game][player_i+3*x][player_j+3*y] = 'b';
mp[game][player_i+2*x][player_j+2*y] = 'f';
mp[game][player_i+x][player_j+y] = 'p';
mp[game][player_i][player_j] = ' ';
player_i = player_i+x;
player_j = player_j+y;
}
}else{
mp[game][player_i+2*x][player_j+2*y] = 'b';
mp[game][player_i+x][player_j+y] = 'p';
mp[game][player_i][player_j] = ' ';
player_i = player_i+x;
player_j = player_j+y;
}
}else if(mp[game][player_i+x][player_j+y] == 'e'){
mp[game][player_i+x][player_j+y] = 'q';
mp[game][player_i][player_j] = ' ';
player_i = player_i+x;
player_j = player_j+y;
}else if(mp[game][player_i+x][player_j+y] == 'f'){
if(mp[game][player_i+2*x][player_j+2*y] == 'w'){
}else{
mp[game][player_i+2*x][player_j+2*y] = 'b';
mp[game][player_i+x][player_j+y] = 'q';
mp[game][player_i][player_j] = ' ';
player_i = player_i+x;
player_j = player_j+y;
}
}else if(mp[game][player_i][player_j] == 'q'){
if(mp[game][player_i+x][player_j+y] == ' '){
mp[game][player_i+x][player_j+y] = 'p';
mp[game][player_i][player_j] = 'e';
player_i = player_i+x;
player_j = player_j+y;
}else if(mp[game][player_i+x][player_j+y] == 'b'){
if(mp[game][player_i+2*x][player_j+2*y] == 'w'){
}else if(mp[game][player_i+2*x][player_j+2*y] == 'e'){
mp[game][player_i+2*x][player_j+2*y] = 'f';
mp[game][player_i+x][player_j+y] = 'p';
mp[game][player_i][player_j] = 'e';
player_i = player_i+x;
player_j = player_j+y;
}else if(mp[game][player_i+2*x][player_j+2*y] == 'b'){
if(mp[game][player_i+3*x][player_j+3*y] == 'w'){
}else if(mp[game][player_i+3*x][player_j+3*y] == 'e'){
mp[game][player_i+3*x][player_j+3*y] = 'f';
mp[game][player_i+2*x][player_j+2*y] = 'b';
mp[game][player_i+x][player_j+y] = 'p';
mp[game][player_i][player_j] = 'e';
player_i = player_i+x;
player_j = player_j+y;
}else if(mp[game][player_i+3*x][player_j+3*y] == 'b'){
}else{
mp[game][player_i+3*x][player_j+3*y] = 'b';
mp[game][player_i+2*x][player_j+2*y] = 'b';
mp[game][player_i+x][player_j+y] = 'p';
mp[game][player_i][player_j] = 'e';
player_i = player_i+x;
player_j = player_j+y;
}
}else{
mp[game][player_i+2*x][player_j+2*y] = 'b';
mp[game][player_i+x][player_j+y] = 'p';
mp[game][player_i][player_j] = 'e';
player_i = player_i+x;
player_j = player_j+y;
}
}else if(mp[game][player_i+x][player_j+y] == 'e'){
mp[game][player_i+2*x][player_j+2*y] = 'q';
mp[game][player_i+x][player_j+y] = 'e';
player_i = player_i+x;
player_j = player_j+y;
}else if(mp[game][player_i+x][player_j+y] == 'f'){
if(mp[game][player_i+2*x][player_j+2*y] == 'w'){
}else{
mp[game][player_i+2*x][player_j+2*y] = 'b';
mp[game][player_i+x][player_j+y] = 'q';
mp[game][player_i][player_j] = 'e';
player_i = player_i+x;
player_j = player_j+y;
}
}
}else if(mp[game][player_i+x][player_j+y] == 'F'){
gt_top++;
gt[2][gt_top*2] = 'F';
mp[game][player_i+x][player_j+y] = 'p';
mp[game][player_i][player_j] = ' ';
player_i = player_i+x;
player_j = player_j+y;
}
}
int main(){
hideCursor();
wi = bg[game].x;
wj = bg[game].y;
hi = 1;
hj = 1;
cout << "level " << game << endl;
init();
while(cin >> op){
if(op == 'w'){
// if(mp[game][player_i-1][player_j] == ' '){
// mp[game][player_i-1][player_j] = 'p';
// mp[game][player_i][player_j] = ' ';
// player_i = player_i-1;
// }else if(mp[game][player_i-1][player_j] == 'b'){
// if(mp[game][player_i-2][player_j] == 'w'){
//
// }else if(mp[game][player_i-2][player_j] == 'e'){
// mp[game][player_i-2][player_j] = 'f';
// mp[game][player_i-1][player_j] = 'p';
// mp[game][player_i][player_j] = ' ';
// player_i = player_i-1;
// }else if(mp[game][player_i-2][player_j] == 'b'){
// if(mp[game][player_i-3][player_j] == 'w'){
//
// }else if(mp[game][player_i-3][player_j] == 'e'){
// mp[game][player_i-3][player_j] = 'f';
// mp[game][player_i-2][player_j] = 'b';
// mp[game][player_i-1][player_j] = 'p';
// mp[game][player_i][player_j] = ' ';
// player_i = player_i-1;
// }else if(mp[game][player_i-3][player_j] == 'b'){
//
// }else{
// mp[game][player_i-3][player_j] = 'b';
// mp[game][player_i-2][player_j] = 'b';
// mp[game][player_i-1][player_j] = 'p';
// mp[game][player_i][player_j] = ' ';
// player_i = player_i-1;
// }
// }else if(mp[game][player_i-2][player_j] == 'f'){
// if(mp[game][player_i-3][player_j] == 'w'){
//
// }else if(mp[game][player_i-3][player_j] == 'e'){
// mp[game][player_i-3][player_j] = 'f';
// mp[game][player_i-2][player_j] = 'f';
// mp[game][player_i-1][player_j] = 'p';
// mp[game][player_i][player_j] = ' ';
// player_i = player_i-1;
// }else if(mp[game][player_i-3][player_j] == 'b'){
//
// }else{
// mp[game][player_i-3][player_j] = 'b';
// mp[game][player_i-2][player_j] = 'f';
// mp[game][player_i-1][player_j] = 'p';
// mp[game][player_i][player_j] = ' ';
// player_i = player_i-1;
// }
// }else{
// mp[game][player_i-2][player_j] = 'b';
// mp[game][player_i-1][player_j] = 'p';
// mp[game][player_i][player_j] = ' ';
// player_i = player_i-1;
// }
// }else if(mp[game][player_i-1][player_j] == 'e'){
// mp[game][player_i-1][player_j] = 'q';
// mp[game][player_i][player_j] = ' ';
// player_i = player_i-1;
// }else if(mp[game][player_i-1][player_j] == 'f'){
// if(mp[game][player_i-2][player_j] == 'w'){
//
// }else{
// mp[game][player_i-2][player_j] = 'b';
// mp[game][player_i-1][player_j] = 'q';
// mp[game][player_i][player_j] = ' ';
// player_i = player_i-1;
// }
// }else if(mp[game][player_i][player_j] == 'q'){
// if(mp[game][player_i-1][player_j] == ' '){
// mp[game][player_i-1][player_j] = 'p';
// mp[game][player_i][player_j] = 'e';
// player_i = player_i-1;
// }else if(mp[game][player_i-1][player_j] == 'b'){
// if(mp[game][player_i-2][player_j] == 'w'){
//
// }else if(mp[game][player_i-2][player_j] == 'e'){
// mp[game][player_i-2][player_j] = 'f';
// mp[game][player_i-1][player_j] = 'p';
// mp[game][player_i][player_j] = 'e';
// player_i = player_i-1;
// }else if(mp[game][player_i-2][player_j] == 'b'){
// if(mp[game][player_i-3][player_j] == 'w'){
//
// }else if(mp[game][player_i-3][player_j] == 'e'){
// mp[game][player_i-3][player_j] = 'f';
// mp[game][player_i-2][player_j] = 'b';
// mp[game][player_i-1][player_j] = 'p';
// mp[game][player_i][player_j] = 'e';
// player_i = player_i-1;
// }else if(mp[game][player_i-3][player_j] == 'b'){
//
//
// }else{
// mp[game][player_i-3][player_j] = 'b';
// mp[game][player_i-2][player_j] = 'b';
// mp[game][player_i-1][player_j] = 'p';
// mp[game][player_i][player_j] = 'e';
// player_i = player_i-1;
// }
// }else{
// mp[game][player_i-2][player_j] = 'b';
// mp[game][player_i-1][player_j] = 'p';
// mp[game][player_i][player_j] = 'e';
// player_i = player_i-1;
// }
// }else if(mp[game][player_i-1][player_j] == 'e'){
// mp[game][player_i-1][player_j] = 'q';
// mp[game][player_i-1][player_j] = 'e';
// player_i = player_i-1;
// }else if(mp[game][player_i-1][player_j] == 'f'){
// if(mp[game][player_i-2][player_j] == 'w'){
//
// }else{
// mp[game][player_i-2][player_j] = 'b';
// mp[game][player_i-1][player_j] = 'q';
// mp[game][player_i][player_j] = 'e';
// player_i = player_i-1;
// }
// }
// }else if(mp[game][player_i-1][player_j] == 'F'){
// gt_top++;
// gt[2][gt_top*2] = 'F';
// mp[game][player_i-1][player_j] = 'p';
// mp[game][player_i][player_j] = ' ';
// player_i = player_i-1;
// }
move(-1, 0);
}else if(op == 's'){
// if(mp[game][player_i+1][player_j] == ' '){
// mp[game][player_i+1][player_j] = 'p';
// mp[game][player_i][player_j] = ' ';
// player_i = player_i+1;
// }else if(mp[game][player_i+1][player_j] == 'b'){
// if(mp[game][player_i+2][player_j] == 'w'){
//
// }else if(mp[game][player_i+2][player_j] == 'e'){
// mp[game][player_i+2][player_j] = 'f';
// mp[game][player_i+1][player_j] = 'p';
// mp[game][player_i][player_j] = ' ';
// player_i = player_i+1;
// }else if(mp[game][player_i+2][player_j] == 'b'){
// if(mp[game][player_i+3][player_j] == 'w'){
//
// }else if(mp[game][player_i+3][player_j] == 'e'){
// mp[game][player_i+3][player_j] = 'f';
// mp[game][player_i+2][player_j] = 'b';
// mp[game][player_i+1][player_j] = 'p';
// mp[game][player_i][player_j] = ' ';
// player_i = player_i+1;
// }else if(mp[game][player_i+3][player_j] == 'b'){
//
// }else{
// mp[game][player_i+3][player_j] = 'b';
// mp[game][player_i+2][player_j] = 'b';
// mp[game][player_i+1][player_j] = 'p';
// mp[game][player_i][player_j] = ' ';
// player_i = player_i+1;
// }
// }else if(mp[game][player_i+2][player_j] == 'f'){
// if(mp[game][player_i+3][player_j] == 'w'){
//
// }else if(mp[game][player_i+3][player_j] == 'e'){
// mp[game][player_i+3][player_j] = 'f';
// mp[game][player_i+2][player_j] = 'f';
// mp[game][player_i+1][player_j] = 'p';
// mp[game][player_i][player_j] = ' ';
// player_i = player_i+1;
// }else if(mp[game][player_i+3][player_j] == 'b'){
//
// }else{
// mp[game][player_i+3][player_j] = 'b';
// mp[game][player_i+2][player_j] = 'f';
// mp[game][player_i+1][player_j] = 'p';
// mp[game][player_i][player_j] = ' ';
// player_i = player_i+1;
// }
// }else{
// mp[game][player_i+2][player_j] = 'b';
// mp[game][player_i+1][player_j] = 'p';
// mp[game][player_i][player_j] = ' ';
// player_i = player_i+1;
// }
// }else if(mp[game][player_i+1][player_j] == 'e'){
// mp[game][player_i+1][player_j] = 'q';
// mp[game][player_i][player_j] = ' ';
// player_i = player_i+1;
// }else if(mp[game][player_i+1][player_j] == 'f'){
// if(mp[game][player_i+2][player_j] == 'w'){
//
// }else{
// mp[game][player_i+2][player_j] = 'b';
// mp[game][player_i+1][player_j] = 'q';
// mp[game][player_i][player_j] = ' ';
// player_i = player_i+1;
// }
// }else if(mp[game][player_i][player_j] == 'q'){
// if(mp[game][player_i+1][player_j] == ' '){
// mp[game][player_i+1][player_j] = 'p';
// mp[game][player_i][player_j] = 'e';
// player_i = player_i+1;
// }else if(mp[game][player_i+1][player_j] == 'b'){
// if(mp[game][player_i+2][player_j] == 'w'){
//
// }else if(mp[game][player_i+2][player_j] == 'e'){
// mp[game][player_i+2][player_j] = 'f';
// mp[game][player_i+1][player_j] = 'p';
// mp[game][player_i][player_j] = 'e';
// player_i = player_i+1;
// }else if(mp[game][player_i+2][player_j] == 'b'){
// if(mp[game][player_i+3][player_j] == 'w'){
//
// }else if(mp[game][player_i+3][player_j] == 'e'){
// mp[game][player_i+3][player_j] = 'f';
// mp[game][player_i-2][player_j] = 'b';
// mp[game][player_i-1][player_j] = 'p';
// mp[game][player_i][player_j] = 'e';
// player_i = player_i-1;
// }else if(mp[game][player_i-3][player_j] == 'b'){
//
//
// }else{
// mp[game][player_i-3][player_j] = 'b';
// mp[game][player_i-2][player_j] = 'b';
// mp[game][player_i-1][player_j] = 'p';
// mp[game][player_i][player_j] = 'e';
// player_i = player_i-1;
// }
// }else{
// mp[game][player_i-2][player_j] = 'b';
// mp[game][player_i-1][player_j] = 'p';
// mp[game][player_i][player_j] = 'e';
// player_i = player_i-1;
// }
// }else if(mp[game][player_i-1][player_j] == 'e'){
// mp[game][player_i-1][player_j] = 'q';
// mp[game][player_i-1][player_j] = 'e';
// player_i = player_i-1;
// }else if(mp[game][player_i-1][player_j] == 'f'){
// if(mp[game][player_i-2][player_j] == 'w'){
//
// }else{
// mp[game][player_i-2][player_j] = 'b';
// mp[game][player_i-1][player_j] = 'q';
// mp[game][player_i][player_j] = 'e';
// player_i = player_i-1;
// }
// }
// }else if(mp[game][player_i+1][player_j] == 'F'){
// gt_top++;
// gt[2][gt_top*2] = 'F';
// mp[game][player_i+1][player_j] = 'p';
// mp[game][player_i][player_j] = ' ';
// player_i = player_i+1;
// }
move(1, 0);
}else if(op == 'a'){
if(mp[game][player_i][player_j-1] == ' '){
mp[game][player_i][player_j-1] = 'p';
mp[game][player_i][player_j] = ' ';
player_j = player_j-1;
}else if(mp[game][player_i][player_j-1] == 'b'){
if(mp[game][player_i][player_j-2] == 'w'){
}else if(mp[game][player_i][player_j-2] == 'e'){
mp[game][player_i][player_j-2] = 'f';
mp[game][player_i][player_j-1] = 'p';
mp[game][player_i][player_j] = ' ';
player_j = player_j-1;
}else if(mp[game][player_i][player_j-2] == 'b'){
if(mp[game][player_i][player_j-3] == 'w'){
}else if(mp[game][player_i][player_j-3] == 'e'){
mp[game][player_i][player_j-3] = 'f';
mp[game][player_i][player_j-2] = 'b';
mp[game][player_i][player_j-1] = 'p';
mp[game][player_i][player_j] = ' ';
player_j = player_j-1;
}else if(mp[game][player_i][player_j-3] == 'b'){
}else{
mp[game][player_i][player_j-3] = 'b';
mp[game][player_i][player_j-2] = 'b';
mp[game][player_i][player_j-1] = 'p';
mp[game][player_i][player_j] = ' ';
player_j = player_j-1;
}
}else if(mp[game][player_i][player_j-2] == 'f'){
if(mp[game][player_i][player_j-3] == 'w'){
}else if(mp[game][player_i][player_j-3] == 'e'){
mp[game][player_i][player_j-3] = 'f';
mp[game][player_i][player_j-2] = 'f';
mp[game][player_i][player_j-1] = 'p';
mp[game][player_i][player_j] = ' ';
player_j = player_j-1;
}else if(mp[game][player_i][player_j-3] == 'b'){
}else{
mp[game][player_i][player_j-3] = 'b';
mp[game][player_i][player_j-2] = 'f';
mp[game][player_i][player_j-1] = 'p';
mp[game][player_i][player_j] = ' ';
player_j = player_j-1;
}
}else{
mp[game][player_i][player_j-2] = 'b';
mp[game][player_i][player_j-1] = 'p';
mp[game][player_i][player_j] = ' ';
player_j = player_j-1;
}
}else if(mp[game][player_i][player_j-1] == 'e'){
mp[game][player_i][player_j-1] = 'q';
mp[game][player_i][player_j] = ' ';
player_j = player_j-1;
}else if(mp[game][player_i][player_j-1] == 'f'){
if(mp[game][player_i][player_j-2] == 'w'){
}else{
mp[game][player_i][player_j-2] = 'b';
mp[game][player_i][player_j-1] = 'q';
mp[game][player_i][player_j] = ' ';
player_j = player_j-1;
}
}else if(mp[game][player_i][player_j] == 'q'){
if(mp[game][player_i-1][player_j] == ' '){
mp[game][player_i-1][player_j] = 'p';
mp[game][player_i][player_j] = 'e';
player_i = player_i-1;
}else if(mp[game][player_i-1][player_j] == 'b'){
if(mp[game][player_i-2][player_j] == 'w'){
}else if(mp[game][player_i-2][player_j] == 'e'){
mp[game][player_i-2][player_j] = 'f';
mp[game][player_i-1][player_j] = 'p';
mp[game][player_i][player_j] = 'e';
player_i = player_i-1;
}else if(mp[game][player_i-2][player_j] == 'b'){
if(mp[game][player_i-3][player_j] == 'w'){
}else if(mp[game][player_i-3][player_j] == 'e'){
mp[game][player_i-3][player_j] = 'f';
mp[game][player_i-2][player_j] = 'b';
mp[game][player_i-1][player_j] = 'p';
mp[game][player_i][player_j] = 'e';
player_i = player_i-1;
}else if(mp[game][player_i-3][player_j] == 'b'){
}else{
mp[game][player_i-3][player_j] = 'b';
mp[game][player_i-2][player_j] = 'b';
mp[game][player_i-1][player_j] = 'p';
mp[game][player_i][player_j] = 'e';
player_i = player_i-1;
}
}else{
mp[game][player_i-2][player_j] = 'b';
mp[game][player_i-1][player_j] = 'p';
mp[game][player_i][player_j] = 'e';
player_i = player_i-1;
}
}else if(mp[game][player_i-1][player_j] == 'e'){
mp[game][player_i-1][player_j] = 'q';
mp[game][player_i-1][player_j] = 'e';
player_i = player_i-1;
}else if(mp[game][player_i-1][player_j] == 'f'){
if(mp[game][player_i-2][player_j] == 'w'){
}else{
mp[game][player_i-2][player_j] = 'b';
mp[game][player_i-1][player_j] = 'q';
mp[game][player_i][player_j] = 'e';
player_i = player_i-1;
}
}
}else if(mp[game][player_i][player_j-1] == 'F'){
gt_top++;
gt[2][gt_top*2] = 'F';
mp[game][player_i][player_j-1] = 'p';
mp[game][player_i][player_j] = ' ';
player_j = player_j-1;
}
}else if(op == 'd'){
if(mp[game][player_i][player_j+1] == ' '){
mp[game][player_i][player_j+1] = 'p';
mp[game][player_i][player_j] = ' ';
player_j = player_j+1;
}else if(mp[game][player_i][player_j+1] == 'b'){
if(mp[game][player_i][player_j+2] == 'w'){
}else if(mp[game][player_i][player_j+2] == 'e'){
mp[game][player_i][player_j+2] = 'f';
mp[game][player_i][player_j+1] = 'p';
mp[game][player_i][player_j] = ' ';
player_j = player_j+1;
}else if(mp[game][player_i][player_j+2] == 'b'){
if(mp[game][player_i][player_j+3] == 'w'){
}else if(mp[game][player_i][player_j+3] == 'e'){
mp[game][player_i][player_j+3] = 'f';
mp[game][player_i][player_j+2] = 'b';
mp[game][player_i][player_j+1] = 'p';
mp[game][player_i][player_j] = ' ';
player_j = player_j+1;
}else if(mp[game][player_i][player_j+3] == 'b'){
}else{
mp[game][player_i][player_j+3] = 'b';
mp[game][player_i][player_j+2] = 'b';
mp[game][player_i][player_j+1] = 'p';
mp[game][player_i][player_j] = ' ';
player_j = player_j+1;
}
}else if(mp[game][player_i][player_j+2] == 'f'){
if(mp[game][player_i][player_j+3] == 'w'){
}else if(mp[game][player_i][player_j+3] == 'e'){
mp[game][player_i][player_j+3] = 'f';
mp[game][player_i][player_j+2] = 'f';
mp[game][player_i][player_j+1] = 'p';
mp[game][player_i][player_j] = ' ';
player_j = player_j+1;
}else if(mp[game][player_i][player_j+3] == 'b'){
}else{
mp[game][player_i][player_j+3] = 'b';
mp[game][player_i][player_j+2] = 'f';
mp[game][player_i][player_j+1] = 'p';
mp[game][player_i][player_j] = ' ';
player_j = player_j+1;
}
}else{
mp[game][player_i][player_j+2] = 'b';
mp[game][player_i][player_j+1] = 'p';
mp[game][player_i][player_j] = ' ';
player_j = player_j+1;
}
}else if(mp[game][player_i][player_j+1] == 'e'){
mp[game][player_i][player_j+1] = 'q';
mp[game][player_i][player_j] = ' ';
player_j = player_j+1;
}else if(mp[game][player_i][player_j+1] == 'f'){
if(mp[game][player_i][player_j+2] == 'w'){
}else{
mp[game][player_i][player_j+2] = 'b';
mp[game][player_i][player_j+1] = 'q';
mp[game][player_i][player_j] = ' ';
player_j = player_j+1;
}
}else if(mp[game][player_i][player_j] == 'q'){
if(mp[game][player_i-1][player_j] == ' '){
mp[game][player_i-1][player_j] = 'p';
mp[game][player_i][player_j] = 'e';
player_i = player_i-1;
}else if(mp[game][player_i-1][player_j] == 'b'){
if(mp[game][player_i-2][player_j] == 'w'){
}else if(mp[game][player_i-2][player_j] == 'e'){
mp[game][player_i-2][player_j] = 'f';
mp[game][player_i-1][player_j] = 'p';
mp[game][player_i][player_j] = 'e';
player_i = player_i-1;
}else if(mp[game][player_i-2][player_j] == 'b'){
if(mp[game][player_i-3][player_j] == 'w'){
}else if(mp[game][player_i-3][player_j] == 'e'){
mp[game][player_i-3][player_j] = 'f';
mp[game][player_i-2][player_j] = 'b';
mp[game][player_i-1][player_j] = 'p';
mp[game][player_i][player_j] = 'e';
player_i = player_i-1;
}else if(mp[game][player_i-3][player_j] == 'b'){
}else{
mp[game][player_i-3][player_j] = 'b';
mp[game][player_i-2][player_j] = 'b';
mp[game][player_i-1][player_j] = 'p';
mp[game][player_i][player_j] = 'e';
player_i = player_i-1;
}
}else{
mp[game][player_i-2][player_j] = 'b';
mp[game][player_i-1][player_j] = 'p';
mp[game][player_i][player_j] = 'e';
player_i = player_i-1;
}
}else if(mp[game][player_i-1][player_j] == 'e'){
mp[game][player_i-1][player_j] = 'q';
mp[game][player_i-1][player_j] = 'e';
player_i = player_i-1;
}else if(mp[game][player_i-1][player_j] == 'f'){
if(mp[game][player_i-2][player_j] == 'w'){
}else{
mp[game][player_i-2][player_j] = 'b';
mp[game][player_i-1][player_j] = 'q';
mp[game][player_i][player_j] = 'e';
player_i = player_i-1;
}
}
}else if(mp[game][player_i][player_j+1] == 'F'){
gt_top++;
gt[2][gt_top*2] = 'F';
mp[game][player_i][player_j+1] = 'p';
mp[game][player_i][player_j] = ' ';
player_j = player_j+1;
}
}else if(op == 'o'){
if(gt_top == 0){
cout << endl;
cout << "No Key!";
sleep(2);
system("cls");
memset(vis, 0, sizeof(vis));
cout << "level " << game << endl;
init();
cout << "Input way: ";
continue;
}
if(mp[game][player_i-1][player_j] == 'r'){
mp[game][player_i-1][player_j] = ' ';
gt[2][gt_top*2] = ' ';
gt_top--;
}else if(mp[game][player_i+1][player_j] == 'r'){
mp[game][player_i+1][player_j] = ' ';
gt[2][gt_top*2] = ' ';
gt_top--;
}else if(mp[game][player_i][player_j-1] == 'r'){
mp[game][player_i][player_j-1] = ' ';
gt[2][gt_top*2] = ' ';
gt_top--;
}else if(mp[game][player_i][player_j+1] == 'r'){
mp[game][player_i][player_j+1] = ' ';
gt[2][gt_top*2] = ' ';
gt_top--;
}else{
cout << endl;
cout << "No Door!";
sleep(2);
system("cls");
memset(vis, 0, sizeof(vis));
cout << "level " << game << endl;
init();
cout << "Input way: ";
continue;
}
}
if(check()){
system("cls");
memset(vis, 0, sizeof(vis));
init();
game++;
cout << "\n";
cout << "win!\n";
cout << "level " << game;
sleep(3);
cout << endl;
}
wi = bg[game].x;
wj = bg[game].y;
system("cls");
cout << "level " << game << endl;
init();
cout << "Input way: ";
}
}
1 个赞
这也叫推箱子!错得离谱,你给我编译个试试!
你那个编译器是Devc++?本蚂蚁明白了,你与我的编译器可能不同!