大家好,欢迎来到今天的代码。我很荣幸能够在这里与大家见面。今天我想向大家介绍的是能量1.0.2版本。本次主要更新了人工智障的智商,没有以前那么笨了。++先赞后看 养成习惯++
CODE
cpp
#include<bits/stdc++.h>
#include<windows.h>
using namespace std;
int rgzz(int lun, int dineng, int neng){
while(1){//人工智障系统
int dichu=0;
if(lun==1){
return 4;
}
if(dineng==3){
return 3;
}
srand(time(0));
dichu=rand()%5+1;
if(dineng==1&&dichu==2||dineng<=2&&dichu==3) continue;
else if(dineng<1&&dichu<4) continue;
else if(neng>2&&dichu==6) continue;
else if(neng<1&&dichu>4) continue;
else return dichu;
}
}
void ts(int lun,int neng){
cout<<"第"<<lun<<"轮"<<endl<<"1:波 2:海啸 3:天雷 4:能量 5:防(波) 6:防(海啸) 0:退出游戏 能量:"<<neng<<endl;
return;
}
void Bling(){
for(int i=0;i<=3;i++){
system("color 1A");Sleep(40);
system("color 2B");Sleep(40);
system("color 3C");Sleep(40);
system("color 4D");Sleep(40);
system("color 5D");Sleep(40);
system("color 6E");Sleep(40);
system("color 7F");Sleep(40);
}
}
int main(){
cout<<"欢迎游玩"能量"小游戏\n";
Bling();
system("color 8E");
int neng=0,dineng=0,lun=0;
while(1){
int gong=0,fang=0,digong=0,difang=0,chu=0,dichu=0;
lun++;
ts(lun,neng);
cin>>chu;
switch(chu){//玩家控制
case 1: if(neng>=1){gong=1;neng--;cout<<"我:\n波"<<endl;}else{cout<<"没有足够的能量"<<endl;;lun--;continue;}break;
case 2: if(neng>=2){gong=2;neng-=2;cout<<"我:\n海啸"<<endl;}else{cout<<"没有足够的能量"<<endl;lun--;continue;}break;
case 3: if(neng>=3){gong=3;neng-=3;cout<<"我:\n天雷"<<endl;}else{cout<<"没有足够的能量"<<endl;lun--;continue;}break;
case 4: neng++;cout<<"我:\n能量"<<endl;break;
case 5: fang=1;cout<<"我:\n波防"<<endl;break;
case 6: fang=2;cout<<"我:\n海啸防"<<endl;break;
case 0: return 0;
}
dichu=rgzz(lun,dineng,neng);
cout<<"敌:"<<endl;
switch(dichu){//机器控制
case 1: digong=1;dineng--;cout<<"波"<<endl;break;
case 2: digong=2;dineng-=2;cout<<"海啸"<<endl;break;
case 3: digong=3;dineng-=3;cout<<"天雷"<<endl;break;
case 4: dineng++;cout<<"能量"<<endl;break;
case 5: difang=1;cout<<"波防"<<endl;break;
case 6: difang=2;cout<<"海啸防"<<endl;break;
}
if((gong==difang&&gong!=0) || chu==dichu || (digong==fang&&digong!=0)) continue;//判断游戏是否结束
else if((gong>digong&&gong!=difang) || (dichu==4&&gong>0) || (dichu==4&&gong!=0)){
cout<<"YOU WIN!\n\n";
return 0;
}else if((digong>gong&&digong!=fang) || (digong!=fang&&digong!=0) || (chu==4&&digong>0)){
cout<<"YOU DIE!\n\n";
return 0;
}
}
return 0;
}
++我的赞呢 你看见了吗++
作者:zty郑桐羽呀
联系方式:(不挂了,有事私信)