初级守护
#include <bits/stdc++.h>
#include <windows.h>
using namespace std;
long long a=24,b=24,ca,cb,pa,pb,c,i,a1,b1;
char A[8],t;
string l[101][3];
int main(){
system("color 61");
cout<<"*************** 游戏说明 ***************"<<'\n';
cout<<"*每一局红蓝两个玩家分别输入七个字符,程*"<<'\n';
cout<<"*序会判断AB的输赢,赢的玩家可能踢对方一*"<<'\n';
cout<<"*拳踢对方一脚,打对方一巴掌或使用希特勒*"<<'\n';
cout<<"*攻击,但也可能攻击力度过猛,自己减少一*"<<'\n';
cout<<"*滴血。注意:每人只有24滴血!!! *"<<'\n';
cout<<"****************************************"<<'\n';
cout<<"如果每局开始时需要输出历史记录,请输入Y,否则输入N。"<<'\n';
cin>>t;
Sleep(1000);
system("cls");
while(a!=0&&b!=0){
c++;
cout<<"-------------- 这是第"<<c<<"局 ---------------"<<'\n';
if(c!=1&&t=='Y'){
cout<<"╔═════得分表══════╗"<<'\n';
cout<<"║红方得分║蓝方得分║"<<'\n';
for(i=1;i<c;i++){
cout<<"╠════════╬════════╣"<<'\n';
cout<<"║"<<l[i][1]<<' '<<"║"<<l[i][2]<<' '<<"║"<<'\n';
}
cout<<"╚════════╩════════╝"<<'\n';
}
cout<<"红方原来的血条:";
if(a>=16)for(i=1;i<=a;i++)cout<<'#';
if(a<16&&a>=8)for(i=1;i<=a;i++)cout<<'?';
if(a<8)for(i=1;i<=a;i++)cout<<'!';
cout<<"共"<<a<<"滴"<<'\n';
cout<<"蓝方原来的血条:";
if(b>=16)for(i=1;i<=b;i++)cout<<'#';
if(b<16&&b>=8)for(i=1;i<=b;i++)cout<<'?';
if(b<8)for(i=1;i<=b;i++)cout<<'!';
cout<<"共"<<b<<"滴"<<'\n';
cout<<"请红方输入7个字母,并换行。"<<'\n';
cin>>A[1]>>A[2]>>A[3]>>A[4]>>A[5]>>A[6]>>A[7];
ca=((A[2]*A[7]+A[5]*A[6])+A[1]-A[2])*A[3]*A[5]-A[4]+A[7];
cout<<"请蓝方输入7个字母,并换行。"<<'\n';
cin>>A[1]>>A[2]>>A[3]>>A[4]>>A[5]>>A[6]>>A[7];
cb=((A[5]*A[7]+A[2]*A[1])+A[6]-A[2])*A[3]*A[7]-A[4]+A[6];
pa=ca%3;
pb=cb%3;
if(ca%(a*b)<=10&&cb%(a*b)>10){
a=24;
b1=b;
b=b/4;
cout<<"红方赢了,使用了希特勒攻击,红方血量爆满,蓝方的血量减少到原来的1/4。"<<'\n';
system("color 42");
l[c][1]="24 ";
if(b1<10)l[c][2]=l[c][2]+char(b1+'0')+'/'+'4'+'='+char(b+'0')+' '+' ';
if(b1>=10)l[c][2]=l[c][2]+char(b1/10+'0')+char(b1%10+'0')+'/'+'4'+'='+char(b+'0')+' ';
}
else{
if(cb%(a*b)<=10&&ca%(a*b)>10){
b=24;
a1=a;
a=a/4;
cout<<"蓝方赢了,使用了希特勒攻击,蓝方血量爆满,红方的血量减少到原来的1/4。"<<'\n';
system("color 16");
l[c][2]="24 ";
if(a1<10)l[c][1]=l[c][1]+char(a1+'0')+'/'+'4'+'='+char(a+'0')+' '+' ';
if(a1>=10)l[c][1]=l[c][1]+char(a1/10+'0')+char(a1%10+'0')+'/'+'4'+'='+char(a+'0')+' ';
}
if(pa==1&&pb==2){
a++;
b-=3;
cout<<"红方赢了,锤了蓝方一拳,蓝方减少了3滴血。"<<'\n';
system("color 42");
if(a<10)l[c][1]=l[c][1]+char(a-1+'0')+'+'+'1'+'='+char(a+'0')+' '+' ';
if(a==10)l[c][1]="9+1=10 ";
if(a>10)l[c][1]=l[c][1]+char((a-1)/10+'0')+char((a-1)%10+'0')+'+'+'1'+'='+char(a/10+'0')+char(a%10+'0');
if(b<7)l[c][2]=l[c][2]+char(b+3+'0')+'-'+'3'+'='+char(b+'0')+' '+' ';
if(b==7)l[c][2]="10-3=7 ";
if(b==8)l[c][2]="11-3=8 ";
if(b==9)l[c][2]="12-3=9 ";
if(b==10)l[c][2]="13-3=10";
if(b>10)l[c][2]=l[c][2]+l[c][2]+char((b+3)/10+'0')+char((b+3)%10+'0')+'-'+'3'+'='+char(b/10+'0')+char(b%10+'0');
if(a==25)l[c][1]="24+1=24";
}
if(pa==2&&pb==0){
a++;
b-=4;
cout<<"红方赢了,打了蓝方一巴掌,蓝方减少了4滴血。"<<'\n';
system("color 42");
if(a<10)l[c][1]=l[c][1]+char(a-1+'0')+'+'+'1'+'='+char(a+'0')+' '+' ';
if(a==10)l[c][1]="9+1=10 ";
if(a>10)l[c][1]=l[c][1]+char((a-1)/10+'0')+char((a-1)%10+'0')+'+'+'1'+'='+char(a/10+'0')+char(a%10+'0');
if(b<6)l[c][2]=l[c][2]+char(b+4+'0')+'-'+'4'+'='+char(b+'0')+' '+' ';
if(b==6)l[c][2]="10-4=6 ";
if(b==7)l[c][2]="11-4=7 ";
if(b==8)l[c][2]="12-4=8 ";
if(b==9)l[c][2]="13-4=9 ";
if(b==10)l[c][2]="14-4=10";
if(b>10)l[c][2]=l[c][2]+char((b+4)/10+'0')+char((b+4)%10+'0')+'-'+'4'+'='+char(b/10+'0')+char(b%10+'0');
if(a==25)l[c][1]="24+1=24";
}
if(pa==0&&pb==1){
a++;
b-=6;
cout<<"红方赢了,踢了蓝方一脚,蓝方减少了6滴血。"<<'\n';
system("color 42");
if(a<10)l[c][1]=l[c][1]+char(a-1+'0')+'+'+'1'+'='+char(a+'0')+' '+' ';
if(a==10)l[c][1]="9+1=10 ";
if(a>10)l[c][1]=l[c][1]+char((a-1)/10+'0')+char((a-1)%10+'0')+'+'+'1'+'='+char(a/10+'0')+char(a%10+'0');
if(b<4)l[c][2]=l[c][2]+char(b+3+'0')+'-'+'3'+'='+char(b+'0')+' '+' ';
if(b==4)l[c][2]="10-6=4 ";
if(b==5)l[c][2]="11-6=5 ";
if(b==6)l[c][2]="12-6=6 ";
if(b==7)l[c][2]="13-6=7 ";
if(b==8)l[c][2]="14-6=8 ";
if(b==9)l[c][2]="15-6=9 ";
if(b==10)l[c][2]="16-6=10";
if(b>10)l[c][2]=l[c][2]+char((b+6)/10+'0')+char((b+6)%10+'0')+'-'+'6'+'='+char(b/10+'0')+char(b%10+'0');
if(a==25)l[c][1]="24+1=24";
}
if(pb==1&&pa==2){
b++;
a-=3;
cout<<"蓝方赢了,锤了红方一拳,红方减少了3滴血。"<<'\n';
system("color 16");
if(b<10)l[c][2]=l[c][2]+char(b-1+'0')+'+'+'1'+'='+char(b+'0')+' '+' ';
if(b==10)l[c][2]="9+1=10 ";
if(b>10)l[c][2]=l[c][2]+char((b-1)/10+'0')+char((b-1)%10+'0')+'+'+'1'+'='+char(b/10+'0')+char(b%10+'0');
if(a<7)l[c][1]=l[c][1]+char(a+3+'0')+'-'+'3'+'='+char(a+'0')+' '+' ';
if(a==7)l[c][1]="10-3=7 ";
if(a==8)l[c][1]="11-3=8 ";
if(a==9)l[c][1]="12-3=9 ";
if(a==10)l[c][1]="13-3=10";
if(a>10)l[c][1]=l[c][1]+char((a+3)/10+'0')+char((a+3)%10+'0')+'-'+'3'+'='+char(a/10+'0')+char(a%10+'0');
if(b==25)l[c][2]="24+1=24";
}
if(pb==2&&pa==0){
b++;
a-=4;
cout<<"蓝方赢了,打了红方一巴掌,红方减少了4滴血。"<<'\n';
system("color 16");
if(b<10)l[c][2]=l[c][2]+char(b-1+'0')+'+'+'1'+'='+char(b+'0')+' '+' ';
if(b==10)l[c][2]="9+1=10 ";
if(b>10)l[c][2]=l[c][2]+char((b-1)/10+'0')+char((b-1)%10+'0')+'+'+'1'+'='+char(b/10+'0')+char(b%10+'0');
if(a<6)l[c][1]=l[c][1]+char(a+4+'0')+'-'+'3'+'='+char(a+'0')+' '+' ';
if(a==6)l[c][1]="10-4=6 ";
if(a==7)l[c][1]="11-4=7 ";
if(a==8)l[c][1]="12-4=8 ";
if(a==9)l[c][1]="13-4=9 ";
if(a==10)l[c][1]="14-4=10";
if(a>10)l[c][1]=l[c][1]+char((a+4)/10+'0')+char((a+4)%10+'0')+'-'+'4'+'='+char(a/10+'0')+char(a%10+'0');
if(b==25)l[c][2]="24+1=24";
}
if(pb==0&&pa==1){
b++;
a-=6;
cout<<"蓝方赢了,踢了红方一脚,红方减少了6滴血。"<<'\n';
system("color 16");
if(b<10)l[c][2]=l[c][2]+char(b-1+'0')+'+'+'1'+'='+char(b+'0')+' '+' ';
if(b==10)l[c][2]="9+1=10 ";
if(b>10)l[c][2]=l[c][2]+char((b-1)/10+'0')+char((b-1)%10+'0')+'+'+'1'+'='+char(b/10+'0')+char(b%10+'0');
if(a<4)l[c][1]=l[c][1]+char(a+3+'0')+'-'+'3'+'='+char(a+'0')+' '+' ';
if(a==4)l[c][1]="10-6=4 ";
if(a==5)l[c][1]="11-6=5 ";
if(a==6)l[c][1]="12-6=6 ";
if(a==7)l[c][1]="13-6=7 ";
if(a==8)l[c][1]="14-6=8 ";
if(a==9)l[c][1]="15-6=9 ";
if(a==10)l[c][1]="16-6=10";
if(a>10)l[c][1]=l[c][1]+char((a+6)/10+'0')+char((a+6)%10+'0')+'-'+'6'+'='+char(a/10+'0')+char(a%10+'0');
if(b==25)l[c][2]="24+1=24";
}
if(pb==pa){
if(ca<cb||(ca==cb&&c%2==1)){
a--;
cout<<"红方赢了,但攻击力度过猛,自己减少一滴血。"<<'\n';
system("color 42");
if(a<9)l[c][1]=l[c][1]+char(a+1+'0')+'-'+'1'+'='+char(a+'0')+' '+' ';
if(a==9)l[c][1]="10-1=9 ";
if(a>=10)l[c][1]=l[c][1]+char((a+1)/10+'0')+char((a+1)%10+'0')+'-'+'1'+'='+char(a/10+'0')+char(a%10+'0');
if(b<10)l[c][2]=l[c][2]+char(b+'0')+' '+' '+' '+' '+' '+' ';
else l[c][2]=l[c][2]+char(b/10+'0')+char(b%10+'0')+' '+' '+' '+' '+' ';
}
if(ca>cb||(ca==cb&&c%2==0)){
b--;
cout<<"蓝方赢了,但攻击力度过猛,自己减少一滴血。"<<'\n';
system("color 16");
if(b<9)l[c][2]=l[c][2]+char(b+1+'0')+'-'+'1'+'='+char(b+'0')+' '+' ';
if(b==9)l[c][2]="10-1=9 ";
if(b>=10)l[c][2]=l[c][2]+char((b+1)/10+'0')+char((b+1)%10+'0')+'-'+'1'+'='+char(b/10+'0')+char(b%10+'0');
if(a<10)l[c][1]=l[c][1]+char(a+'0')+" ";
else l[c][1]=l[c][1]+char(a/10+'0')+char(a%10+'0')+" ";
}
}
}
if(a>24)a=24;
if(b<0)b=0;
if(b>24)b=24;
if(a<0)a=0;
cout<<"红方的血条:";
if(a>=16)for(i=1;i<=a;i++)cout<<'#';
if(a<16&&a>=8)for(i=1;i<=a;i++)cout<<'?';
if(a<8)for(i=1;i<=a;i++)cout<<'!';
if(a==0)cout<<"空空如也!"<<'\n';
else cout<<"共"<<a<<"滴"<<'\n';
cout<<"蓝方的血条:";
if(b>=16)for(i=1;i<=b;i++)cout<<'#';
if(b<16&&b>=8)for(i=1;i<=b;i++)cout<<'?';
if(b<8)for(i=1;i<=b;i++)cout<<'!';
if(b==0)cout<<"空空如也!"<<'\n';
else cout<<"共"<<b<<"滴"<<'\n';
cout<<"----------------------------------------"<<'\n';
Sleep(1000);
system("cls");
}
if(a==0){
cout<<"这局B赢了,B有"<<b<<"滴血。"<<'\n';
cout<<"但A也不要灰心,下次加油!"<<'\n';
}
else{
cout<<"这局A赢了,A有"<<a<<"滴血。"<<'\n';
cout<<"但B也不要灰心,下次加油!"<<'\n';
}
Sleep(1000);
system("cls");
system("color 61");
cout<<"*************** 感谢使用 ***************"<<'\n';
cout<<"*感谢您的使用,但我技术有限,如果有不好*"<<'\n';
cout<<"*玩的地方,或者好的建议,可以来找我,欢*"<<'\n';
cout<<"*迎来找我。 *"<<'\n';
cout<<"* ——V1978大黄狗(黄秋实)*"<<'\n';
cout<<"****************************************"<<'\n';
}