0
已解决
李熙尧
新手光能
新手光能
//cout<<"玩家一asdw控制,z攻击;玩家二ijkl控制,m攻击";
#include<iostream>
#include<windows.h>
#include<ctime>
#include<conio.h>
#pra**a GCC optimize(3)
#pra**a GCC target("avx")
#pra**a GCC optimize("Ofast")
#pra**a GCC optimize("inline")
#pra**a GCC optimize("-fg**e")
#pra**a GCC optimize("-fg**e-lm")
#pra**a GCC optimize("-fipa-sra")
#pra**a GCC optimize("-ftree-pre")
#pra**a GCC optimize("-ftree-vrp")
#pra**a GCC optimize("-fpeephole2")
#pra**a GCC optimize("-ffast-math")
#pra**a GCC optimize("-fsched-spec")
#pra**a GCC optimize("un**ll-loops")
#pra**a GCC optimize("-fali**-jumps")
#pra**a GCC optimize("-fali**-loops")
#pra**a GCC optimize("-fali**-labels")
#pra**a GCC optimize("-fdevirtualize")
#pra**a GCC optimize("-fcaller-saves")
#pra**a GCC optimize("-fc**ssjumping")
#pra**a GCC optimize("-fthread-jumps")
#pra**a GCC optimize("-fun**ll-loops")
#pra**a GCC optimize("-fwhole-p**gram")
#pra**a GCC optimize("-freorder-blocks")
#pra**a GCC optimize("-fschedule-insns")
#pra**a GCC optimize("inline-functions")
#pra**a GCC optimize("-ftree-tail-merge")
#pra**a GCC optimize("-fschedule-insns2")
#pra**a GCC optimize("-fst**ct-aliasing")
#pra**a GCC optimize("-fst**ct-overflow")
#pra**a GCC optimize("-fali**-functions")
#pra**a GCC optimize("-f**e-skip-blocks")
#pra**a GCC optimize("-f**e-follow-jumps")
#pra**a GCC optimize("-fsched-interblock")
#pra**a GCC optimize("-fpartial-inlining")
#pra**a GCC optimize("no-stack-p**tector")
#pra**a GCC optimize("-freorder-functions")
#pra**a GCC optimize("-findirect-inlining")
#pra**a GCC optimize("-fhoist-adjacent-loads")
#pra**a GCC optimize("-frerun-**e-after-loop")
#pra**a GCC optimize("inline-**all-functions")
#pra**a GCC optimize("-finline-**all-functions")
#pra**a GCC optimize("-ftree-switch-conversion")
#pra**a GCC optimize("-foptimize-sibling-calls")
#pra**a GCC optimize("-fexpensive-optimizations")
#pra**a GCC optimize("-funsafe-loop-optimizations")
#pra**a GCC optimize("inline-functions-called-once")
#pra**a GCC optimize("-fdelete-null-pointer-checks")
#pra**a GCC optimize(2)
#define find(VK_NONAME) ((GetAsyncKeyState(VK_NONAME) & 0x8000) ? 1:0)
using name** std;
char found(){
while(1){
if(GetAsyncKeyState('A')){
ret**n 'a';
}
if(GetAsyncKeyState('D')){
ret**n 'd';
}
if(GetAsyncKeyState('W')){
ret**n 'w';
}
if(GetAsyncKeyState('S')){
ret**n 's';
}
if(GetAsyncKeyState('N')){
ret**n 'n';
}
if(GetAsyncKeyState('M')){
ret**n 'm';
}
if(GetAsyncKeyState('I')){
ret**n 'i';
}
if(GetAsyncKeyState('K')){
ret**n 'k';
}
if(GetAsyncKeyState('J')){
ret**n 'j';
}
if(GetAsyncKeyState('L')){
ret**n 'l';
}
if(GetAsyncKeyState('Z')){
ret**n 'z';
}
if(GetAsyncKeyState('X')){
ret**n 'x';
}
}
}
void cls(){
HANDLE hConsole = GetStdHandle(STD_OUTPUT_HANDLE);
COORD coordScreen = {0,0};
SetConsoleC**sorPosition( hConsole,coordScreen );
}
int mep[10][30]={{3,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,6}};
int mep1[10][30]={{3,8,8,8,8,8,8,8,8,8,8,8,8,8,4},
{1,0,0,0,13,0,0,13,0,0,0,0,0,0,1},
{1,0,0,0,13,11,0,13,0,0,0,0,0,0,1},
{1,0,0,0,0,0,0,13,0,0,0,0,0,0,1},
{1,0,0,0,13,11,0,13,0,0,0,0,0,0,1},
{1,0,0,0,13,0,0,13,0,0,0,0,0,0,1},
{1,0,0,0,13,0,11,13,0,0,0,0,0,0,1},
{1,0,0,0,13,0,0,0,0,0,0,0,0,0,1},
{1,2,0,0,13,0,0,13,0,0,0,0,0,9,1},
{5,8,8,8,8,8,8,8,8,8,8,8,8,8,6}};
int mep2[10][30]={{3,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,11,11,11,11,0,0,0,0,0,1},
{1,0,0,0,11,0,0,0,0,0,11,0,0,0,1},
{1,0,0,11,0,0,0,0,0,0,0,11,0,0,1},
{1,0,0,11,0,0,0,0,0,0,0,11,0,0,1},
{1,0,0,11,0,0,0,0,0,0,0,11,0,0,1},
{1,0,11,11,0,0,0,0,0,0,0,11,11,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,6}};
int mep3f[10][30]={{3,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,11,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,6}};
int f1=8,f2=1,d1=8,d2=13,zz=10,x1=200,x2=200,zzm=2,_a=10,_b;
int vas(int dai){
SetConsoleTextAtt**bute(GetStdHandle(STD_OUTPUT_HANDLE),dai);
}
char nx;
int map[100][100];
///////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////
int mup();
void go1(){
HANDLE handle = GetStdHandle(STD_OUTPUT_HANDLE);
CONSOLE_C**SOR_INFO C**sorInfo;
GetConsoleC**sorInfo(handle, &C**sorInfo);
C**sorInfo.bVisible = false;
SetConsoleC**sorInfo(handle, &C**sorInfo);
}
int ko(int what,int wh);
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);
**("cls");
int MIN=1,MAX=36;
cout<<"-----------------------------------------------------选择地图-----------------------------------------------------------";
cout<<"\n 1.原始旷野 2.**亡峡谷 3.造极山峰\n";
int ch;
cin>>ch;
**("cls");
double c;
go1();
int i=1;
if(ch==1){
for(int i=0;i<10;i++){
for(int j=0;j<30;j++){
map[i][j]=mep[i][j];
}
}
}
if(ch==2){
for(int i=0;i<10;i++){
for(int j=0;j<30;j++){
map[i][j]=mep1[i][j];
}
}
}
if(ch==3){
for(int i=0;i<10;i++){
for(int j=0;j<30;j++){
map[i][j]=mep2[i][j];
}
}
}
while(1){
cls();
mup();
cout<<"\n"<<"玩家一还剩"<<zz<<"枚地雷,"<<zzm<<"次地雷波"<<"\n"<<"玩家一血量:"<<x1<<"\n"<<"玩家二血量:"<<x2<<" "<<_a<<"次方块制造机会";
nx=found();
found();
if(found()=='a'){
if(map[f1][f2-1]==0){
map[f1][f2]=0;
map[f1][f2-1]=2;
map[f1][f2]=0;
f2--;
}
if(map[f1][f2-1]==10){
map[f1][f2]=0;
map[f1][f2-1]=2;
map[f1][f2]=0;
x1-=50;
f2--;
}
}
if(found()=='d'){
if(map[f1][f2+1]==0){
map[f1][f2]=0;
map[f1][f2+1]=2;
map[f1][f2]=0;
f2++;
}
if(map[f1][f2+1]==10){
map[f1][f2]=0;
map[f1][f2+1]=2;
map[f1][f2]=0;
x1-=50;
f2++;
}
}
if(found()=='w'){
if(map[f1-1][f2]==0){
map[f1][f2]=0;
map[f1-1][f2]=2;
f1--;
}
if(map[f1-1][f2]==10){
map[f1][f2]=0;
map[f1-1][f2]=2;
map[f1][f2]=0;
x1-=50;
f1--;
}
}
if(found()=='s'){
if(map[f1+1][f2]==0){
map[f1][f2]=0;
map[f1+1][f2]=2;
map[f1][f2]=0;
f1++;
}
if(map[f1][f2-1]==10){
map[f1][f2]=0;
map[f1][f2-1]=2;
map[f1][f2]=0;
x1-=50;
f1++;
}
}
if(found()=='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]=9;
map[d1][d2]=0;
d2--;
x2-=50;
}
}
if(found()=='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]=9;
map[d1][d2]=0;
d2++;
x2-=50;
}
}
if(found()=='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]=9;
map[d1][d2]=0;
d1--;
x2-=50;
}
}
if(found()=='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]=9;
map[d1][d2]=0;
d1++;
x2-=50;
}
}
if(found()=='z'&&zz>0){
int min11=1,max11=4;
srand((int)time(NULL));
int ans11=min11+rand()%(max11-min11+1);
if(ans11==1){
if(map[f1][f2-1]==0){
map[f1][f2-1]=10;
zz--;
}
}
if(ans11==2){
if(map[f1][f2+1]==0){
map[f1][f2+1]=10;
zz--;
}
}
if(ans11==3){
if(map[f1-1][f2]==0){
map[f1-1][f2]=10;
zz--;
}
}
if(ans11==4){
if(map[f1+1][f2]==0){
map[f1+1][f2]=10;
zz--;
}
}
}
if(found()=='x'&&zzm>0){
int min2=1,max2=4;
srand((int)time(NULL));
int ans2=min2+rand()%(max2-min2+1);
zzm--;
for(int i=0;i<=14;i++){
if(ans2==1||ans2==3){
if(map[f1][i]==0){
map[f1][i]=10;
}
}
else{
if(map[i][f2]==0){
map[i][f2]=10;
}
}
}
}
if(found()=='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(map[d1][d2-1]==12){
map[d1][d2-1]=0;
}
if(map[d1][d2+1]==12){
map[d1][d2+1]=0;
}
if(map[d1+1][d2]==12){
map[d1+1][d2]=0;
}
if(map[d1-1][d2]==12){
map[d1-1][d2]=0;
}
}
if(found()=='n'&&_a>0){
int min3=1,max3=4;
srand((int)time(NULL));
int nx1=min3+rand()%(max3-min3+1);
if(nx1==1){
if(map[d1-1][d2]==0){
map[d1-1][d2]=12;
_a--;
}
}
if(nx1==2){
if(map[d1+1][d2]==0){
map[d1+1][d2]=12;
_a--;
}
}
if(nx1==3){
if(map[d1][d2-1]==0){
map[d1][d2-1]=12;
_a--;
}
}
if(nx1==4){
if(map[d1][d2+1]==0){
map[d1][d2+1]=12;
}
}
}
if(x1<=0){
ko(0,1);
ret**n 0;
}
if(x2<=0){
ko(1,1);
ret**n 0;
}
Sleep(100);
}
ret**n 0;
}
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<<"::";
}
if(map[i][j]==13){
cout<<"** ";
}
if(map[i][j]==14){
cout<<"△";
}
}
cout<<"\n";
}
}
int ko(int what,int wh){
**("cls");
if(wh==1){
mup();
cout<<"\n"<<"";
if(what==0){
cout<<"玩家二胜利!!!";
map[f1][f2]=11;
}
if(what==1){
cout<<"玩家一胜利!!!";
map[d1][d2]=11;
}
}
Sleep(1000000000);
}