终于写好物质模拟器6.0版了!本次更新新增物质水、蒸汽、将火箭弹外观改为“→”
蒸汽无法直接放置,需要用火蒸发水
其实这玩意儿我在2022年12月就写好了
玩法见游戏
正文↓↓↓
#include<bits/stdc++.h>
#include<windows.h>
#include<conio.h>
using namespace std;
int playmap[10][10]={
{8,8,8,8,8,8,8,8,8,8},
{8,1,1,1,1,1,1,1,1,8},
{8,1,1,1,1,1,1,1,1,8},
{8,1,1,1,1,1,1,1,1,8},
{8,1,1,1,2,1,1,1,1,8},
{8,1,1,1,1,1,1,1,1,8},
{8,1,1,1,1,1,1,1,1,8},
{8,1,1,1,1,1,1,1,1,8},
{8,1,1,1,1,1,1,1,1,8},
{8,8,8,8,8,8,8,8,8,8},
};
void SetColorAndBackground(int ForgC, int BackC) {
WORD wColor = ((BackC & 0x0F) << 4) + (ForgC & 0x0F);
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), wColor);
}
int x,y;
int bao[10][10]={0};
int w=0;
int qwe=1;
int g=0;
int t,u;
char n;
int main(){
system("cls");
cout<<endl;
cout<<"--------------------------------------物质模拟器-----------------------------------"<<endl;
cout<<"游戏作者:dinosaursmallmi"<<endl;
cout<<endl;
cout<<"图标:“你”:你,“氢”:氢气,“油”:汽油,“硝”:硝酸,“→”:火箭弹,“水”:水,“蒸”:蒸汽"<<endl;
cout<<"按键:按1在“你”的上面释放氢气,按2在“你”的下面撒汽油,按3在“你”的下面撒硝酸,按4在“你”的下面放炸药,按5在“你”的下面放水,按空格向右发射火箭弹,按r清除“你”周围的物质,按空格向右发射火箭弹"<<endl;
cout<<"information:由于此游戏有防止炸自己的保护,你可以随心畅玩,躺在爆炸物堆里引爆也没事"<<endl;
cout<<"information:蒸汽上方遇到火会消失,所以一番轰炸后“水”的数量减少是正常的"<<endl;
system("pause");
while(1)
{
system("cls");
cout<<endl;
cout<<"--------------------------------------物质模拟器-----------------------------------"<<endl;
cout<<"游戏作者:dinosaursmallmi"<<endl;
cout<<endl;
cout<<"图标:“你”:你,“氢”:氢气,“油”:汽油,“硝”:硝酸,“→”:火箭弹,“水”:水,“蒸”:蒸汽"<<endl;
cout<<"按键:按1在“你”的上面释放氢气,按2在“你”的下面撒汽油,按3在“你”的下面撒硝酸,按4在“你”的下面放炸药,按5在“你”的下面放水,按r清除“你”周围的物质,按空格向右发射火箭弹"<<endl;
cout<<"information:由于此游戏有防止炸自己的保护,你可以随心畅玩,躺在爆炸物堆里引爆也没事"<<endl;
cout<<"information:蒸汽上方遇到火会消失,所以一番轰炸后“水”的数量减少是正常的"<<endl;
cout<<endl;
for(int a=10;a>0;a--)
{
for(int b=10;b>0;b--)
{
if(playmap[a][b]==4)
{
if(playmap[a][b+1]==3||playmap[a][b+1]==5||playmap[a][b+1]==6||playmap[a][b+1]==9)
{
playmap[a][b+1]=4;
if(playmap[a][b-1]!=8&&playmap[a][b-1]!=2&&playmap[a][b-1]!=11&&playmap[a][b-1]!=10)
{
playmap[a][b-1]=4;
}
else if(playmap[a][b-1]==10)
{
playmap[a][b-1]=11;
}
if(playmap[a-1][b]!=8&&playmap[a-1][b]!=2&&playmap[a-1][b]!=11&&playmap[a-1][b]!=10)
{
playmap[a-1][b]=4;
}
else if(playmap[a-1][b]==10)
{
playmap[a-1][b]=11;
}
if(playmap[a+1][b]!=8&&playmap[a+1][b]!=2&&playmap[a+1][b]!=11&&playmap[a+1][b]!=10)
{
playmap[a+1][b]=4;
}
else if(playmap[a+1][b]==10)
{
playmap[a+1][b]=11;
}
}
if(playmap[a][b-1]==3||playmap[a][b-1]==5||playmap[a][b-1]==6||playmap[a][b-1]==9)
{
playmap[a][b-1]=4;
if(playmap[a][b+1]!=8&&playmap[a][b+1]!=2&&playmap[a][b+1]!=11&&playmap[a][b+1]!=10)
{
playmap[a][b+1]=4;
}
else if(playmap[a][b+1]==10)
{
playmap[a][b+1]=11;
}
if(playmap[a-1][b]!=8&&playmap[a-1][b]!=2&&playmap[a-1][b]!=11&&playmap[a-1][b]!=10)
{
playmap[a-1][b]=4;
}
else if(playmap[a-1][b]==10)
{
playmap[a-1][b]=11;
}
if(playmap[a+1][b]!=8&&playmap[a+1][b]!=2&&playmap[a+1][b]!=11&&playmap[a+1][b]!=10)
{
playmap[a+1][b]=4;
}
else if(playmap[a+1][b]==10)
{
playmap[a+1][b]=11;
}
}
if(playmap[a-1][b]==3||playmap[a-1][b]==5||playmap[a-1][b]==6||playmap[a-1][b]==9)
{
playmap[a-1][b]=4;
if(playmap[a][b-1]!=8&&playmap[a][b-1]!=2&&playmap[a][b-1]!=11&&playmap[a][b-1]!=10)
{
playmap[a][b-1]=4;
}
else if(playmap[a][b-1]==10)
{
playmap[a][b-1]=11;
}
if(playmap[a][b+1]!=8&&playmap[a][b+1]!=2&&playmap[a][b+1]!=11&&playmap[a][b+1]!=10)
{
playmap[a][b+1]=4;
}
else if(playmap[a][b+1]==10)
{
playmap[a][b+1]=11;
}
if(playmap[a+1][b]!=8&&playmap[a+1][b]!=2&&playmap[a+1][b]!=11&&playmap[a+1][b]!=10)
{
playmap[a+1][b]=4;
}
else if(playmap[a+1][b]==10)
{
playmap[a+1][b]=11;
}
}
if(playmap[a+1][b]==3||playmap[a+1][b]==5||playmap[a+1][b]==6||playmap[a+1][b]==9)
{
playmap[a+1][b]=4;
if(playmap[a][b-1]!=8&&playmap[a][b-1]!=2&&playmap[a][b-1]!=11&&playmap[a][b-1]!=10)
{
playmap[a][b-1]=4;
}
else if(playmap[a][b-1]==10)
{
playmap[a][b-1]=11;
}
if(playmap[a][b+1]!=8&&playmap[a][b+1]!=2&&playmap[a][b+1]!=11&&playmap[a][b+1]!=10)
{
playmap[a][b+1]=4;
}
else if(playmap[a][b+1]==10)
{
playmap[a][b+1]=11;
}
if(playmap[a-1][b]!=8&&playmap[a-1][b]!=2&&playmap[a-1][b]!=11&&playmap[a-1][b]!=10)
{
playmap[a-1][b]=4;
}
else if(playmap[a-1][b]==10)
{
playmap[a-1][b]=11;
}
}
if(playmap[a][b+1]==10)
{
if(playmap[a-1][b+1]==1)
{
playmap[a-1][b+1]=11;
playmap[a][b+1]=1;
}
}
if(playmap[a][b-1]==10)
{
if(playmap[a-1][b-1]==1)
{
playmap[a-1][b-1]=11;
playmap[a][b-1]=1;
}
}
if(playmap[a-1][b]==10)
{
if(playmap[a-2][b]==1)
{
playmap[a-2][b]=11;
playmap[a-1][b]=1;
}
}
if(playmap[a+1][b]==10)
{
playmap[a][b]=11;
playmap[a+1][b]=1;
}
}
}
}
for(int a=0;a<10;a++)
{
for(int b=0;b<10;b++)
{
switch(playmap[a][b])
{
case 1:cout<<" ";break;
case 2:cout<<"你";break;
case 8:cout<<"边";break;
case 3:cout<<"氢";break;
case 4:SetColorAndBackground(12,0);cout<<"火";SetColorAndBackground(15,0);break;
case 5:SetColorAndBackground(11,0);cout<<"油";SetColorAndBackground(15,0);break;
case 6:SetColorAndBackground(14,0);cout<<"硝";SetColorAndBackground(15,0);break;
case 7:SetColorAndBackground(9,0);cout<<" →";SetColorAndBackground(15,0);break;
case 9:SetColorAndBackground(2,0);cout<<"炸";SetColorAndBackground(15,0);break;
case 10:SetColorAndBackground(9,0);cout<<"水";SetColorAndBackground(15,0);break;
case 11:SetColorAndBackground(11,0);cout<<"蒸";SetColorAndBackground(15,0);break;
}
}
cout<<endl;
}
Sleep(50);
for(int a=0;a<10;a++)
{
for(int b=0;b<10;b++)
{
switch(bao[a][b])
{
case 0:
break;
case 2:
bao[a][b]=3;
break;
case 3:
bao[a][b]=4;
break;
case 4:
bao[a][b]=5;
break;
case 5:
bao[a][b]=0;
if(playmap[a][b]!=8&&playmap[a][b]!=2)
{
playmap[a][b]=1;
}
break;
}
}
}
for(int a=0;a<10;a++)
{
for(int b=0;b<10;b++)
{
if(playmap[a][b]==4&&bao[a][b]==0)
{
bao[a][b]=2;
}
}
}
for(int c=0;c<10;c++)
{
for(int d=0;d<10;d++)
{
if(playmap[c][d]==2)
{
x=c;
y=d;
}
}
}
if(kbhit())
{
n=getch();
w=1;
}
if(w==1)
{
switch(n)
{
case 'w':
if(playmap[x-1][y]==1)
{
playmap[x-1][y]=2;
playmap[x][y]=1;
}
break;
case 's':
if(playmap[x+1][y]==1)
{
playmap[x+1][y]=2;
playmap[x][y]=1;
}
break;
case 'a':
if(playmap[x][y-1]==1)
{
playmap[x][y-1]=2;
playmap[x][y]=1;
}
break;
case 'd':
if(playmap[x][y+1]==1)
{
playmap[x][y+1]=2;
playmap[x][y]=1;
}
break;
case '1':
if(playmap[x-1][y]==1)
{
playmap[x-1][y]=3;
}
break;
case '2':
if(playmap[x+1][y]==1)
{
playmap[x+1][y]=5;
}
break;
case '3':
if(playmap[x+1][y]==1)
{
playmap[x+1][y]=6;
}
break;
case '4':
if(playmap[x+1][y]==1)
{
playmap[x+1][y]=9;
}
break;
case '5':
if(playmap[x+1][y]==1)
{
playmap[x+1][y]=10;
}
break;
case ' ':
if(playmap[x][y+1]==1)
{
playmap[x][y+1]=7;
}
break;
case 'r':
if(playmap[x][y-1]!=8&&playmap[x][y-1]!=2)
{
playmap[x][y-1]=1;
}
if(playmap[x][y+1]!=8&&playmap[x][y+1]!=2)
{
playmap[x][y+1]=1;
}
if(playmap[x+1][y]!=8&&playmap[x+1][y]!=2)
{
playmap[x+1][y]=1;
}
if(playmap[x-1][y]!=8&&playmap[x-1][y]!=2)
{
playmap[x-1][y]=1;
}
}
}
w=0;
//下面的注释为原先“r”键的作用,不必管它
// if(g==1)
// {
// g=0;
// for(int f=0;f<10;f++)
// {
// for(int h=0;h<10;h++)
// {
// if(playmap[f][h]==3||playmap[f][h]==5)
// {
// t=f;
// u=h;
// playmap[t][u]=4;
// bao[t][u]=2;
// if(playmap[t+1][u]!=8&&playmap[t+1][u]!=2)
// playmap[t+1][u]=4;bao[t+1][u]=2;
// if(playmap[t-1][u]!=8&&playmap[t-1][u]!=2)
// playmap[t-1][u]=4;bao[t-1][u]=2;
// if(playmap[t][u+1]!=8&&playmap[t][u+1]!=2)
// playmap[t][u+1]=4;bao[t][u+1]=2;
// if(playmap[t][u-1]!=8&&playmap[t][u-1]!=2)
// playmap[t][u-1]=4;bao[t][u-1]=2;
// }
// if(playmap[f][h]==6)
// {
// t=f;
// u=h;
// playmap[t][u]=4;
// bao[t][u]=2;
// if(playmap[t+1][u]!=8&&playmap[t+1][u]!=2)
// playmap[t+1][u]=4;bao[t+1][u]=2;
// if(playmap[t-1][u]!=8&&playmap[t-1][u]!=2)
// playmap[t-1][u]=4;bao[t-1][u]=2;
// if(playmap[t][u+1]!=8&&playmap[t][u+1]!=2)
// playmap[t][u+1]=4;bao[t][u+1]=2;
// if(playmap[t][u-1]!=8&&playmap[t][u-1]!=2)
// playmap[t][u-1]=4;bao[t][u-1]=2;
// if(playmap[t+2][u]!=8&&playmap[t+2][u]!=2)
// playmap[t+2][u]=4;bao[t+2][u]=2;
// if(playmap[t-2][u]!=8&&playmap[t-2][u]!=2)
// playmap[t-2][u]=4;bao[t-2][u]=2;
// if(playmap[t][u+2]!=8&&playmap[t][u+2]!=2)
// playmap[t][u+2]=4;bao[t][u+2]=2;
// if(playmap[t][u-2]!=8&&playmap[t][u-2]!=2)
// playmap[t][u-2]=4;bao[t][u-2]=2;
// }
// if(playmap[f][h]==9)
// {
// t=f;
// u=h;
// playmap[t][u]=4;
// bao[t][u]=2;
// if(playmap[t+1][u]!=8&&playmap[t+1][u]!=2)
// playmap[t+1][u]=4;bao[t+1][u]=2;
// if(playmap[t-1][u]!=8&&playmap[t-1][u]!=2)
// playmap[t-1][u]=4;bao[t-1][u]=2;
// if(playmap[t][u+1]!=8&&playmap[t][u+1]!=2)
// playmap[t][u+1]=4;bao[t][u+1]=2;
// if(playmap[t][u-1]!=8&&playmap[t][u-1]!=2)
// playmap[t][u-1]=4;bao[t][u-1]=2;
// if(playmap[t+2][u]!=8&&playmap[t+2][u]!=2)
// playmap[t+2][u]=4;bao[t+2][u]=2;
// if(playmap[t-2][u]!=8&&playmap[t-2][u]!=2)
// playmap[t-2][u]=4;bao[t-2][u]=2;
// if(playmap[t][u+2]!=8&&playmap[t][u+2]!=2)
// playmap[t][u+2]=4;bao[t][u+2]=2;
// if(playmap[t][u-2]!=8&&playmap[t][u-2]!=2)
// playmap[t][u-2]=4;bao[t][u-2]=2;
// if(playmap[t-1][u-1]!=8&&playmap[t-1][u-1]!=2)
// playmap[t-1][u-1]=4;bao[t-1][u-1]=2;
// if(playmap[t+1][u-1]!=8&&playmap[t+1][u-1]!=2)
// playmap[t+1][u-1]=4;bao[t+1][u-1]=2;
// if(playmap[t-1][u+1]!=8&&playmap[t-1][u+1]!=2)
// playmap[t-1][u+1]=4;bao[t-1][u+1]=2;
// if(playmap[t+1][u+1]!=8&&playmap[t+1][u+1]!=2)
// playmap[t+1][u+1]=4;bao[t+1][u+1]=2;
// }
// }
// }
// }
for(int aa=0;aa<10;aa++)
{
for(int bb=0;bb<10;bb++)
{
if(playmap[aa][bb]==3)
{
if(playmap[aa-1][bb]!=1)
{
if(playmap[aa-1][bb-1]==1)
{
playmap[aa-1][bb-1]=3;
playmap[aa][bb]=1;
}
else if(playmap[aa-1][bb+1]==1)
{
playmap[aa-1][bb+1]=3;
playmap[aa][bb]=1;
}
break;
}
if(playmap[aa-1][bb]==1)
{
playmap[aa-1][bb]=3;
playmap[aa][bb]=1;
}
}
}
}
for(int aa=0;aa<10;aa++)
{
for(int bb=0;bb<10;bb++)
{
if(playmap[aa][bb]==11)
{
if(playmap[aa-1][bb]==8||playmap[aa-1][bb]==2||playmap[aa-1][bb]==3||playmap[aa-1][bb]==10)
{
playmap[aa][bb]=10;
break;
}
else if(playmap[aa-1][bb]==4)
{
playmap[aa][bb]=1;
break;
}
else if(playmap[aa-1][bb]==1)
{
playmap[aa-1][bb]=11;
playmap[aa][bb]=1;
break;
}
break;
}
}
}
for(int qw=0;qw<10;qw++)
{
for(int we=0;we<10;we++)
{
if(playmap[qw][we]==5)
{
if(playmap[qw+1][we]!=1)
{
if(playmap[qw+1][we-1]==1)
{
playmap[qw+1][we-1]=5;
playmap[qw][we]=1;
qwe=2;
break;
}
else if(playmap[qw+1][we+1]==1)
{
playmap[qw+1][we+1]=5;
playmap[qw][we]=1;
qwe=2;
break;
}
}
if(playmap[qw+1][we]==1)
{
playmap[qw+1][we]=5;
playmap[qw][we]=1;
qwe=2;
break;
}
}
}
if(qwe==2)
{
qwe=1;
break;
}
}
for(int qw=0;qw<10;qw++)
{
for(int we=0;we<10;we++)
{
if(playmap[qw][we]==10)
{
if(playmap[qw+1][we]!=1)
{
if(playmap[qw+1][we-1]==1)
{
playmap[qw+1][we-1]=10;
playmap[qw][we]=1;
qwe=2;
break;
}
else if(playmap[qw+1][we+1]==1)
{
playmap[qw+1][we+1]=10;
playmap[qw][we]=1;
qwe=2;
break;
}
}
if(playmap[qw+1][we]==1)
{
playmap[qw+1][we]=10;
playmap[qw][we]=1;
qwe=2;
break;
}
}
}
if(qwe==2)
{
qwe=1;
break;
}
}
for(int qw=0;qw<10;qw++)
{
for(int we=0;we<10;we++)
{
if(playmap[qw][we]==6)
{
if(playmap[qw+1][we]!=1)
{
if(playmap[qw+1][we-1]==1)
{
playmap[qw+1][we-1]=6;
playmap[qw][we]=1;
qwe=2;
break;
}
else if(playmap[qw+1][we+1]==1)
{
playmap[qw+1][we+1]=6;
playmap[qw][we]=1;
qwe=2;
break;
}
}
if(playmap[qw+1][we]==1)
{
playmap[qw+1][we]=6;
playmap[qw][we]=1;
qwe=2;
break;
}
}
}
if(qwe==2)
{
qwe=1;
break;
}
}
for(int qw=10;qw>0;qw--)
{
for(int we=10;we>0;we--)
{
if(playmap[qw][we]==7)
{
if(playmap[qw][we+1]==1)
{
playmap[qw][we+1]=7;
playmap[qw][we]=1;
qwe=2;
break;
}
else
{
playmap[qw][we]=4;
bao[qw][we]=2;
if(playmap[qw+1][we]==10)
playmap[qw+1][we]=11;
if(playmap[qw+1][we]!=8&&playmap[qw+1][we]!=2&&playmap[qw+1][we]!=10&&playmap[qw+1][we]!=11)
playmap[qw+1][we]=4;bao[qw+1][we]=2;
if(playmap[qw-1][we]==10)
playmap[qw-1][we]=11;
if(playmap[qw-1][we]!=8&&playmap[qw-1][we]!=2&&playmap[qw-1][we]!=10&&playmap[qw-1][we]!=11)
playmap[qw-1][we]=4;bao[qw-1][we]=2;
if(playmap[qw][we+1]==10)
playmap[qw][we+1]=11;
if(playmap[qw][we+1]!=8&&playmap[qw][we+1]!=2&&playmap[qw][we+1]!=10&&playmap[qw][we+1]!=11)
playmap[qw][we+1]=4;bao[qw][we+1]=2;
if(playmap[qw][we-1]==10)
playmap[qw][we-1]=11;
if(playmap[qw][we-1]!=8&&playmap[qw][we-1]!=2&&playmap[qw][we-1]!=10&&playmap[qw][we-1]!=11)
playmap[qw][we-1]=4;bao[qw][we-1]=2;
}
}
}
if(qwe==2)
{
qwe=1;
break;
}
}
}
return 0;
}
点赞什么的随便