0
已解决
李熙尧
新手光能
新手光能
//cout<<"玩家一asdw控制,z攻击;玩家二ijkl控制,m攻击";
#include<iostream>
#include<windows.h>
#include<ctime>
#include<conio.h>
using namespace std;
int f1=8,f2=1,d1=8,d2=13,nx,zz=10,x1=100,x2=100,zzm=2,_a=10,_b;
int vas(int dai){
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),dai);
}
int map[10][30]={{3,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,4},
{1,0,0,0,0,0,0,0,0,0,0,0,0,0,1},
{1,0,0,0,0,0,0,0,0,0,0,0,0,0,1},
{1,0,0,0,0,0,0,0,0,0,0,0,0,0,1},
{1,0,0,0,0,0,0,0,0,0,0,0,0,0,1},
{1,0,0,0,0,0,0,0,0,0,0,0,0,0,1},
{1,0,0,0,0,0,0,0,0,0,0,0,0,0,1},
{1,0,0,0,0,0,0,0,0,0,0,0,0,0,1},
{1,2,0,0,0,0,0,0,0,0,0,0,0,9,1},
{5,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,6},};
int mup(){
for(int i=0;i<10;i++){
for(int j=0;j<30;j++){
if(map[i][j]==0){
cout<<" ";
}
if(map[i][j]==1){
cout<<"┃";
}
if(map[i][j]==2){
cout<<"♀";
}
if(map[i][j]==3){
cout<<"┏";
}
if(map[i][j]==4){
cout<<"┓";
}
if(map[i][j]==5){
cout<<"┗";
}
if(map[i][j]==6){
cout<<"┛";
}
if(map[i][j]==8){
cout<<"━";
}if(map[i][j]==9){
cout<<"♂";
}
if(map[i][j]==10){
vas(250);
cout<<"!!";
vas(7);
}
if(map[i][j]==11){
cout<<"**";
}
if(map[i][j]==12){
cout<<"屎";
}
}
cout<<"\n";
}
}
void go1(){
HANDLE handle = GetStdHandle(STD_OUTPUT_HANDLE);
CONSOLE_CURSOR_INFO CursorInfo;
GetConsoleCursorInfo(handle, &CursorInfo);
CursorInfo.bVisible = false;
SetConsoleCursorInfo(handle, &CursorInfo);
}
int ko(int what){
system("cls");
mup();
cout<<"\n"<<"";
if(what==0){
cout<<"玩家二胜利!!!";
map[f1][f2]=11;
}
if(what==1){
cout<<"玩家一胜利!!!";
map[d1][d2]=11;
}
}
int main(){
go1();
cout<<" █ █ \n";
cout<<" █ ████ \n";
cout<<" █ ███ \n";
cout<<" ███ █ █ █ \n";
cout<<" █ █ ██ █ █ \n";
cout<<"█ █ █ ███ \n";
cout<<" █ █████ \n";
cout<<" █ █ █ \n";
cout<<" ██ ██ \n";
cout<<" █ █ 小李工作室 ";
cout<<"荣誉出品";
Sleep(5000);
system("cls");
int MIN=1,MAX=36;
double c;
go1();
int i=1;
while(1){
mup();
cout<<"\n"<<"玩家一还剩"<<zz<<"枚地雷,"<<zzm<<"次地雷波"<<"\n"<<"玩家一血量:"<<x1<<"\n"<<"玩家二血量:"<<x2<<" "<<_a<<"次方块制造机会";
nx=c;
c=getch();
if(c=='a'){
if(map[f1][f2-1]==0){
map[f1][f2]=0;
map[f1][f2-1]=2;
map[f1][f2]=0;
f2--;
}
}
if(c=='d'){
if(map[f1][f2+1]==0){
map[f1][f2]=0;
map[f1][f2+1]=2;
map[f1][f2]=0;
f2++;
}
}
if(c=='w'){
if(map[f1-1][f2]==0){
map[f1][f2]=0;
map[f1-1][f2]=2;
f1--;
}
}
if(c=='s'){
if(map[f1+1][f2]==0){
map[f1][f2]=0;
map[f1+1][f2]=2;
map[f1][f2]=0;
f1++;
}
}
if(c=='j'){
if(map[d1][d2-1]==0){
map[d1][d2]=0;
map[d1][d2-1]=9;
map[d1][d2]=0;
d2--;
}
if(map[d1][d2-1]==10){
map[d1][d2]=0;
map[d1][d2-1]=11;
map[d1][d2]=0;
d2--;
x1-=50;
}
}
if(c=='l'){
if(map[d1][d2+1]==0){
map[d1][d2]=0;
map[d1][d2+1]=9;
map[d1][d2]=0;
d2++;
}
if(map[d1][d2+1]==10){
map[d1][d2]=0;
map[d1][d2+1]=11;
map[d1][d2]=0;
d2++;
x1-=50;
}
}
if(c=='i'){
if(map[d1-1][d2]==0){
map[d1][d2]=0;
map[d1-1][d2]=9;
d1--;
}
if(map[d1-1][d2]==10){
map[d1][d2]=0;
map[d1-1][d2]=11;
map[d1][d2]=0;
d1--;
x1-=50;
}
}
if(c=='k'){
if(map[d1+1][d2]==0){
map[d1][d2]=0;
map[d1+1][d2]=9;
map[d1][d2]=0;
d1++;
}
if(map[d1+1][d2]==10){
map[d1][d2]=0;
map[d1+1][d2]=11;
map[d1][d2]=0;
d1++;
x1-=50;
}
}
if(c=='z'&&zz>0){
if(nx=='a'){
if(map[f1][f2-1]==0){
map[f1][f2-1]=10;
zz--;
}
}
if(nx=='d'){
if(map[f1][f2+1]==0){
map[f1][f2+1]=10;
zz--;
}
}
if(nx=='w'){
if(map[f1-1][f2]==0){
map[f1-1][f2]=10;
zz--;
}
}
if(nx=='s'){
if(map[f1+1][f2]==0){
map[f1+1][f2]=10;
zz--;
}
}
}
if(c=='x'&&zzm>0){
zzm--;
for(int i=0;i<=14;i++){
if(nx=='a'||nx=='d'){
if(map[f1][i]==0){
map[f1][i]=10;
}
}
if(nx=='w'||nx=='s'){
if(map[i][f2]==0){
map[i][f2]=10;
}
}
}
}
if(c=='m'){
if((map[d1-1][d2-1]==2||map[d1][d2-1]==2)||map[d1+1][d2-1]==2||map[d1-1][d2]==2||map[d1][d2]==2||map[d1+1][d2]==2||map[d1-1][d2+1]==2||map[d1][d2+1]==2||map[d1+1][d2+1]==2){
srand((int)time(NULL));
int ans=MIN+rand()%(MAX-MIN+1);
if(ans<=30){
x1-=20;
}
else{
x1-=ans;
}
}
}
if(c=='n'&&_a>0){
int ss=0,sss=14,bb=0,bbb=9;
srand((int)time(NULL));
int ans1=ss+rand()%(sss-ss+1);
srand((int)time(NULL));
int ans2=bb+rand()%(bbb-bb+1);
if(map[ans1][ans2]==0){
map[ans1][ans2]=12;
_a--;
}
}
if(x1<=0){
ko(0);
return 0;
}
if(x2<=0){
ko(1);
return 0;
}
system("cls");
}
return 0;
}