增加了休闲小游戏
#include<bits/stdc++.h>
#include<windows.h>
#include"conio.h"
using namespace std;
int d_s[4][4]={
{0,0,0,0},
{0,0,0,0},
{0,0,0,0},
{0,0,0,0},
},d_s_a[4][4]={
{0,0,0,0},
{0,0,0,0},
{0,0,0,0},
{0,0,0,0},
},z_g,s_j_x,s_j_s,s_y_k_w=16,z_d_x,z_d_y,l_x=18,l_y=18,h_x=1,h_y=1,h_dd=2,l_dd=5,s_j;
bool s_c_c_g=false,h_s_f_s_l=false,l_s_f_s_l=false,js=false;
double r_w_j_d=0;
char n,l_a_j[5]={'i','j','k','l','o'},hw='w',h_a_j[4]={'w','a','s','d'};
string d_t="无";
int y_x_a[20][20],y_x_d_t[20][20],s_m_a[20][20]={
{1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1},
{1,2,5,0,0,0,0,0,1,1,1,0,0,0,0,0,0,0,0,1},
{1,5,5,1,1,0,0,0,0,0,0,0,0,0,13,0,0,0,0,1},
{1,4,13,4,0,0,1,0,1,0,4,4,4,0,1,1,0,0,4,1},
{1,15,4,4,10,0,17,0,1,0,0,0,0,0,0,0,0,1,12,1},
{1,0,4,4,0,0,0,0,0,0,1,0,1,0,0,1,0,1,0,1},
{1,7,0,0,0,0,20,0,1,1,1,0,20,1,1,1,0,1,0,1},
{1,0,0,0,11,0,0,0,1,0,0,0,0,0,0,12,0,1,0,1},
{1,0,1,0,0,6,0,0,1,18,0,0,9,1,1,0,0,12,1,1},
{1,0,0,0,7,0,9,0,0,0,1,14,1,0,0,0,0,0,6,1},
{1,0,1,1,1,1,1,6,0,1,4,0,1,14,0,0,0,0,0,1},
{1,0,0,0,0,0,12,0,0,0,0,0,0,0,0,0,1,0,0,1},
{1,0,1,0,0,0,0,1,0,1,0,0,0,11,0,16,0,0,9,1},
{1,0,1,0,6,0,0,0,0,0,19,0,6,0,0,0,1,0,0,1},
{1,0,1,6,0,4,0,1,0,1,0,0,0,4,0,0,1,1,14,1},
{1,0,0,0,0,0,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,11,1,0,1,},{
1,0,1,1,1,0,1,0,1,0,1,1,1,1,1,0,1,1,1,0,1,},{
1,0,0,0,0,0,1,0,1,0,0,0,1,6,1,0,0,0,0,0,1,},{
1,0,1,1,1,1,1,0,1,1,1,0,1,0,1,1,1,1,1,1,1,},{
1,11,1,0,0,0,1,0,0,0,-1,0,1,0,0,0,1,0,0,0,1,},{
1,1,1,0,1,11,1,1,1,0,1,0,1,1,1,0,1,0,1,0,1,},{
1,0,0,0,1,0,0,0,0,0,1,0,0,0,1,0,0,0,1,0,1,},{
1,0,1,1,1,1,1,1,1,0,1,1,1,0,1,0,1,1,1,0,1,},{
1,0,1,0,0,0,0,0,0,0,1,0,0,0,1,0,0,0,1,0,1,},{
1,0,1,-1,1,0,1,1,1,0,1,0,1,1,1,1,1,1,11,0,1,},{
1,0,0,0,1,0,0,0,1,0,1,0,1,0,0,0,0,0,1,0,1,},{
1,0,1,0,1,0,6,0,1,1,1,0,1,0,1,1,1,0,5,5,1,},{
1,11,1,0,0,0,1,0,0,0,0,0,0,0,1,0,0,0,5,0,1,},{
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,},
};
void s_c(char *m)
{
while(1)
{
if(*m!=0)
printf("%c",*m++);
else
break;
Sleep(100);
}
cout<<endl;
}
void y_x_c_s_h()
{
r_w_j_d=0,l_x=18,l_y=18,h_x=1,h_y=1,h_dd=2,l_dd=5,h_s_f_s_l=false,l_s_f_s_l=false,js=false;
for(int i=0;i<=19;i++)
for(int y=0;y<=19;y++)
s_m_a[i][y]=s_m_d_t[i][y];
s_m_a[1][1]=2,s_m_a[18][18]=3;
for(int i=0;i<=19;i++)
for(int y=0;y<=19;y++)
h_g_c_a[i][y]=h_g_c_d_t[i][y];
h_g_c_a[1][1]=2,h_g_c_a[18][18]=3;
for(int i=0;i<=19;i++)
for(int y=0;y<=19;y++)
j_j_c_a[i][y]=j_j_c_d_t[i][y];
j_j_c_a[1][1]=2,j_j_c_a[19][19]=3;
}
void color(int x)
{
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), x);
}
void j_b()
{
system("cls");
color(2);
cout<<"蓝方惊变 红方获胜"<<endl;
cout<<"蓝方进度:"<<r_w_j_d<<"%"<<endl;
js=true;
}
void h_sl()
{
system("cls");
color(4);
cout<<"红方获胜"<<endl;
cout<<"蓝方进度:"<<r_w_j_d<<"%"<<endl;
js=true;
}
void l_sl()
{
system("cls");
color(9);
cout<<"蓝方获胜"<<endl;
if(s_m_a[l_y-1][l_x-1]==2||s_m_a[l_y][l_x-1]==2||s_m_a[l_y+1][l_x-1]==2||s_m_a[l_y-1][l_x]==2||s_m_a[l_y+1][l_x-1]==2||s_m_a[l_y-1][l_x+1]==2||s_m_a[l_y][l_x+1]==2||s_m_a[l_y+1][l_x+1]==2)
cout<<"差一丢丢就抓到了"<<endl;
js=true;
}
void sq()
{
HANDLE handle = GetStdHandle(STD_OUTPUT_HANDLE);
CONSOLE_CURSOR_INFO CursorInfo;
GetConsoleCursorInfo(handle, &CursorInfo);
CursorInfo.bVisible = false;
SetConsoleCursorInfo(handle, &CursorInfo);
}
void f_c_m()
{
system("cls");
cout<<"\n\n\n\n\n\n\n\n";
cout<<" 健康游戏忠告"<<endl<<endl;
cout<<" 抵制不良游戏,拒绝盗版游戏。"<<endl;
cout<<" 注意自我保护,谨防受骗上当。"<<endl;
cout<<" 适宜游戏易脑,沉迷游戏伤身。"<<endl;
cout<<" 合理安排时间,享受健康生活。"<<endl;
Sleep(5000);
}
void l_s_z(int p)
{
system("cls");
cout<<"请你输入该按键想更改的按键:";
n=getch();
l_a_j[p]=n;
system("cls");
}
void h_s_z(int p)
{
system("cls");
cout<<"请你输入该按键想更改的按键:";
n=getch();
h_a_j[p]=n;
system("cls");
}
void s_z()
{
for(;;)
{
system("cls");
cout<<"\n\n\n\n\n\n\n\n";
cout<<" 1.更改蓝按键"<<endl;
cout<<" 2.更改红按键"<<endl;
cout<<" 0.退出"<<endl;
n=getch();
if(n=='1')
{
for(;;)
{
system("cls");
cout<<"\n\n\n\n\n\n\n\n";
cout<<" 1.改蓝上键"<<endl;
cout<<" 2.改蓝下键"<<endl;
cout<<" 3.改蓝左键"<<endl;
cout<<" 4.改蓝右键"<<endl;
cout<<" 5.改蓝任务键"<<endl;
cout<<" 0.退出"<<endl;
n=getch();
if(n>='1'&&n<='5')
l_s_z(int(n)-49);
else if(n=='0')
break;
}
}else if(n=='2')
{
for(;;)
{
system("cls");
cout<<"\n\n\n\n\n\n\n\n";
cout<<" 1.改红上键"<<endl;
cout<<" 2.改红下键"<<endl;
cout<<" 3.改红左键"<<endl;
cout<<" 4.改红右键"<<endl;
cout<<" 0.退出"<<endl;
n=getch();
if(n>='1'&&n<='4')
h_s_z(int(n)-49);
else if(n=='0')
break;
}
}else if(n=='0')
break;
}
}
void game()
{
for(;;)
{
system("cls");
if(d_t!="竞技场"&&d_t!="随机地图")
for(int i=0;i<=19;i++)
{
for(int y=0;y<=19;y++)
{
if(d_t=="沙漠")
{
if(y_x_a[i][y]==2)
{
if(h_s_f_s_l==false)
color(228);
else
{
if(y_x_d_t[i][y]==4)
color(116);
else if(y_x_d_t[i][y]==1)
color(100);
}
cout<<"●";
}
else if(y_x_a[i][y]==1)
{
color(102);
cout<<"■";
}
else if(y_x_a[i][y]==3)
{
if(l_s_f_s_l==false)
color(225);
else{
if(y_x_d_t[i][y]==4)
color(113);
else if(y_x_d_t[i][y]==1)
color(97);
}
cout<<"●";
}
else if(y_x_a[i][y]==4)
{
color(120);
cout<<"×";
}else if(y_x_a[i][y]==5)
{
color(231);
cout<<"○";
}else if(y_x_a[i][y]==6)
{
color(234);
cout<<"**";
}else if(y_x_a[i][y]==7)
{
color(230);
cout<<"◣";
}else if(y_x_a[i][y]==9)
{
color(230);
cout<<"◢";
}else if(y_x_a[i][y]==20)
{
color(230);
cout<<"◥";
}else if(y_x_a[i][y]==10)
{
color(230);
cout<<"◤";
}else if(y_x_a[i][y]==11)
{
color(999);
cout<<"Π";
}else if(y_x_a[i][y]==12)
{
color(999);
cout<<"↑";
}else if(y_x_a[i][y]==13)
{
color(999);
cout<<"↓";
}else if(y_x_a[i][y]==14)
{
color(999);
cout<<"←";
}else if(y_x_a[i][y]==15)
{
color(999);
cout<<"→";
}else if(y_x_a[i][y]==16)
{
color(228);
cout<<"[]";
}else if(y_x_a[i][y]==17)
{
color(228);
cout<<"[]";
}else if(y_x_a[i][y]==18)
{
color(1001);
cout<<"()";
}else if(y_x_a[i][y]==19)
{
color(1001);
cout<<"()";
}
else
{
color(238);
cout<<"■";
}
}else if(d_t=="化工厂")
{
if(y_x_a[i][y]==2)
{
if(h_s_f_s_l==false)
color(36);
else{
if(y_x_d_t[i][y]==4)
color(116);
else if(y_x_d_t[i][y]==1)
color(164);
}
cout<<"●";
}
else if(y_x_a[i][y]==1)
{
color(170);
cout<<"■";
}
else if(y_x_a[i][y]==3)
{
if(l_s_f_s_l==false)
color(41);
else{
if(y_x_d_t[i][y]==4)
color(113);
else if(y_x_d_t[i][y]==1)
color(169);
}
cout<<"●";
}
else if(y_x_a[i][y]==4)
{
color(120);
cout<<"×";
}else if(y_x_a[i][y]==5)
{
color(40);
cout<<"○";
}else if(y_x_a[i][y]==7)
{
color(42);
cout<<"◣";
}else if(y_x_a[i][y]==9)
{
color(42);
cout<<"◢";
}else if(y_x_a[i][y]==6)
{
color(42);
cout<<"**";
}else if(y_x_a[i][y]==20)
{
color(42);
cout<<"◥";
}else if(y_x_a[i][y]==10)
{
color(42);
cout<<"◤";
}else if(y_x_a[i][y]==11)
{
color(40);
cout<<"Π";
}else if(y_x_a[i][y]==12)
{
color(40);
cout<<"↑";
}else if(y_x_a[i][y]==13)
{
color(40);
cout<<"↓";
}else if(y_x_a[i][y]==14)
{
color(40);
cout<<"←";
}else if(y_x_a[i][y]==15)
{
color(40);
cout<<"→";
}else
{
color(34);
cout<<"■";
}
}else if(d_t=="竞技场")
{
if(y_x_a[i][y]==1)
{
color(119);
cout<<"■";
}
else if(y_x_a[i][y]==0)
{
color(136);
cout<<"■";
}else if(y_x_a[i][y]==5)
{
color(135);
cout<<"○";
}else if(y_x_a[i][y]==2)
{
color(132);
cout<<"●";
}else if(y_x_a[i][y]==3)
{
color(137);
cout<<"●";
}
}
}
cout<<endl;
}
else
{
for(int i=0;i<=20;i++)
{
for(int y=0;y<=20;y++)
{
if(y_x_a[i][y]==1)
{
color(119);
cout<<"■";
}
else if(y_x_a[i][y]==0)
{
color(136);
cout<<"■";
}else if(y_x_a[i][y]==5)
{
color(135);
cout<<"○";
}else if(y_x_a[i][y]==2)
{
color(132);
cout<<"●";
}else if(y_x_a[i][y]==3)
{
color(137);
cout<<"●";
}else if(y_x_a[i][y]==6)
{
color(138);
cout<<"**";
}else if(y_x_a[i][y]==11)
{
color(131);
cout<<"Π";
}
}
cout<<endl;
}
}
color(7);
cout<<"蓝任务进度:"<<r_w_j_d<<"%"<<endl;
cout<<"红剩余"<<h_dd<<"次传送机会"<<endl<<"蓝剩余"<<l_dd<<"次传送机会"<<endl;
if(n>='A'&&n<='Z')
cout<<"请切换小写英文模式(按“Caps look”键)"<<endl;
n=getch();
if(n==h_a_j[0])
{
if(y_x_a[h_y-1][h_x]==3&&y_x_d_t[h_y][h_x]==12)
h_sl();
else if(y_x_a[h_y-1][h_x]==3&&l_s_f_s_l==false)
h_sl();
else if(y_x_a[h_y-1][h_x]==3&&l_s_f_s_l==true&&h_s_f_s_l==true)
h_sl();
else if(y_x_d_t[h_y-1][h_x]==16||y_x_d_t[h_y-1][h_x]==17)
{
if(h_dd>0)
if(y_x_d_t[h_y-1][h_x]==16&&y_x_a[4][7]!=3)
{
y_x_a[4][7]=2;
y_x_a[h_y][h_x]=y_x_d_t[h_y][h_x];
h_y=4;
h_x=7;
h_s_f_s_l=false;
h_dd--;
}else{
if(y_x_a[12][14]!=3)
{
y_x_a[12][14]=2;
y_x_a[h_y][h_x]=y_x_d_t[h_y][h_x];
h_y=12;
h_x=14;
h_s_f_s_l=false;
h_dd--;
}
}
}else if(h_s_f_s_l==false&&y_x_a[h_y-1][h_x]!=1&&y_x_a[h_y-1][h_x]!=4&&y_x_a[h_y-1][h_x]!=11&&y_x_a[h_y-1][h_x]!=10&&y_x_a[h_y-1][h_x]!=20&&y_x_a[h_y-1][h_x]!=7&&y_x_a[h_y-1][h_x]!=9)
{
if(y_x_a[h_y-1][h_x]==3&&(l_s_f_s_l!=true||h_s_f_s_l==true))
{
y_x_a[h_y-1][h_x]=2;
y_x_a[h_y][h_x]=y_x_d_t[h_y][h_x];
h_y--;
}else if(y_x_a[h_y-1][h_x]!=3)
{
y_x_a[h_y-1][h_x]=2;
y_x_a[h_y][h_x]=y_x_d_t[h_y][h_x];
h_y--;
}
}else if(y_x_a[h_y-1][h_x]!=10&&y_x_a[h_y-1][h_x]!=7&&y_x_a[h_y-1][h_x]!=9&&y_x_a[h_y-1][h_x]!=20&&(y_x_d_t[h_y][h_x]==12||y_x_d_t[h_y][h_x]==1||y_x_d_t[h_y][h_x]==4))
{
y_x_a[h_y-1][h_x]=2;
y_x_a[h_y][h_x]=y_x_d_t[h_y][h_x];
h_y--;
h_s_f_s_l=true;
}
}else if(n==h_a_j[2])
{
if(y_x_a[h_y+1][h_x]==3&&y_x_d_t[h_y][h_x]==13)
h_sl();
else if(y_x_a[h_y+1][h_x]==3&&l_s_f_s_l==false)
h_sl();
else if(y_x_a[h_y+1][h_x]==3&&l_s_f_s_l==true&&h_s_f_s_l==true)
h_sl();
else if(y_x_d_t[h_y+1][h_x]==16||y_x_d_t[h_y+1][h_x]==17)
{
if(h_dd>0)
if(y_x_d_t[h_y+1][h_x]==16&&y_x_a[4][7]!=3)
{
y_x_a[4][7]=2;
y_x_a[h_y][h_x]=y_x_d_t[h_y][h_x];
h_y=4;
h_x=7;
h_s_f_s_l=false;
h_dd--;
}else{
if(y_x_a[12][14]!=3)
{
y_x_a[12][14]=2;
y_x_a[h_y][h_x]=y_x_d_t[h_y][h_x];
h_y=12;
h_x=14;
h_s_f_s_l=false;
h_dd--;
}
}
}else if(h_s_f_s_l==false&&y_x_a[h_y+1][h_x]!=1&&y_x_a[h_y+1][h_x]!=4&&y_x_a[h_y+1][h_x]!=11&&y_x_a[h_y+1][h_x]!=10&&y_x_a[h_y+1][h_x]!=20&&y_x_a[h_y+1][h_x]!=7&&y_x_a[h_y+1][h_x]!=9)
{
if(y_x_a[h_y+1][h_x]==3&&(l_s_f_s_l!=true||h_s_f_s_l==true))
{
y_x_a[h_y+1][h_x]=2;
y_x_a[h_y][h_x]=y_x_d_t[h_y][h_x];
h_y++;
}else if(y_x_a[h_y+1][h_x]!=3)
{
y_x_a[h_y+1][h_x]=2;
y_x_a[h_y][h_x]=y_x_d_t[h_y][h_x];
h_y++;
}
}else if(y_x_a[h_y+1][h_x]!=10&&y_x_a[h_y+1][h_x]!=7&&y_x_a[h_y+1][h_x]!=9&&y_x_a[h_y+1][h_x]!=20&&(y_x_d_t[h_y][h_x]==13||y_x_d_t[h_y][h_x]==1||y_x_d_t[h_y][h_x]==4))
{
y_x_a[h_y+1][h_x]=2;
y_x_a[h_y][h_x]=y_x_d_t[h_y][h_x];
h_y++;
h_s_f_s_l=true;
}
}else if(n==h_a_j[1])
{
if(y_x_a[h_y][h_x-1]==3&&y_x_d_t[h_y][h_x]==14)
h_sl();
else if(y_x_a[h_y][h_x-1]==3&&l_s_f_s_l==false)
h_sl();
else if(y_x_a[h_y][h_x-1]==3&&l_s_f_s_l==true&&h_s_f_s_l==true)
h_sl();
else if(y_x_d_t[h_y][h_x-1]==16||y_x_d_t[h_y][h_x-1]==17)
{
if(h_dd>0)
if(y_x_d_t[h_y][h_x-1]==16&&y_x_a[4][7]!=3)
{
y_x_a[4][7]=2;
y_x_a[h_y][h_x]=y_x_d_t[h_y][h_x];
h_y=4;
h_x=7;
h_s_f_s_l=false;
h_dd--;
}else{
if(y_x_a[12][14]!=3)
{
y_x_a[12][14]=2;
y_x_a[h_y][h_x]=y_x_d_t[h_y][h_x];
h_y=12;
h_x=14;
h_s_f_s_l=false;
h_dd--;
}
}
}else if(h_s_f_s_l==false&&y_x_a[h_y][h_x-1]!=1&&y_x_a[h_y][h_x-1]!=4&&y_x_a[h_y][h_x-1]!=11&&y_x_a[h_y][h_x-1]!=10&&y_x_a[h_y][h_x-1]!=20&&y_x_a[h_y][h_x-1]!=7&&y_x_a[h_y][h_x-1]!=9)
{
if(y_x_a[h_y][h_x-1]==3&&(l_s_f_s_l!=true||h_s_f_s_l==true))
{
y_x_a[h_y][h_x-1]=2;
y_x_a[h_y][h_x]=y_x_d_t[h_y][h_x];
h_x--;
}else if(y_x_a[h_y][h_x-1]!=3)
{
y_x_a[h_y][h_x-1]=2;
y_x_a[h_y][h_x]=y_x_d_t[h_y][h_x];
h_x--;
}
}else if(y_x_a[h_y][h_x-1]!=10&&y_x_a[h_y][h_x-1]!=7&&y_x_a[h_y][h_x-1]!=9&&y_x_a[h_y][h_x-1]!=20&&(y_x_d_t[h_y][h_x]==14||y_x_d_t[h_y][h_x]==1||y_x_d_t[h_y][h_x]==4))
{
y_x_a[h_y][h_x-1]=2;
y_x_a[h_y][h_x]=y_x_d_t[h_y][h_x];
h_x--;
h_s_f_s_l=true;
}
}
else if(n==h_a_j[3])
{
if(y_x_a[h_y][h_x+1]==3&&y_x_d_t[h_y][h_x]==15)
h_sl();
else if(y_x_a[h_y][h_x+1]==3&&l_s_f_s_l==false)
h_sl();
else if(y_x_a[h_y][h_x+1]==3&&l_s_f_s_l==true&&h_s_f_s_l==true)
h_sl();
else if(y_x_d_t[h_y][h_x+1]==16||y_x_d_t[h_y][h_x+1]==17)
{
if(h_dd>0)
if(y_x_d_t[h_y][h_x+1]==16&&y_x_a[4][7]!=3)
{
y_x_a[4][7]=2;
y_x_a[h_y][h_x]=y_x_d_t[h_y][h_x];
h_y=4;
h_x=7;
h_s_f_s_l=false;
h_dd--;
}else{
if(y_x_a[12][14]!=3)
{
y_x_a[12][14]=2;
y_x_a[h_y][h_x]=y_x_d_t[h_y][h_x];
h_y=12;
h_x=14;
h_s_f_s_l=false;
h_dd--;
}
}
}else if(h_s_f_s_l==false&&y_x_a[h_y][h_x+1]!=1&&y_x_a[h_y][h_x+1]!=4&&y_x_a[h_y][h_x+1]!=11&&y_x_a[h_y][h_x+1]!=10&&y_x_a[h_y][h_x+1]!=20&&y_x_a[h_y][h_x+1]!=7&&y_x_a[h_y][h_x+1]!=9)
{
if(y_x_a[h_y][h_x+1]==3&&(l_s_f_s_l!=true||h_s_f_s_l==true))
{
y_x_a[h_y][h_x+1]=2;
y_x_a[h_y][h_x]=y_x_d_t[h_y][h_x];
h_x++;
}else if(y_x_a[h_y][h_x+1]!=3)
{
y_x_a[h_y][h_x+1]=2;
y_x_a[h_y][h_x]=y_x_d_t[h_y][h_x];
h_x++;
}
}else if(y_x_a[h_y][h_x+1]!=10&&y_x_a[h_y][h_x+1]!=7&&y_x_a[h_y][h_x+1]!=9&&y_x_a[h_y+1][h_x]!=20&&(y_x_d_t[h_y][h_x]==15||y_x_d_t[h_y][h_x]==1||y_x_d_t[h_y][h_x]==4))
{
y_x_a[h_y][h_x+1]=2;
y_x_a[h_y][h_x]=y_x_d_t[h_y][h_x];
h_x++;
h_s_f_s_l=true;
}
}else if(n==l_a_j[0])
{
if(y_x_d_t[l_y-1][l_x]==18||y_x_d_t[l_y-1][l_x]==19)
{
if(l_dd>0)
if(y_x_d_t[l_y-1][l_x]==18)
{
y_x_a[13][9]=3;
y_x_a[l_y][l_x]=y_x_d_t[l_y][l_x];
l_y=13;
l_x=9;
l_s_f_s_l=false;
l_dd--;
}else{
y_x_a[9][9]=3;
y_x_a[l_y][l_x]=y_x_d_t[l_y][l_x];
l_y=9;
l_x=9;
l_s_f_s_l=false;
l_dd--;
}
}else if(l_s_f_s_l==false&&y_x_a[l_y-1][l_x]!=1&&y_x_a[l_y-1][l_x]!=4&&y_x_a[l_y-1][l_x]!=11&&y_x_a[l_y-1][l_x]!=10&&y_x_a[l_y-1][l_x]!=20&&y_x_a[l_y-1][l_x]!=7&&y_x_a[l_y-1][l_x]!=9&&y_x_a[l_y-1][l_x]!=2&&y_x_a[l_y-1][l_x]!=16&&y_x_a[l_y-1][l_x]!=17)
{
y_x_a[l_y-1][l_x]=3;
y_x_a[l_y][l_x]=y_x_d_t[l_y][l_x];
l_y--;
}else if(y_x_a[l_y-1][l_x]!=10&&y_x_a[l_y-1][l_x]!=7&&y_x_a[l_y-1][l_x]!=9&&y_x_a[l_y-1][l_x]!=20&&(y_x_d_t[l_y][l_x]==12||y_x_d_t[l_y][l_x]==1||y_x_d_t[l_y][l_x]==4)&&y_x_a[l_y-1][l_x]!=2)
{
y_x_a[l_y-1][l_x]=3;
y_x_a[l_y][l_x]=y_x_d_t[l_y][l_x];
l_y--;
l_s_f_s_l=true;
}
}
else if(n==l_a_j[2])
{
if(y_x_d_t[l_y+1][l_x]==18||y_x_d_t[l_y+1][l_x]==19)
{
if(l_dd>0)
if(y_x_d_t[l_y+1][l_x]==18)
{
y_x_a[13][9]=3;
y_x_a[l_y][l_x]=y_x_d_t[l_y][l_x];
l_y=13;
l_x=9;
l_s_f_s_l=false;
l_dd--;
}else{
y_x_a[9][9]=3;
y_x_a[l_y][l_x]=y_x_d_t[l_y][l_x];
l_y=9;
l_x=9;
l_s_f_s_l=false;
l_dd--;
}
}else if(l_s_f_s_l==false&&y_x_a[l_y+1][l_x]!=1&&y_x_a[l_y+1][l_x]!=4&&y_x_a[l_y+1][l_x]!=11&&y_x_a[l_y+1][l_x]!=10&&y_x_a[l_y+1][l_x]!=20&&y_x_a[l_y+1][l_x]!=7&&y_x_a[l_y+1][l_x]!=9&&y_x_a[l_y+1][l_x]!=2&&y_x_a[l_y+1][l_x]!=16&&y_x_a[l_y+1][l_x]!=17)
{
y_x_a[l_y+1][l_x]=3;
y_x_a[l_y][l_x]=y_x_d_t[l_y][l_x];
l_y++;
}else if(y_x_a[l_y+1][l_x]!=10&&y_x_a[l_y+1][l_x]!=7&&y_x_a[l_y+1][l_x]!=9&&y_x_a[l_y+1][l_x]!=20&&(y_x_d_t[l_y][l_x]==13||y_x_d_t[l_y][l_x]==1||y_x_d_t[l_y][l_x]==4)&&y_x_a[l_y+1][l_x]!=2)
{
y_x_a[l_y+1][l_x]=3;
y_x_a[l_y][l_x]=y_x_d_t[l_y][l_x];
l_y++;
l_s_f_s_l=true;
}
}
else if(n==l_a_j[1])
{
if(y_x_d_t[l_y][l_x-1]==18||y_x_d_t[l_y][l_x-1]==19)
{
if(l_dd>0)
if(y_x_d_t[l_y][l_x-1]==18)
{
y_x_a[13][9]=3;
y_x_a[l_y][l_x]=y_x_d_t[l_y][l_x];
l_y=13;
l_x=9;
l_s_f_s_l=false;
l_dd--;
}else{
y_x_a[9][9]=3;
y_x_a[l_y][l_x]=y_x_d_t[l_y][l_x];
l_y=9;
l_x=9;
l_s_f_s_l=false;
l_dd--;
}
}else if(l_s_f_s_l==false&&y_x_a[l_y][l_x-1]!=1&&y_x_a[l_y][l_x-1]!=4&&y_x_a[l_y][l_x-1]!=11&&y_x_a[l_y][l_x-1]!=10&&y_x_a[l_y][l_x-1]!=20&&y_x_a[l_y][l_x-1]!=7&&y_x_a[l_y][l_x-1]!=9&&y_x_a[l_y][l_x-1]!=2&&y_x_a[l_y][l_x-1]!=16&&y_x_a[l_y][l_x-1]!=17)
{
y_x_a[l_y][l_x-1]=3;
y_x_a[l_y][l_x]=y_x_d_t[l_y][l_x];
l_x--;
}else if(y_x_a[l_y][l_x-1]!=10&&y_x_a[l_y][l_x-1]!=7&&y_x_a[l_y][l_x-1]!=9&&y_x_a[l_y][l_x-1]!=20&&(y_x_d_t[l_y][l_x]==14||y_x_d_t[l_y][l_x]==1||y_x_d_t[l_y][l_x]==4)&&y_x_a[l_y][l_x-1]!=2)
{
y_x_a[l_y][l_x-1]=3;
y_x_a[l_y][l_x]=y_x_d_t[l_y][l_x];
l_x--;
l_s_f_s_l=true;
}
}
else if(n==l_a_j[3])
{
if(y_x_d_t[l_y][l_x+1]==18||y_x_d_t[l_y][l_x+1]==19)
{
if(l_dd>0)
if(y_x_d_t[l_y][l_x+1]==18)
{
y_x_a[13][9]=3;
y_x_a[l_y][l_x]=y_x_d_t[l_y][l_x];
l_y=13;
l_x=9;
l_s_f_s_l=false;
l_dd--;
}else{
y_x_a[9][9]=3;
y_x_a[l_y][l_x]=y_x_d_t[l_y][l_x];
l_y=9;
l_x=9;
l_s_f_s_l=false;
l_dd--;
}
}else if(l_s_f_s_l==false&&y_x_a[l_y][l_x+1]!=1&&y_x_a[l_y][l_x+1]!=4&&y_x_a[l_y][l_x+1]!=11&&y_x_a[l_y][l_x+1]!=10&&y_x_a[l_y][l_x+1]!=20&&y_x_a[l_y][l_x+1]!=7&&y_x_a[l_y][l_x+1]!=9&&y_x_a[l_y][l_x+1]!=2&&y_x_a[l_y][l_x+1]!=16&&y_x_a[l_y][l_x+1]!=17)
{
y_x_a[l_y][l_x+1]=3;
y_x_a[l_y][l_x]=y_x_d_t[l_y][l_x];
l_x++;
}else if(y_x_a[l_y][l_x+1]!=10&&y_x_a[l_y][l_x+1]!=7&&y_x_a[l_y][l_x+1]!=9&&y_x_a[l_y+1][l_x]!=20&&(y_x_d_t[l_y][l_x]==15||y_x_d_t[l_y][l_x]==1||y_x_d_t[l_y][l_x]==4)&&y_x_a[l_y][l_x+1]!=2)
{
y_x_a[l_y][l_x+1]=3;
y_x_a[l_y][l_x]=y_x_d_t[l_y][l_x];
l_x++;
l_s_f_s_l=true;
}
}else if(n=='o')
{
if(y_x_a[l_y-1][l_x-1]==11||y_x_a[l_y][l_x-1]==11||y_x_a[l_y+1][l_x-1]==11||y_x_a[l_y-1][l_x]==11||y_x_a[l_y+1][l_x-1]==11||y_x_a[l_y-1][l_x+1]==11||y_x_a[l_y][l_x+1]==11||y_x_a[l_y+1][l_x+1]==11)
{
r_w_j_d+=2;
if(r_w_j_d>=100)
l_sl();
}
}
if(y_x_d_t[h_y][h_x]==0||y_x_d_t[h_y][h_x]==12||y_x_d_t[h_y][h_x]==13||y_x_d_t[h_y][h_x]==14||y_x_d_t[h_y][h_x]==15||y_x_d_t[h_y][h_x]==6||y_x_d_t[h_y][h_x]==5)
{
h_s_f_s_l=false;
}
if(y_x_d_t[l_y][l_x]==0||y_x_d_t[l_y][l_x]==12||y_x_d_t[l_y][l_x]==13||y_x_d_t[l_y][l_x]==14||y_x_d_t[l_y][l_x]==15||y_x_d_t[l_y][l_x]==6||y_x_d_t[l_y][l_x]==5)
{
l_s_f_s_l=false;
}
if(y_x_d_t[l_y][l_x]==6)
j_b();
if(js==true)
{
cout<<"按“r”键继续";
for(;;)
{
n=getch();
if(n=='r')
{
y_x_c_s_h();
return ;
}
}
}
}
}
void s_m()
{
for(int i=0;i<=19;i++)
for(int y=0;y<=19;y++)
{
y_x_a[i][y]=s_m_a[i][y];
y_x_d_t[i][y]=s_m_d_t[i][y];
}
}
void h_g_c()
{
for(int i=0;i<=19;i++)
for(int y=0;y<=19;y++)
{
y_x_a[i][y]=h_g_c_a[i][y];
y_x_d_t[i][y]=h_g_c_d_t[i][y];
}
}
void j_j_c()
{
for(int i=0;i<=19;i++)
for(int y=0;y<=19;y++)
{
y_x_a[i][y]=j_j_c_a[i][y];
y_x_d_t[i][y]=j_j_c_d_t[i][y];
}
}
void s_j_s_s_c()//生成随机数
{
for(;s_c_c_g==false;)
{
for(int i=0;i<4;i++)
{
for(int y=0;y<4;y++)
{
if(d_s[i][y]==0)
{
s_j_x=rand()%s_y_k_w+1;
if(s_j_x==1)
{
s_j_s=rand()%2+1;
if(s_j_s==2)d_s[i][y]=4;
else d_s[i][y]=2;
s_y_k_w--;
s_c_c_g=true;
break;
}
}
}
if(s_c_c_g==true)break;
}
}
s_c_c_g=false;
}
void y_s(int x)
{
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), x);
}
void h_z()//绘制界面
{
for(int i=0;i<4;i++)
{
for(int y=0;y<4;y++)
{
if(d_s[i][y]==0)
{
y_s(1);
cout<<"00";
}else if(d_s[i][y]==2)
{
y_s(2);
cout<<"01";
}else if(d_s[i][y]==4)
{
y_s(3);
cout<<"02";
}else if(d_s[i][y]==8)
{
y_s(4);
cout<<"03";
}else if(d_s[i][y]==16)
{
y_s(5);
cout<<"04";
}else if(d_s[i][y]==32)
{
y_s(6);
cout<<"05";
}else if(d_s[i][y]==64)
{
y_s(7);
cout<<"06";
}else if(d_s[i][y]==128)
{
y_s(8);
cout<<"07";
}else if(d_s[i][y]==256)
{
y_s(9);
cout<<"08";
}else if(d_s[i][y]==512)
{
y_s(10);
cout<<"09";
}else if(d_s[i][y]==1024)
{
y_s(11);
cout<<"10";
}else if(d_s[i][y]==2048)
{
y_s(12);
cout<<"11";
}else if(d_s[i][y]==4096)
{
y_s(13);
cout<<"12";
}else if(d_s[i][y]==8192)
{
y_s(14);
cout<<"13";
}else if(d_s[i][y]==16384)
{
y_s(15);
cout<<"14";
}
}
printf("\n");
}
y_s(7);
cout<<"按‘0’键退出"<<endl<<"当前最高分:";
if(z_g==0)
{
cout<<"00";
}else if(z_g==2)
{
cout<<"01";
}else if(z_g==4)
{
cout<<"02";
}else if(z_g==8)
{
cout<<"03";
}else if(z_g==16)
{
cout<<"04";
}else if(z_g==32)
{
cout<<"05";
}else if(z_g==64)
{
cout<<"06";
}else if(z_g==128)
{
cout<<"07";
}else if(z_g==256)
{
cout<<"08";
}else if(z_g==512)
{
cout<<"09";
}else if(z_g==1024)
{
cout<<"10";
}else if(z_g==2048)
{
cout<<"11";
}else if(z_g==4096)
{
cout<<"12";
}else if(z_g==8192)
{
cout<<"13";
}else if(z_g==16384)
{
cout<<"14";
}
}
void s_l_j_l()//游戏开始
{
s_j_s_s_c();
s_j_s_s_c();
for(;;)
{
for(int i=0;i<4;i++)
for(int y=0;y<4;y++)
if(d_s[i][y]>=z_g)
z_g=d_s[i][y];
if(s_y_k_w>0&&(n==72||n==75||n==80||n==77))s_j_s_s_c();
system("cls");
h_z();
n=getch();
if(n=='0')
{
system("cls");
break;
}
if(n==72)
{
for(int i=0;i<4;i++)
{
for(int y=0;y<4;y++)
{
if(d_s[i][y]!=0)
{
if(i==3)
{
if(d_s[i-1][y]==0)
{
if(d_s[i-3][y]==d_s[i][y]&&d_s[i-2][y]==0&&d_s[i-1][y]==0)
{
d_s[i-3][y]*=2;
s_y_k_w++;
d_s[i][y]=0;
}
else if(d_s[i-2][y]==d_s[i][y]&&d_s[i-1][y]==0)
{
d_s[i-2][y]*=2;
s_y_k_w++;
d_s[i][y]=0;
}
else if(d_s[i-3][y]==0&&d_s[i-2][y]==0&&d_s[i-1][y]==0)swap(d_s[i][y],d_s[i-3][y]);
else if(d_s[i-2][y]==0&&d_s[i-1][y]==0)swap(d_s[i][y],d_s[i-2][y]);
else swap(d_s[i][y],d_s[i-1][y]);
}else if(d_s[i-1][y]==d_s[i][y])
{
d_s[i-1][y]*=2;
s_y_k_w++;
d_s[i][y]=0;
}
}else if(i==2)
{
if(d_s[i-1][y]==0)
{
if(d_s[i-2][y]==d_s[i][y]&&d_s[i-1][y]==0)
{
d_s[i-2][y]*=2;
s_y_k_w++;
d_s[i][y]=0;
}
else if(d_s[i-2][y]==0&&d_s[i-1][y]==0)swap(d_s[i][y],d_s[i-2][y]);
else swap(d_s[i][y],d_s[i-1][y]);
}else if(d_s[i-1][y]==d_s[i][y])
{
d_s[i-1][y]*=2;
s_y_k_w++;
d_s[i][y]=0;
}
}else if(i==1)
{
if(d_s[i-1][y]==0)
{
swap(d_s[i][y],d_s[i-1][y]);
}else if(d_s[i-1][y]==d_s[i][y])
{
d_s[i-1][y]*=2;
s_y_k_w++;
d_s[i][y]=0;
}
}
}
}
}
}else if(n==75)
{
for(int i=0;i<4;i++)
{
for(int y=0;y<=3;y++)
{
if(d_s[i][y]!=0)
{
if(y==3)
{
if(d_s[i][y-1]==0)
{
if(d_s[i][y-3]==d_s[i][y]&&d_s[i][y-2]==0&&d_s[i][y-1]==0)
{
d_s[i][y-3]*=2;
s_y_k_w++;
d_s[i][y]=0;
}
else if(d_s[i][y-2]==d_s[i][y]&&d_s[i][y-1]==0)
{
d_s[i][y-2]*=2;
s_y_k_w++;
d_s[i][y]=0;
}
else if(d_s[i][y-3]==0&&d_s[i][y-2]==0&&d_s[i][y-1]==0)swap(d_s[i][y],d_s[i][y-3]);
else if(d_s[i][y-2]==0&&d_s[i][y-1]==0)swap(d_s[i][y],d_s[i][y-2]);
else swap(d_s[i][y],d_s[i][y-1]);
}else if(d_s[i][y-1]==d_s[i][y])
{
d_s[i][y-1]*=2;
s_y_k_w++;
d_s[i][y]=0;
}
}else if(y==2)
{
if(d_s[i][y-1]==0)
{
if(d_s[i][y-2]==d_s[i][y]&&d_s[i][y-1]==0)
{
d_s[i][y-2]*=2;
s_y_k_w++;
d_s[i][y]=0;
}
else if(d_s[i][y-2]==0&&d_s[i][y-1]==0)swap(d_s[i][y],d_s[i][y-2]);
else swap(d_s[i][y],d_s[i][y-1]);
}else if(d_s[i][y-1]==d_s[i][y])
{
d_s[i][y-1]*=2;
s_y_k_w++;
d_s[i][y]=0;
}
}else if(y==1)
{
if(d_s[i][y-1]==0)
{
swap(d_s[i][y],d_s[i][y-1]);
}else if(d_s[i][y-1]==d_s[i][y])
{
d_s[i][y-1]*=2;
s_y_k_w++;
d_s[i][y]=0;
}
}
}
}
}
}else if(n==80)
{
for(int i=3;i>=0;i--)
{
for(int y=0;y<4;y++)
{
if(d_s[i][y]!=0)
{
if(i==0)
{
if(d_s[i+1][y]==0)
{
if(d_s[i+3][y]==d_s[i][y]&&d_s[i+2][y]==0&&d_s[i+1][y]==0)
{
d_s[i+3][y]*=2;
s_y_k_w++;
d_s[i][y]=0;
}
else if(d_s[i+2][y]==d_s[i][y]&&d_s[i+1][y]==0)
{
d_s[i+2][y]*=2;
s_y_k_w++;
d_s[i][y]=0;
}
else if(d_s[i+3][y]==0&&d_s[i+2][y]==0&&d_s[i+1][y]==0)swap(d_s[i][y],d_s[i+3][y]);
else if(d_s[i+2][y]==0&&d_s[i+1][y]==0)swap(d_s[i][y],d_s[i+2][y]);
else swap(d_s[i][y],d_s[i+1][y]);
}else if(d_s[i+1][y]==d_s[i][y])
{
d_s[i+1][y]*=2;
s_y_k_w++;
d_s[i][y]=0;
}
}else if(i==1)
{
if(d_s[i+1][y]==0)
{
if(d_s[i+2][y]==d_s[i][y]&&d_s[i+1][y]==0)
{
d_s[i+2][y]*=2;
s_y_k_w++;
d_s[i][y]=0;
}
else if(d_s[i+2][y]==0&&d_s[i+1][y]==0)swap(d_s[i][y],d_s[i+2][y]);
else swap(d_s[i][y],d_s[i+1][y]);
}else if(d_s[i+1][y]==d_s[i][y])
{
d_s[i+1][y]*=2;
s_y_k_w++;
d_s[i][y]=0;
}
}else if(i==2)
{
if(d_s[i+1][y]==0)
{
swap(d_s[i][y],d_s[i+1][y]);
}else if(d_s[i+1][y]==d_s[i][y])
{
d_s[i+1][y]*=2;
s_y_k_w++;
d_s[i][y]=0;
}
}
}
}
}
}else if(n==77)
{
for(int i=0;i<4;i++)
{
for(int y=3;y>=0;y--)
{
if(d_s[i][y]!=0)
{
if(y==0)
{
if(d_s[i][y+1]==0)
{
if(d_s[i][y+3]==d_s[i][y]&&d_s[i][y+2]==0&&d_s[i][y+1]==0)
{
d_s[i][y+3]*=2;
s_y_k_w++;
d_s[i][y]=0;
}
else if(d_s[i][y+2]==d_s[i][y]&&d_s[i][y+1]==0)
{
d_s[i][y+2]*=2;
s_y_k_w++;
d_s[i][y]=0;
}
else if(d_s[i][y+3]==0&&d_s[i][y+2]==0&&d_s[i][y+1]==0)swap(d_s[i][y],d_s[i][3]);
else if(d_s[i][y+2]==0&&d_s[i][y+1]==0)swap(d_s[i][y],d_s[i][2]);
else swap(d_s[i][y],d_s[i][1]);
}else if(d_s[i][y+1]==d_s[i][y])
{
d_s[i][y+1]*=2;
s_y_k_w++;
d_s[i][y]=0;
}
}else if(y==1)
{
if(d_s[i][y+1]==0)
{
if(d_s[i][y+2]==d_s[i][y]&&d_s[i][y+1]==0)
{
d_s[i][y+2]*=2;
s_y_k_w++;
d_s[i][y]=0;
}
else if(d_s[i][y+2]==0&&d_s[i][y+1]==0)swap(d_s[i][y],d_s[i][3]);
else swap(d_s[i][y],d_s[i][2]);
}else if(d_s[i][y+1]==d_s[i][y])
{
d_s[i][y+1]*=2;
s_y_k_w++;
d_s[i][y]=0;
}
}else if(y==2)
{
if(d_s[i][y+1]==0)
{
swap(d_s[i][y],d_s[i][y+1]);
}else if(d_s[i][y+1]==d_s[i][y])
{
d_s[i][y+1]*=2;
s_y_k_w++;
d_s[i][y]=0;
}
}
}
}
}
}
}
}
void x_x_game()
{
cout<<"1.4096"<<endl;
cout<<"0.退出"<<endl;
n=getch();
system("cls");
if(n=='1')
{
s_l_j_l();
}else if(n=='0')
return ;
}
int main()
{
sq();
f_c_m();
for(;;)
{
color(8);
system("cls");
cout<<"\n\n\n\n\n\n\n\n";
cout<<" 迷宫系列";
color(2);
cout<<"辐射";
color(8);
cout<<"篇"<<endl<<endl;
cout<<" 1.开始游戏"<<endl;
cout<<" 2.玩法说明"<<endl;
cout<<" 3.制作者"<<endl;
cout<<" 4.设置"<<endl;
cout<<" 5.退出游戏(不建议)"<<endl;
n=getch();
if(n=='1')
{
system("cls");
cout<<"1.沙漠地图(带有传送门)"<<endl;
cout<<"2.化工厂地图"<<endl;
cout<<"3.竞技场(存在裂缝)"<<endl;
cout<<"4.随机地图(抽到坏地图不要怪作者)"<<endl;
cout<<"5.休闲模式"<<endl;
n=getch();
system("cls");
if(n=='1')
{
s_m();
d_t="沙漠";
game();
}else if(n=='2')
{
h_g_c();
d_t="化工厂";
game();
}else if(n=='3')
{
j_j_c();
l_x=19;
l_y=19;
d_t="竞技场";
game();
}else if(n=='4')
{
system("cls");
s_j=rand()%3+1;
if(s_j==1)
{
s_m();
s_c("沙漠");
Sleep(3000);
d_t="沙漠";
game();
}else if(s_j==2)
{
h_g_c();
s_c("化工厂");
Sleep(3000);
d_t="化工厂";
game();
}else if(s_j==3)
{
j_j_c();
l_x=19;
l_y=19;
s_c("竞技场(存在裂缝)");
Sleep(3000);
d_t="竞技场";
game();
}
}else if(n=='5')
{
x_x_game();
}
}else if(n=='2')
{
system("cls");
cout<<l_a_j[0]<<l_a_j[1]<<l_a_j[2]<<l_a_j[3]<<"控制蓝球移动"<<endl<<h_a_j[0]<<h_a_j[1]<<h_a_j[2]<<h_a_j[3]<<"控制红球移动"<<endl<<"()[]传送门"<<endl<<"蓝球到Π时按"<<l_a_j[4]<<"键可以做任务"<<endl<<"箭头可以上楼"<<endl<<"**是放射性物质蓝要小心它"<<endl<<"蓝的任务是做完100%的任务"<<endl<<"红的任务是抓到蓝"<<endl<<"建议双人游玩";
n=getch();
}else if(n=='5')
{
system("cls");
cout<<"拜拜~~";
return 0;
}else if(n=='3')
{
s_c("作者一人创做");
n=getch();
}else if(n=='4')
{
s_z();
}
d_t="无";
}
}