代码(运用到小猴编程编辑器的头文件:<xiaohoucode.h>):
#include <bits/stdc++.h>
auto start = std::chrono::high_resolution_clock::now();
#include <xiaohoucode.h>
#include <ctype.h>
#include <termio.h>
using namespace std;
struct pai
{
int paifu;
int huase;
int yanse;
int dianshu;
int leixing;
int changdu;
void Kanpai()
{
if(paifu==0||paifu==1);
else
printf("牌副参数错误!\n");
switch(huase)
{
case 0:cout<<"黑桃";break;
case 1:cout<<"红桃";break;
case 2:cout<<"草花";break;
case 3:cout<<"方片";break;
case -1:cout<<"无色";break;
default:printf("花色错误!\n");break;
}
switch(dianshu)
{
case 0:cout<<"A ";break;
case 1:cout<<"2 ";break;
case 2:cout<<"3 ";break;
case 3:cout<<"4 ";break;
case 4:cout<<"5 ";break;
case 5:cout<<"6 ";break;
case 6:cout<<"7 ";break;
case 7:cout<<"8 ";break;
case 8:cout<<"9 ";break;
case 9:cout<<"10 ";break;
case 10:cout<<"J ";break;
case 11:cout<<"Q ";break;
case 12:cout<<"K ";break;
case -1:cout<<"无点数";break;
default:printf("点数错误!\n");break;
}
switch(leixing)
{
case 101:cout<<"【杀】"<<endl;break;
case 102:cout<<"【闪】"<<endl;break;
case 103:cout<<"【桃】"<<endl;break;
case 201:cout<<"【过河拆桥】"<<endl;break;
case 202:cout<<"【顺手牵羊】"<<endl;break;
case 203:cout<<"【无中生有】"<<endl;break;
case 204:cout<<"【决斗】"<<endl;break;
case 205:cout<<"【借刀杀人】"<<endl;break;
case 206:cout<<"【桃园结义】"<<endl;break;
case 207:cout<<"【五谷丰登】"<<endl;break;
case 208:cout<<"【南蛮入侵】"<<endl;break;
case 209:cout<<"【万箭齐发】"<<endl;break;
case 210:cout<<"【无懈可击】"<<endl;break;
case 251:cout<<"【乐不思蜀】"<<endl;break;
case 252:cout<<"【闪电】"<<endl;break;
case 301:cout<<"【诸葛连弩(1)】"<<endl;break;
case 302:cout<<"【雌雄双股剑(2)】"<<endl;break;
case 303:cout<<"【青釭剑(2)】"<<endl;break;
case 304:cout<<"【青龙偃月刀(3)】"<<endl;break;
case 305:cout<<"【丈八蛇矛(3)】"<<endl;break;
case 306:cout<<"【贯石斧(3)】"<<endl;break;
case 307:cout<<"【方天画戟(4)】"<<endl;break;
case 308:cout<<"【麒麟弓(5)】"<<endl;break;
case 331:cout<<"【八卦阵】"<<endl;break;
case 361:cout<<"【赤兔(-1)】"<<endl;break;
case 362:cout<<"【大宛(-1)】"<<endl;break;
case 363:cout<<"【紫辛(-1)】"<<endl;break;
case 381:cout<<"【爪黄飞电(+1)】"<<endl;break;
case 382:cout<<"【的卢(+1)】"<<endl;break;
case 383:cout<<"【绝影(+1)】"<<endl;break;
default:printf("类型参数错误!");break;
}
}
};
void Qishixipai(pai A[2][4][13],pai paidui[104])
{
int i,m,x,y,z,a[104]={0};
srand((unsigned)time(NULL));
for(i=1;i<=104;i++)
{
while(a[m=rand()%104]);
a[m]=i;
}
for(i=0;i<=103;i++)
{
x=(a[i]-1)/52;
y=((a[i]-1)-52*x)/13;
z=(a[i]-1)%13;
paidui[i]=A[x][y][z];
}
}
void Xipai(pai paidui[104],int*paiduishu,pai qipaidui[104],int*qipaishu)
{
int i,m,a[104]={0};
srand((unsigned)time(NULL));
for(i=1;i<=(*qipaishu);i++)
{
while(a[m=rand()%(*qipaishu)]);
a[m]=i;
}
for(i=0;i<=((*qipaishu)-1);i++)
{
paidui[i]=qipaidui[a[i]];
qipaidui[a[i]].leixing=-1;
(*paiduishu)++;
(*qipaishu)--;
}
for(i=(*paiduishu);i<=103;i++)paidui[i].leixing=-1;
}
pai Mo1pai(pai A[104],int *x,pai B[104],int*y,int *b)
{
pai p;
if((*x)==0)Xipai(A,x,B,y);
else if((*x)<0)printf("摸牌参数错误!");
else;
p=A[104-(*x)];
(*x)--;
(*b)++;
return(p);
}
struct wujiang
{
char name;
int tili;
int tilishangxian;
int shoupaishangxian;
int huihekaishi;
int panding;
int mopai;
int chupai;
int qipai;
int huihejieshu;
int juese;
pai shoupai[20];
int shoupaishu;
pai zhuangbei[4];
int zhuangbeishu;
pai pandingpai[3];
int pandingshu;
int juli[1];
void Kanshoupai()
{
printf("玩家当前手牌:\n");
if(shoupaishu)
{
int m;
for(m=0;m<=(shoupaishu-1);m++)
{
printf("%d ",m);
(shoupai[m]).Kanpai();
}
}
else printf("空城!\n");
printf("\n");
}
void Kanzhuangbei()
{
if(juese)printf("玩家");
else printf("电脑");
printf("当前装备:\n");
printf("0 武器: ");
if((zhuangbei[0]).leixing==-1)printf("空\n");
else (zhuangbei[0]).Kanpai();
printf("1 防具: ");
if((zhuangbei[1]).leixing==-1)printf("空\n");
else (zhuangbei[1]).Kanpai();
printf("2 进攻马: ");
if((zhuangbei[2]).leixing==-1)printf("空\n");
else (zhuangbei[2]).Kanpai();
printf("3 防御马: ");
if((zhuangbei[3]).leixing==-1)printf("空\n");
else (zhuangbei[3]).Kanpai();
printf("\n");
}
void Kanpandingpai()
{
if(juese)printf("玩家");
else printf("电脑");
printf("当前判定区:\n");
if((pandingpai[0]).leixing==-1)printf("空\n");
else
{
printf("0 ");
(pandingpai[0]).Kanpai();
if((pandingpai[1]).leixing==-1);
else
{
printf("1 ");
(pandingpai[1]).Kanpai();
if((pandingpai[2]).leixing==-1);
else
{
printf("2 ");
(pandingpai[2]).Kanpai();
}
}
}
}
};
void Mopai(int*shoupaishu,pai shoupai[20],pai A[104],int *x,pai B[104],int*y,int juese)
{
if(juese)printf("玩家从牌堆摸2张牌\n");
else printf("电脑从牌堆摸2张牌\n");
pai p;
p=Mo1pai(A,x,B,y,shoupaishu);
shoupai[*shoupaishu-1]=p;
pai q;
q=Mo1pai(A,x,B,y,shoupaishu);
shoupai[*shoupaishu-1]=q;
int m;
if(juese)
{
printf("玩家当前手牌:\n");
for(m=0;m<=(*shoupaishu-1);m++)
{
printf("%d ",m);
(shoupai[m]).Kanpai();
}
}
printf("牌堆还剩%d张牌!\n\n",*x);
}
void Qishishoupai(wujiang *w,pai A[104],int *x,pai B[104],int*y)
{
pai a;
a=Mo1pai(A,x,B,y,&((*w).shoupaishu));
(*w).shoupai[(*w).shoupaishu-1]=a;
pai b;
b=Mo1pai(A,x,B,y,&((*w).shoupaishu));
(*w).shoupai[(*w).shoupaishu-1]=b;
pai c;
c=Mo1pai(A,x,B,y,&((*w).shoupaishu));
(*w).shoupai[(*w).shoupaishu-1]=c;
pai d;
d=Mo1pai(A,x,B,y,&((*w).shoupaishu));
(*w).shoupai[(*w).shoupaishu-1]=d;
int m;
if((*w).juese)printf("玩家从牌堆摸4张牌\n");
else printf("电脑从牌堆摸4张牌\n");
if((*w).juese)
{
printf("玩家当前手牌:\n");
for(m=0;m<=((*w).shoupaishu-1);m++)
{
printf("%d ",m);
((*w).shoupai[m]).Kanpai();
}
}
printf("牌堆还剩%d张牌!\n\n",*x);
}
void Panding(pai paidui[104],int*paiduishu,pai qipaidui[104],int*qipaishu)
{
paidui[*paiduishu].Kanpai();
qipaidui[*qipaishu]=paidui[*paiduishu];
(*paiduishu)--;
(*qipaishu)++;
}
pai Zhangba(wujiang*w,pai qipaidui[104],int*qipaishu)
{
int x,y;
pai p;
for(;;)
{
int i,j;
printf("请输入任意两张手牌之前的编号,以空格隔开,以回车结束!\n");
scanf("%d",&x);
scanf("%d",&y);
if((x>=0)&&(x<(*w).shoupaishu)&&(y>=0)&&(y<(*w).shoupaishu-1))
{
switch((((*w).shoupai[x].huase)%2)+(((*w).shoupai[y].huase)%2))
{
case 0:p.yanse=0;break;
case 2:p.yanse=1;break;
case 1:p.yanse=2;break;
default:printf("【丈八蛇矛】函数参数错误!\n");
}
qipaidui[*qipaishu]=(*w).shoupai[x];
(*w).shoupai[x].leixing=-1;
((*w).shoupaishu)--;
(*qipaishu)++;
qipaidui[*qipaishu]=(*w).shoupai[y];
(*w).shoupai[y].leixing=-1;
((*w).shoupaishu)--;
(*qipaishu)++; printf("弃牌数:%d",*qipaishu);
for(i=0;i<=(((*w).shoupaishu)+1);i++)
{
if((*w).shoupai[i].leixing==-1)
{
for(j=i+1;j<=(((*w).shoupaishu)+2);j++)
(*w).shoupai[j-1]=(*w).shoupai[j];
i--;
}
}
printf("玩家把:\n");
qipaidui[(*qipaishu)-2].Kanpai();
qipaidui[(*qipaishu)-1].Kanpai();
printf("当作一张");
switch(p.yanse)
{
case 0:printf("黑色");break;
case 2:printf("红色");break;
case 1:printf("无色");break;
default:printf("绿色");break;
}
printf("无点数的【杀】");
p.dianshu=-1;
p.leixing=101;
return p;
break;
}
printf("你将两张空气当作一张空气属性的【杀】使用或打出!\n");
}
}
int Xuanpai(wujiang*w,int t)
{
int x;
if((*w).juese)
{
for(;;)
{
printf("出牌请输入手牌之前的编号,以回车结束!\n如果你想结束出牌阶段,请输入“-1”,以回车结束!\n");
scanf("%d",&x);
if((x>=-1&&x<((*w).shoupaishu))||((x==100)&&((*w).zhuangbei[0].leixing==305)))
{
return x;
break;
}
printf("你打出了一张空气!\n");
}
}
else return t;
}
pai Panpai(wujiang*w1,int*sha,int y,pai qipaidui[104],int*qipaishu)
{
pai p,q;
p.leixing=0;
q.leixing=-1;
if(y==-1)return q;
else
{
if(y==100)
{
if((*sha)>0)
{
q=Zhangba(w1,qipaidui,qipaishu);
printf("使用!\n");
return q;
}
else
{
printf("当前回合使用【杀】的次数已用尽,你也不能使用【丈八蛇矛】效果!\n");
return p;
}
}
switch((*w1).shoupai[y].leixing)
{
case 101:
if(((*sha)>0)||((*w1).zhuangbei[0].leixing==301))
{
if(((*w1).zhuangbei[0].leixing==301))printf("武器【诸葛连弩】效果被触发!\n");
return (*w1).shoupai[y];
break;
}
else
{
if((*w1).juese)printf("当前回合使用【杀】的次数已用尽,你不能使用【杀】!\n");
return p;break;
}
case 102:
if((*w1).juese)
printf("当前不需要响应任何操作,你不能主动打出【闪】!\n");
return p;break;
case 103:
if(((*w1).tili)<((*w1).tilishangxian))
{
return (*w1).shoupai[y];
break;
}
else
{
if((*w1).juese)
printf("你并未受伤,不能对自己使用【桃】!\n");
}
return p;break;
case 210:
if((*w1).juese)
printf("当前不需要响应任何锦囊,你不能主动打出【无懈可击】!\n");
return p;break;
case 201:
case 202:
case 203:
case 204:
case 205:
case 206:
case 207:
case 208:
case 209:
case 251:
case 252:
case 301:
case 302:
case 303:
case 304:
case 305:
case 306:
case 307:
case 308:
case 331:
case 361:
case 362:
case 363:
case 381:
case 382:
case 383:return (*w1).shoupai[y];break;
default:printf("手牌类型参数错误!\n");return p;break;
}
}
}
int Mubiao(pai p,wujiang *w1,wujiang *w2,int*sha)
{
int x;
switch(p.leixing)
{
case 101:
if((*w1).juese)
{
printf("请选择【杀】的目标!\n输入目标前的编号,以回车结束!\n0 电脑1\n");
scanf("%d",&x);
if(x==0)
{
if((*w1).zhuangbei[0].changdu>=(*w1).juli[0])
{
(*sha)--;
return((*w2).juese);
}
else
{
printf("武器长度不够!\n");
return -2;
}
}
else
{
printf("目标错误!\n");
return -2;
}
}
else
{
if((*w1).zhuangbei[0].changdu>=(*w1).juli[0])
{
(*sha)--;
return((*w2).juese);
}
else return -2;
}
break;
case 103:return((*w1).juese);break;
case 201:
if((*w1).juese)
{
printf("请选择【过河拆桥】的目标!\n输入目标前的编号,以回车结束!\n0 电脑1\n");
scanf("%d",&x);
if(x==0)
{
if((*w2).shoupaishu||(*w2).zhuangbeishu||(*w2).pandingshu)return((*w2).juese);
else
{
printf("目标没有牌!\n");
return -2;
}
}
else
{
printf("目标错误!\n");
return -2;
}
}
else return((*w2).juese);
break;
case 202:
if((*w1).juese)
{
printf("请选择【顺手牵羊】的目标!\n输入目标前的编号,以回车结束!\n0 电脑1\n");
scanf("%d",&x);
if(x==0)
{
if(((*w2).shoupaishu||(*w2).zhuangbeishu||(*w2).pandingshu)&&((*w1).juli[0]<=1))return((*w2).juese);
else
{
printf("目标没有牌!\n");
return -2;
}
}
else
{
printf("目标错误!\n");
return -2;
}
}
else
{
if((*w1).juli[0]<=1)return((*w2).juese);
else return -2;
}
break;
case 203:
return((*w1).juese);break;
case 204:
if((*w1).juese)
{
printf("请选择【决斗】的目标!\n输入目标前的编号,以回车结束!\n0 电脑1\n");
scanf("%d",&x);
if(x==0)return((*w2).juese);
else
{
printf("目标错误!\n");
return -2;
}
}
else return((*w2).juese);
break;
case 205:
int y;
if((*w1).juese)
{
printf("请选择【借刀杀人】的目标!\n输入目标前的编号,以回车结束!\n0 电脑1\n");
scanf("%d",&x);
if(x!=0)
{
printf("目标错误!\n");
return -2;
}
else
{
if(((*w2).zhuangbei[0]).leixing<=300||((*w2).zhuangbei[0]).leixing>=331)
{
printf("目标装备区里没有武器!\n");
return -2;
}
else
{
printf("请选择【杀】的目标!\n提示:【杀】的目标必须在【借刀杀人】的目标的攻击范围之内!\n输入目标前的编号,以回车结束!\n0 玩家\n");
scanf("%d",&y);
if(y!=0)
{
printf("目标错误!\n");
return -2;
}
else
{
if(((*w2).zhuangbei[0].changdu)<(*w2).juli[0])
{
printf("武器距离不够!\n");
return -2;
}
else
return((*w2).juese);
}
}
}
}
else
{
if(((*w2).zhuangbei[0]).leixing<=300||((*w2).zhuangbei[0]).leixing>=331)return -2;
else
{
if(((*w2).zhuangbei[0].changdu)<(*w2).juli[0])return -2;
else return((*w2).juese);
}
}
break;
case 206:
case 207:return 99;break;
case 208:
case 209:return 100;break;
case 251:
if((*w1).juese)
{
printf("请选择【乐不思蜀】的目标!\n输入目标前的编号,以回车结束!\n0 电脑1\n");
scanf("%d",&x);
if(x==0)
{
int i;
for(i=0;i<=2;i++)
{
if((*w2).pandingpai[i].leixing==251)
i=-1;
break;
}
if(i==-1)
{
printf("目标判定区里不能同时存在两张相同的延时类锦囊!\n");
return -2;
}
else return((*w2).juese);
}
else
{
printf("目标错误!\n");
return -2;
}
}
else
{
int i;
for(i=0;i<=2;i++)
{
if((*w2).pandingpai[i].leixing==251)
i=-1;
break;
}
if(i==-1)return -2;
else return((*w2).juese);
}
break;
case 252:
int i;
for(i=0;i<=2;i++)
{
if((*w1).pandingpai[i].leixing==252)
i=-1;
break;
}
if(i==-1)
{
if((*w1).juese)printf("目标判定区里不能同时存在两张相同的延时类锦囊!\n");
return -2;
}
else return ((*w1).juese);
break;
case 301:
case 302:
case 303:
case 304:
case 305:
case 306:
case 307:
case 308:
case 331:
case 361:
case 362:
case 363:
case 381:
case 382:
case 383:return((*w1).juese);break;
default:return -2;break;
}
}
void Da1pai(wujiang *w1,wujiang*w2,pai qipaidui[104],int *qipaishu,int x)
{
int i;
if((x<0||x>=((*w1).shoupaishu))&&x!=100)
printf("你的牌呢?!\n");
else
{
switch(((*w1).shoupai)[x].leixing)
{
case 101:
case 102:
case 103:
case 201:
case 202:
case 203:
case 204:
case 205:
case 206:
case 207:
case 208:
case 209:
case 210:
qipaidui[*qipaishu]=((*w1).shoupai)[x];
for(i=x+1;i<=((*w1).shoupaishu);i++)((*w1).shoupai)[i-1]=((*w1).shoupai)[i];
((*w1).shoupaishu)--;
(*qipaishu)++;
break;
case 251:
for(i=1;i>=0;i--)(*w2).pandingpai[i+1]=(*w2).pandingpai[i];
(*w2).pandingpai[0]=(*w1).shoupai[x];
for(i=x+1;i<=((*w1).shoupaishu);i++)((*w1).shoupai)[i-1]=((*w1).shoupai)[i];
((*w1).shoupaishu)--;
((*w2).pandingshu)++;
break;
case 252:
for(i=1;i>=0;i--)(*w1).pandingpai[i+1]=(*w1).pandingpai[i];
(*w1).pandingpai[0]=(*w1).shoupai[x];
for(i=x+1;i<=((*w1).shoupaishu);i++)((*w1).shoupai)[i-1]=((*w1).shoupai)[i];
((*w1).shoupaishu)--;
((*w1).pandingshu)++;
break;
case 301:
case 302:
case 303:
case 304:
case 305:
case 306:
case 307:
case 308:
if((*w1).zhuangbei[0].leixing==-1)((*w1).zhuangbeishu)++;
else
{
qipaidui[*qipaishu]=((*w1).zhuangbei)[0];
(*qipaishu)++;
}
(*w1).zhuangbei[0]=(*w1).shoupai[x];
for(i=x+1;i<=((*w1).shoupaishu);i++)((*w1).shoupai)[i-1]=((*w1).shoupai)[i];
((*w1).shoupaishu)--;
break;
case 331:
if((*w1).zhuangbei[1].leixing==-1)((*w1).zhuangbeishu)++;
else
{
qipaidui[*qipaishu]=((*w1).zhuangbei)[1];
(*qipaishu)++;
}
(*w1).zhuangbei[1]=(*w1).shoupai[x];
for(i=x+1;i<=((*w1).shoupaishu);i++)((*w1).shoupai)[i-1]=((*w1).shoupai)[i];
((*w1).shoupaishu)--;
break;
case 361:
case 362:
case 363:
if((*w1).zhuangbei[2].leixing==-1)((*w1).zhuangbeishu)++;
else
{
qipaidui[*qipaishu]=((*w1).zhuangbei)[2];
(*qipaishu)++;
}
(*w1).zhuangbei[2]=(*w1).shoupai[x];
for(i=x+1;i<=((*w1).shoupaishu);i++)((*w1).shoupai)[i-1]=((*w1).shoupai)[i];
((*w1).shoupaishu)--;
break;
case 381:
case 382:
case 383:
if((*w1).zhuangbei[3].leixing==-1)((*w1).zhuangbeishu)++;
else
{
qipaidui[*qipaishu]=((*w1).zhuangbei)[3];
(*qipaishu)++;
}
(*w1).zhuangbei[3]=(*w1).shoupai[x];
for(i=x+1;i<=((*w1).shoupaishu);i++)((*w1).shoupai)[i-1]=((*w1).shoupai)[i];
((*w1).shoupaishu)--;
break;
default:break;
}
}
}
void Miaoshu(pai p,int juese,int duixiang)
{
if(juese==0)printf("电脑");
else if(juese==1)printf("玩家");
else printf("角色参数错误!\n");
if(p.leixing<=300&&p.leixing>100)
{
switch(duixiang)
{
case -1:printf("打出");break;
case 0:printf("对电脑使用");break;
case 1:printf("对玩家使用");break;
case 99:printf("使用");break;
case 100:printf("对所有人使用");break;
default:printf("对象参数错误\n");break;
}
}
else if(p.leixing>=301&&p.leixing<=400)
printf("装备");
else printf("你出的是什么东西?\n");
p.Kanpai();
if(!juese&&(p.leixing==101||p.leixing==204||p.leixing==205||p.leixing==207||p.leixing==208||p.leixing==209))printf("请响应!\n");
}
int Wuxie(pai *p,wujiang*w1,wujiang*w2,pai qipaidui[104],int*qipaishu,int a)
{
int x;
if((*w1).juese)
{
printf("是否使用【无懈可击】响应?\n\n");
for(;;)
{
(*w1).Kanshoupai();
printf("如果要使用【无懈可击】请输入手牌之前编号,不需要请输入“-1”,以回车结束!\n");
scanf("%d",&x);
if(x==-1)
{
for(x=0;x<((*w2).shoupaishu);x++)
{
if((*w2).shoupai[x].leixing==210)
{
printf("电脑使用");
((*w2).shoupai)[x].Kanpai();
printf("对象是");
(*p).Kanpai();
(*p)=((*w2).shoupai)[x];
qipaidui[*qipaishu]=((*w2).shoupai)[x];
for(int i=x+1;i<=((*w2).shoupaishu);i++)((*w2).shoupai)[i-1]=((*w2).shoupai)[i];
((*w2).shoupaishu)--;
(*qipaishu)++;
a++;
break;
}
}
break;
}
else if((*w1).shoupai[x].leixing==210)
{
printf("玩家使用");
((*w1).shoupai)[x].Kanpai();
printf("对象是");
(*p).Kanpai();
(*p)=((*w1).shoupai)[x];
qipaidui[*qipaishu]=((*w1).shoupai)[x];
for(int i=x+1;i<=((*w1).shoupaishu);i++)((*w1).shoupai)[i-1]=((*w1).shoupai)[i];
((*w1).shoupaishu)--;
(*qipaishu)++;
(*w1).Kanshoupai();
a++;
break;
}
else printf("你确定你使用的是【无懈可击】?\n");
}
}
else
{
printf("是否使用【无懈可击】响应?\n");
for(;;)
{
(*w2).Kanshoupai();
printf("如果要使用【无懈可击】请输入手牌之前编号,不需要请输入“-1”,以回车结束!\n");
scanf("%d",&x);
if(x==-1)break;
else if((*w2).shoupai[x].leixing==210)
{
printf("玩家使用");
((*w2).shoupai)[x].Kanpai();
printf("对象是");
(*p).Kanpai();
(*p)=((*w2).shoupai)[x];
qipaidui[*qipaishu]=((*w2).shoupai)[x];
for(int i=x+1;i<=((*w2).shoupaishu);i++)((*w2).shoupai)[i-1]=((*w2).shoupai)[i];
((*w2).shoupaishu)--;
(*qipaishu)++;
(*w2).Kanshoupai();
a++;
break;
}
else printf("你确定你使用的是【无懈可击】?\n");
}
}
return a;
}
int Qiutao(wujiang*w,pai qipaidui[104],int*qipaishu)
{
int x;
if((*w).juese)
{
for(;;)
{
printf("如果要使用【桃】请输入手牌之前的编号,不需要请输入“-1”,以回车结束!\n");
scanf("%d",&x);
if(x==-1)
{
return -1;
break;
}
else if((*w).shoupai[x].leixing==103)
{
qipaidui[*qipaishu]=((*w).shoupai)[x];
for(int i=x+1;i<=((*w).shoupaishu);i++)((*w).shoupai)[i-1]=((*w).shoupai)[i];
((*w).shoupaishu)--;
(*qipaishu)++;
return 0;
break;
}
else printf("你确定你使用的是【桃】?\n");
}
}
else
{
for(x=0;x<((*w).shoupaishu);x++)
{
if((*w).shoupai[x].leixing==103)
{
qipaidui[*qipaishu]=((*w).shoupai)[x];
for(int i=x+1;i<=((*w).shoupaishu);i++)((*w).shoupai)[i-1]=((*w).shoupai)[i];
((*w).shoupaishu)--;
(*qipaishu)++;
return 0;
break;
}
}
return -1;
}
}
int Binsi(wujiang*w1,wujiang*w2,pai qipaidui[104],int*qipaishu)
{
if(((*w2).tili)>0)return 0;
else
{
int i;
if((*w1).juese)
{
for(;;)
{
printf("电脑濒死,是否使用【桃】?\n");
i=Qiutao(w1,qipaidui,qipaishu);
if(i==0)((*w2).tili)++;
if((i==-1)||((*w2).tili>0))break;
}
if((*w2).tili>0)return 0;
else
{
for(;;)
{
i=Qiutao(w2,qipaidui,qipaishu);
if(i==0)((*w2).tili)++;
if((i==-1)||((*w2).tili>0))break;
}
if((*w2).tili>0)return 0;
else return -1;
}
}
else
{
for(;;)
{
printf("玩家濒死,是否使用【桃】?\n");
i=Qiutao(w2,qipaidui,qipaishu);
if(i==0)((*w2).tili)++;
if((i==-1)||((*w2).tili>0))break;
}
if((*w2).tili>0)return 0;
else return -1;
}
}
}
int Shan(wujiang*w1,wujiang*w2,pai paidui[104],int*paiduishu,pai qipaidui[104],int*qipaishu)
{
int x;
if((*w2).juese)
{
if(((*w2).zhuangbei[1].leixing==331)&&((*w1).zhuangbei[0].leixing!=303))
{
for(;;)
{
int m;
printf("是否发动【八卦阵】防具效果?\n0 否\n1 是\n请输入选项之前的编号,以回车结束!\n");
scanf("%d",&m);
if(m==1)
{
Panding(paidui,paiduishu,qipaidui,qipaishu);
if(qipaidui[(*qipaishu)-1].huase%2)
{
printf("【八卦阵】判定成功!\n");
return 0;
}
}
else if(m==0)
{
printf("【八卦阵】判定失败!\n");
break;
}
else printf("你确定你输入的是“0”或“1”?\n");
}
}
else if(((*w2).zhuangbei[1].leixing==331)&&((*w1).zhuangbei[0].leixing==303))printf("【青釭剑】锁定技被触发!\n");
for(;;)
{
printf("请输入手牌之前的编号,或者输入“-1”放弃打出【闪】,以回车结束!\n");
scanf("%d",&x);
if(x==-1)
{
return -1;
break;
}
else if((*w2).shoupai[x].leixing==102)
{
printf("玩家打出");
((*w2).shoupai)[x].Kanpai();
qipaidui[*qipaishu]=((*w2).shoupai)[x];
for(int i=x+1;i<=((*w2).shoupaishu);i++)((*w2).shoupai)[i-1]=((*w2).shoupai)[i];
((*w2).shoupaishu)--;
(*qipaishu)++;
return 0;
break;
}
else printf("你确定你打出的是【闪】?\n");
}
}
else
{
if(((*w2).zhuangbei[1].leixing==331)&&((*w1).zhuangbei[0].leixing!=303))
{
Panding(paidui,paiduishu,qipaidui,qipaishu);
if(qipaidui[(*qipaishu)-1].huase%2)
{
printf("【八卦阵】判定成功!\n");
return 0;
}
else printf("【八卦阵】判定失败!\n");
}
else if(((*w2).zhuangbei[1].leixing==331)&&((*w1).zhuangbei[0].leixing==303))printf("【青釭剑】锁定技被触发!\n");
int i;
for(x=0;x<((*w2).shoupaishu);x++)
{
if((*w2).shoupai[x].leixing==102)
{
printf("电脑打出");
((*w2).shoupai)[x].Kanpai();
qipaidui[*qipaishu]=((*w2).shoupai)[x];
for(i=x+1;i<=((*w2).shoupaishu);i++)((*w2).shoupai)[i-1]=((*w2).shoupai)[i];
((*w2).shoupaishu)--;
(*qipaishu)++;
return 0;
break;
}
}
return -1;
}
}
int Sha(wujiang *w1,wujiang*w2,pai paidui[104],int*paiduishu,pai qipaidui[104],int*qipaishu)
{
int x;
if((*w2).juese)
{
printf("请打出【闪】响应【杀】!否则你将受到1点伤害!\n");
x=Shan(w1,w2,paidui,paiduishu,qipaidui,qipaishu);
if(x==-1)
{
int i;
((*w2).tili)--;
printf("电脑对玩家造成1点伤害!\n");
i=Binsi(w1,w2,qipaidui,qipaishu);
return i;
}
else if(x==0&&((*w1).zhuangbei[0].leixing==306))
{
int i;
if(((*w1).shoupaishu)>=2)
{
printf("电脑弃掉:\n");
((*w1).shoupai)[0].Kanpai();
qipaidui[*qipaishu]=((*w1).shoupai)[0];
for(i=1;i<=((*w1).shoupaishu);i++)((*w1).shoupai)[i-1]=((*w1).shoupai)[i];
((*w1).shoupaishu)--;
(*qipaishu)++;
((*w1).shoupai)[0].Kanpai();
qipaidui[*qipaishu]=((*w1).shoupai)[0];
for(i=1;i<=((*w1).shoupaishu);i++)((*w1).shoupai)[i-1]=((*w1).shoupai)[i];
((*w1).shoupaishu)--;
(*qipaishu)++;
printf("发动【贯石斧】武器效果使【杀】造成伤害!\n");
((*w2).tili)--;
i=Binsi(w1,w2,qipaidui,qipaishu);
return i;
}
else return 0;
}
else if(x==0&&((*w1).zhuangbei[0].leixing==304))
{
int i;
for(x=0;x<((*w1).shoupaishu);x++)
{
if((*w1).shoupai[x].leixing==101)
{
printf("电脑发动【青龙偃月刀】效果对玩家使用");
((*w1).shoupai)[x].Kanpai();
qipaidui[*qipaishu]=((*w1).shoupai)[x];
for(i=x+1;i<=((*w1).shoupaishu);i++)((*w1).shoupai)[i-1]=((*w1).shoupai)[i];
((*w1).shoupaishu)--;
(*qipaishu)++;
i=Sha(w1,w2,paidui,paiduishu,qipaidui,qipaishu);
return i;
break;
}
}
return 0;
}
}
else
{
x=Shan(w1,w2,paidui,paiduishu,qipaidui,qipaishu);
if(x==-1)
{
if((*w1).zhuangbei[0].leixing==308)
{
for(;;)
{
printf("是否发动【麒麟弓】武器效果?\n0 否\n1 是\n");
scanf("%d",&x);
if(x==1)
{
if(((*w2).zhuangbei[2].leixing==-1)&&((*w2).zhuangbei[3].leixing==-1))
{
printf("电脑根本没有马,射你妹的马啊!\n");
break;
}
else
{
for(;;)
{
printf("0 ");
((*w2).zhuangbei[2]).Kanpai();
printf("1 ");
((*w2).zhuangbei[3]).Kanpai();
printf("请选择要弃掉的马,输入之前的编号,以回车结束!\n");
scanf("%d",&x);
if((x==0)&&((*w2).zhuangbei[2].leixing!=-1))
{
printf("你弃掉了电脑的");
((*w2).zhuangbei)[2].Kanpai();
qipaidui[*qipaishu]=((*w2).zhuangbei)[2];
((*w2).zhuangbeishu)--;
(*qipaishu)++;
((*w2).zhuangbei)[2].leixing=-1;
((*w2).juli[0])++;
break;
}
else if((x==1)&&((*w2).zhuangbei[3].leixing!=-1))
{
printf("你弃掉了电脑的");
((*w2).zhuangbei)[3].Kanpai();
qipaidui[*qipaishu]=((*w2).zhuangbei)[3];
((*w2).zhuangbeishu)--;
(*qipaishu)++;
((*w2).zhuangbei)[3].leixing=-1;
((*w1).juli[0])--;
break;
}
else printf("射你妹的马!");
}
break;
}
}
else if(x==0)break;
else printf("键盘上的“0”和“1”被你吃了吗?\n");
}
}
int i;
((*w2).tili)--;
printf("玩家对电脑造成1点伤害!\n");
i=Binsi(w1,w2,qipaidui,qipaishu);
return i;
}
else if(x==0&&((*w1).zhuangbei[0].leixing==306))
{
for(;;)
{
printf("是否发动【贯石斧】武器效果?\n0 否\n1 是\n");
scanf("%d",&x);
if(x==1)
{
int i;
if((*w1).shoupaishu+(*w1).zhuangbeishu<=2)
{
printf("你除了【贯石斧】以外连2张牌都没有,发动你妹的效果!\n");
break;
}
else
{
printf("请分别弃掉两张牌!\n");
for(i=0;i<=2;i++)
{
for(;;)
{
printf("请选择区域:\n0 手牌\n1 装备\n");
scanf("%d",&x);
if(x==0&&((*w1).shoupaishu==0))printf("你根本没有手牌,弃你妹啊!\n");
else if(x==1&&((*w1).zhuangbeishu==1))printf("你根本没有别的装备,弃你妹啊!\n");
else if(x>=0&&x<=1)break;
else printf("键盘上的“0”和“1”被你吃了吗?\n");
}
if(x==0)
{
for(;;)
{
(*w1).Kanshoupai();
printf("弃牌请输入手牌之前的编号,以回车结束!\n");
scanf("%d",&x);
if(x>=0&&x<((*w1).shoupaishu))break;
else printf("弃你妹的手牌!\n");
}
printf("你弃掉了");
((*w1).shoupai)[x].Kanpai();
qipaidui[*qipaishu]=((*w1).shoupai)[x];
for(i=x+1;i<=((*w1).shoupaishu);i++)((*w1).shoupai)[i-1]=((*w1).shoupai)[i];
((*w1).shoupaishu)--;
(*qipaishu)++;
}
else
{
for(;;)
{
(*w1).Kanzhuangbei();
printf("请输入装备之前的编号,以回车键结束!\n");
scanf("%d",&x);
if((((*w1).zhuangbei[x]).leixing!=-1)&&(x>=0)&&(x<=3))
{
printf("你弃掉了");
((*w1).zhuangbei)[x].Kanpai();
qipaidui[*qipaishu]=((*w1).zhuangbei)[x];
((*w1).zhuangbeishu)--;
(*qipaishu)++;
((*w1).zhuangbei)[x].leixing=-1;
break;
}
else printf("弃你妹的装备!\n");
}
}
}
}
printf("玩家发动【贯石斧】武器效果使【杀】造成伤害!\n");
((*w2).tili)--;
i=Binsi(w1,w2,qipaidui,qipaishu);
return i;
break;
}
else if(x==0)break;
else printf("键盘上的“0”和“1”被你吃了吗?\n");
}
}
else if(x==0&&((*w1).zhuangbei[0].leixing==304))
{
for(;;)
{
printf("是否发动【青龙偃月刀】武器效果?\n0 否\n1 是\n");
scanf("%d",&x);
if(x==1)
{
for(;;)
{
printf("请对电脑使用一张【杀】!\n请输入手牌之前的编号,或者输入“-1”放弃出【杀】,以回车结束!\n");
(*w1).Kanshoupai();
scanf("%d",&x);
if(x==-1)
{
return 0;
break;
}
else if((*w1).shoupai[x].leixing==101)
{
int i;
printf("玩家对电脑使用");
((*w1).shoupai)[x].Kanpai();
qipaidui[*qipaishu]=((*w1).shoupai)[x];
for(i=x+1;i<=((*w1).shoupaishu);i++)((*w1).shoupai)[i-1]=((*w1).shoupai)[i];
((*w1).shoupaishu)--;
(*qipaishu)++;
i=Sha(w1,w2,paidui,paiduishu,qipaidui,qipaishu);
return i;
break;
}
else printf("你确定你打出的是【杀】?\n");
}
}
else if(x==0)
{
return 0;
break;
}
else printf("你确定你输入的是“0”或“1”?\n");
}
}
else return 0;
}
return 0;
}
void Tao(wujiang*w1)
{
((*w1).tili)++;
if((*w1).juese)printf("玩家");
else printf("电脑");
printf("恢复了1点体力!\n");
if(((*w1).tili)>((*w1).tilishangxian))printf("你被撑死了!\n");
}
void Chai(wujiang*w1,wujiang*w2,pai qipaidui[104],int*qipaishu)
{
int i,x,y;
if((*w1).juese)
{
for(;;)
{
if((*w2).shoupaishu+(*w2).zhuangbeishu+(*w2).pandingshu==0)
{
printf("对方空城,拆你妹啊!\n");
break;
}
else
{
printf("请选择想拆的区域,输入选项之前的编号,以回车结束!\n0 手牌\n1 装备区\n2 判定区\n");
scanf("%d",&x);
if(x==0&&((*w2).shoupaishu==0))printf("你拆掉了一张空气!\n");
else if(x==1&&((*w2).zhuangbeishu==0))printf("你拆掉了一张空气!\n");
else if(x==2&&((*w2).pandingshu==0))printf("你拆掉了一张空气!\n");
else if(x>=0&&x<=2)break;
else printf("你拆掉了太空区里的一张牌!\n");
}
}
switch(x)
{
case 0:
srand((unsigned)time(NULL));
y=rand()%((*w2).shoupaishu);
printf("你弃掉了电脑的");
((*w2).shoupai)[y].Kanpai();
qipaidui[*qipaishu]=((*w2).shoupai)[y];
for(i=y+1;i<=((*w2).shoupaishu);i++)((*w2).shoupai)[i-1]=((*w2).shoupai)[i];
((*w2).shoupaishu)--;
(*qipaishu)++;
break;
case 1:
for(;;)
{
(*w2).Kanzhuangbei();
printf("请输入装备之前的编号,以回车键结束!\n");
scanf("%d",&y);
if((((*w2).zhuangbei[y]).leixing!=-1)&&(y>=0)&&(y<=3))
{
printf("你弃掉了电脑的");
((*w2).zhuangbei)[y].Kanpai();
qipaidui[*qipaishu]=((*w2).zhuangbei)[y];
((*w2).zhuangbeishu)--;
(*qipaishu)++;
((*w2).zhuangbei)[y].leixing=-1;
if(!y)((*w2).zhuangbei)[y].changdu=1;
else if(y==2)((*w2).juli[0])++;
else if(y==3)((*w1).juli[0])--;
break;
}
else printf("你弃掉了一张空气!\n");
}
break;
case 2:
for(;;)
{
(*w2).Kanpandingpai();
printf("请输入判定牌之前的编号,以回车键结束!\n");
scanf("%d",&y);
if((*w2).pandingpai[y].leixing!=-1)
{
printf("你弃掉了电脑的");
((*w2).pandingpai)[y].Kanpai();
qipaidui[*qipaishu]=((*w2).pandingpai)[y];
((*w2).pandingshu)--;
(*qipaishu)++;
((*w2).pandingpai)[y].leixing=-1;
break;
}
else printf("你弃掉了一张空气!\n");
}
break;
default:break;
}
}
else
{
if((*w2).zhuangbeishu)
{
if((*w2).zhuangbei[1].leixing!=-1)
{
printf("电脑弃掉了玩家的");
((*w2).zhuangbei)[1].Kanpai();
qipaidui[*qipaishu]=((*w2).zhuangbei)[1];
((*w2).zhuangbeishu)--;
(*qipaishu)++;
((*w2).zhuangbei)[1].leixing=-1;
}
else if((*w2).zhuangbei[3].leixing!=-1)
{
printf("电脑弃掉了玩家的");
((*w2).zhuangbei)[3].Kanpai();
qipaidui[*qipaishu]=((*w2).zhuangbei)[3];
((*w2).zhuangbeishu)--;
(*qipaishu)++;
((*w2).zhuangbei)[3].leixing=-1;
((*w1).juli[0])--;
}
else if((*w2).zhuangbei[0].leixing!=-1)
{
printf("电脑弃掉了玩家的");
((*w2).zhuangbei)[0].Kanpai();
qipaidui[*qipaishu]=((*w2).zhuangbei)[0];
((*w2).zhuangbeishu)--;
(*qipaishu)++;
((*w2).zhuangbei)[0].leixing=-1;
((*w2).zhuangbei)[0].changdu=1;
}
else
{
printf("电脑弃掉了玩家的");
((*w2).zhuangbei)[2].Kanpai();
qipaidui[*qipaishu]=((*w2).zhuangbei)[2];
((*w2).zhuangbeishu)--;
(*qipaishu)++;
((*w2).zhuangbei)[2].leixing=-1;
((*w2).juli[0])++;
}
}
else
{
srand((unsigned)time(NULL));
y=rand()%((*w2).shoupaishu);
printf("电脑弃掉了玩家的手牌");
((*w2).shoupai)[y].Kanpai();
qipaidui[*qipaishu]=((*w2).shoupai)[y];
for(i=y+1;i<=((*w2).shoupaishu);i++)((*w2).shoupai)[i-1]=((*w2).shoupai)[i];
((*w2).shoupaishu)--;
(*qipaishu)++;
}
}
}
void Qian(wujiang *w1,wujiang *w2)
{
int i,x,y;
if((*w1).juese)
{
for(;;)
{
if((*w2).shoupaishu+(*w2).zhuangbeishu+(*w2).pandingshu==0)
{
printf("对方空城啦!你牵走了一张寂寞!\n");
break;
}
else
{
printf("请选择想牵的区域,输入选项之前的编号,以回车结束!\n0 手牌\n1 装备区\n2 判定区\n");
scanf("%d",&x);
if(x==0&&((*w2).shoupaishu==0))printf("你牵走了一张空气!\n");
else if(x==1&&((*w2).zhuangbeishu==0))printf("你牵走了一张空气!\n");
else if(x==2&&((*w2).pandingshu==0))printf("你牵走了一张空气!\n");
else if(x>=0&&x<=2)break;
else printf("你牵走了太空区里的一张牌!\n");
}
}
switch(x)
{
case 0:
srand((unsigned)time(NULL));
y=rand()%((*w2).shoupaishu);
printf("你牵走了电脑的");
((*w2).shoupai)[y].Kanpai();
(*w1).shoupai[(*w1).shoupaishu]=((*w2).shoupai)[y];
for(i=y+1;i<=((*w2).shoupaishu);i++)((*w2).shoupai)[i-1]=((*w2).shoupai)[i];
((*w2).shoupaishu)--;
((*w1).shoupaishu)++;
break;
case 1:
for(;;)
{
(*w2).Kanzhuangbei();
printf("请输入装备之前的编号,以回车键结束!\n");
scanf("%d",&y);
if((((*w2).zhuangbei[y]).leixing!=-1)&&(y>=0)&&(y<=3))
{
printf("你牵走了电脑的");
((*w2).zhuangbei)[y].Kanpai();
(*w1).shoupai[(*w1).shoupaishu]=((*w2).zhuangbei)[y];
((*w2).zhuangbeishu)--;
((*w1).shoupaishu)++;
((*w2).zhuangbei)[y].leixing=-1;
if(!y)((*w2).zhuangbei[y]).changdu=1;
else if(y==2)((*w2).juli[0])++;
else if(y==3)((*w1).juli[0])--;
break;
}
else printf("你弃掉了一张空气!\n");
}
break;
case 2:
for(;;)
{
(*w2).Kanpandingpai();
printf("请输入判定牌之前的编号,以回车键结束!\n");
scanf("%d",&y);
if((*w2).pandingpai[y].leixing!=-1)
{
printf("你牵走了电脑的");
((*w2).pandingpai)[y].Kanpai();
(*w1).shoupai[(*w1).shoupaishu]=((*w2).pandingpai)[y];
((*w2).pandingshu)--;
((*w1).shoupaishu)++;
((*w2).pandingpai)[y].leixing=-1;
break;
}
else printf("你牵走了一张空气!\n");
}
break;
default:break;
}
}
else
{
if((*w2).zhuangbeishu)
{
if((*w2).zhuangbei[1].leixing!=-1)
{
printf("电脑牵走了玩家的");
((*w2).zhuangbei)[1].Kanpai();
(*w1).shoupai[(*w1).shoupaishu]=((*w2).zhuangbei)[1];
((*w2).zhuangbeishu)--;
((*w1).shoupaishu)++;
((*w2).zhuangbei)[1].leixing=-1;
}
else if((*w2).zhuangbei[3].leixing!=-1)
{
printf("电脑牵走了玩家的");
((*w2).zhuangbei)[3].Kanpai();
(*w1).shoupai[(*w1).shoupaishu]=((*w2).zhuangbei)[3];
((*w2).zhuangbeishu)--;
((*w1).shoupaishu)++;
((*w2).zhuangbei)[3].leixing=-1;
((*w1).juli[0])--;
}
else if((*w2).zhuangbei[0].leixing!=-1)
{
printf("电脑牵走了玩家的");
((*w2).zhuangbei)[0].Kanpai();
(*w1).shoupai[(*w1).shoupaishu]=((*w2).zhuangbei)[0];
((*w2).zhuangbeishu)--;
((*w1).shoupaishu)++;
((*w2).zhuangbei)[0].leixing=-1;
((*w2).zhuangbei)[0].changdu=1;
}
else
{
printf("电脑牵走了玩家的");
((*w2).zhuangbei)[2].Kanpai();
(*w1).shoupai[(*w1).shoupaishu]=((*w2).zhuangbei)[2];
((*w2).zhuangbeishu)--;
((*w1).shoupaishu)++;
((*w2).zhuangbei)[2].leixing=-1;
((*w2).juli[0])--;
}
}
else
{
srand((unsigned)time(NULL));
y=rand()%((*w2).shoupaishu);
printf("电脑牵走了玩家的手牌");
((*w2).shoupai)[y].Kanpai();
(*w1).shoupai[(*w1).shoupaishu]=((*w2).shoupai)[y];
for(i=y+1;i<=((*w2).shoupaishu);i++)((*w2).shoupai)[i-1]=((*w2).shoupai)[i];
((*w2).shoupaishu)--;
((*w1).shoupaishu)++;
}
}
}
void Wuzhong(wujiang*w1,pai A[104],int *x,pai B[104],int*y)
{
Mopai(&((*w1).shoupaishu),(*w1).shoupai,A,x,B,y,(*w1).juese);
}
int Juedou(wujiang*w1,wujiang*w2,pai qipaidui[104],int*qipaishu)
{
int i,j,x;
if((*w1).juese)
{
for(;;)
{
j=0;
for(x=0;x<((*w2).shoupaishu);x++)
{
if((*w2).shoupai[x].leixing==101)
{
printf("电脑打出");
((*w2).shoupai)[x].Kanpai();
qipaidui[*qipaishu]=((*w2).shoupai)[x];
for(int i=x+1;i<=((*w2).shoupaishu);i++)((*w2).shoupai)[i-1]=((*w2).shoupai)[i];
((*w2).shoupaishu)--;
(*qipaishu)++;
j=1;
break;
}
}
if(!j)
{
printf("玩家对电脑造成1点伤害!\n");
((*w2).tili)--;
i=Binsi(w1,w2,qipaidui,qipaishu);
return i;
break;
}
j=0;
for(;;)
{
printf("请打出一张【杀】响应【决斗】,否则你将受到1点伤害!\n请输入手牌之前的编号,或者输入“-1”放弃出【杀】,以回车结束!\n");
if(((*w1).zhuangbei[0].leixing==305))printf("如果想发动【丈八蛇矛】效果,请输入“100”,以回车结束!\n");
(*w1).Kanshoupai();
scanf("%d",&x);
if(x==-1)
{
int i;
((*w1).tili)--;
printf("电脑对玩家造成1点伤害!\n");
i=Binsi(w2,w1,qipaidui,qipaishu);
return i;
break;
}
else if(((*w1).zhuangbei[0].leixing==305)&&x==100)
{
pai p=Zhangba(w1,qipaidui,qipaishu);
p.paifu=-1;
printf("打出!\n");
j=1;
break;
}
else if((*w1).shoupai[x].leixing==101)
{
printf("玩家打出");
((*w1).shoupai)[x].Kanpai();
qipaidui[*qipaishu]=((*w1).shoupai)[x];
for(i=x+1;i<=((*w1).shoupaishu);i++)((*w1).shoupai)[i-1]=((*w1).shoupai)[i];
((*w1).shoupaishu)--;
(*qipaishu)++;
j=1;
break;
}
else printf("你确定你打出的是【杀】?\n");
}
}
}
else
{
for(;;)
{
j=0;
for(;;)
{
printf("请打出一张【杀】响应【决斗】,否则你将受到1点伤害!\n请输入手牌之前的编号,或者输入“-1”放弃出【杀】,以回车结束!\n");
if(((*w1).zhuangbei[0].leixing==305))printf("如果想发动【丈八蛇矛】效果,请输入“100”,以回车结束!\n");
(*w2).Kanshoupai();
scanf("%d",&x);
if(x==-1)
{
int i;
((*w2).tili)--;
printf("电脑对玩家造成1点伤害!\n");
i=Binsi(w1,w2,qipaidui,qipaishu);
return i;
break;
}
else if(((*w2).zhuangbei[0].leixing==305)&&x==100)
{
pai p=Zhangba(w2,qipaidui,qipaishu);
p.paifu=-1;
printf("打出!\n");
j=1;
break;
}
else if((*w2).shoupai[x].leixing==101)
{
printf("玩家打出");
((*w2).shoupai)[x].Kanpai();
qipaidui[*qipaishu]=((*w2).shoupai)[x];
for(i=x+1;i<=((*w2).shoupaishu);i++)((*w2).shoupai)[i-1]=((*w2).shoupai)[i];
((*w2).shoupaishu)--;
(*qipaishu)++;
j=1;
break;
}
else printf("你确定你打出的是【杀】?\n");
}
j=0;
for(x=0;x<((*w1).shoupaishu);x++)
{
if((*w1).shoupai[x].leixing==101)
{
printf("电脑打出");
((*w1).shoupai)[x].Kanpai();
qipaidui[*qipaishu]=((*w1).shoupai)[x];
for(int i=x+1;i<=((*w1).shoupaishu);i++)((*w1).shoupai)[i-1]=((*w1).shoupai)[i];
((*w1).shoupaishu)--;
(*qipaishu)++;
j=1;
break;
}
}
if(!j)
{
printf("玩家对电脑造成1点伤害!\n");
((*w2).tili)--;
i=Binsi(w2,w1,qipaidui,qipaishu);
return i;
break;
}
}
}
}
int Jiedao(wujiang*w1,wujiang*w2,pai paidui[104],int*paiduishu,pai qipaidui[104],int*qipaishu)
{
int i,j=0,x;
if((*w1).juese)
{
for(x=0;x<((*w2).shoupaishu);x++)
{
if((*w2).shoupai[x].leixing==101)
{
printf("电脑对玩家使用");
((*w2).shoupai)[x].Kanpai();
qipaidui[*qipaishu]=((*w2).shoupai)[x];
for(int i=x+1;i<=((*w2).shoupaishu);i++)((*w2).shoupai)[i-1]=((*w2).shoupai)[i];
((*w2).shoupaishu)--;
(*qipaishu)++;
j=1;
break;
}
}
if(j)
{
i=Sha(w2,w1,paidui,paiduishu,qipaidui,qipaishu);
return i;
printf("玩家当前体力值:%d/%d\n电脑当前体力值:%d/%d\n",(*w1).tili,(*w1).tilishangxian,(*w2).tili,(*w2).tilishangxian);
}
else
{
printf("电脑放弃使用【杀】,玩家获得电脑的武器");
(*w2).zhuangbei[0].Kanpai();
(*w1).shoupai[(*w1).shoupaishu]=((*w2).zhuangbei)[0];
((*w2).zhuangbeishu)--;
((*w1).shoupaishu)++;
((*w2).zhuangbei)[0].leixing=-1;
((*w2).zhuangbei)[0].changdu=1;
(*w1).Kanshoupai();
return 0;
}
}
else
{
for(;;)
{
printf("请对电脑使用一张【杀】,否则电脑将获得你的武器!\n请输入手牌之前的编号,或者输入“-1”放弃出【杀】,以回车结束!\n");
if(((*w2).zhuangbei[0].leixing==305))printf("如果想发动【丈八蛇矛】效果,请输入“100”,以回车结束!\n");
(*w2).Kanshoupai();
scanf("%d",&x);
if(x==-1)break;
else if(((*w2).zhuangbei[0].leixing==305)&&x==100)
{
pai p=Zhangba(w2,qipaidui,qipaishu);
p.paifu=-1;
printf("使用!\n");
j=1;
break;
}
else if((*w2).shoupai[x].leixing==101)
{
printf("玩家对电脑使用");
((*w2).shoupai)[x].Kanpai();
qipaidui[*qipaishu]=((*w2).shoupai)[x];
for(i=x+1;i<=((*w2).shoupaishu);i++)((*w2).shoupai)[i-1]=((*w2).shoupai)[i];
((*w2).shoupaishu)--;
(*qipaishu)++;
j=1;
break;
}
else printf("你确定你使用的是【杀】?\n");
}
if(j)
{
i=Sha(w2,w1,paidui,paiduishu,qipaidui,qipaishu);
return i;
printf("玩家当前体力值:%d/%d\n电脑当前体力值:%d/%d\n",(*w2).tili,(*w2).tilishangxian,(*w1).tili,(*w1).tilishangxian);
}
else
{
printf("玩家放弃使用【杀】,电脑获得玩家的武器");
((*w2).zhuangbei)[0].Kanpai();
(*w1).shoupai[(*w1).shoupaishu]=((*w2).zhuangbei)[0];
((*w2).zhuangbeishu)--;
((*w1).shoupaishu)++;
((*w2).zhuangbei)[0].leixing=-1;
((*w2).zhuangbei)[0].changdu=1;
return 0;
}
}
}
void Taoyuan(wujiang*w)
{
if((*w).tili<(*w).tilishangxian)
{
((*w).tili)++;
if((*w).juese)printf("玩家");
else printf("电脑");
printf("恢复1点体力!\n");
}
}
void Kaipai(pai paidui[104],int* paiduishu,int renshu,pai wugu[10])
{
int i;
printf("五谷丰登开牌:\n");
for(i=1;i<=renshu;i++)
{
wugu[i-1]=paidui[104-(*paiduishu)];
(*paiduishu)--;
printf("%d ",i-1);
wugu[i-1].Kanpai();
}
}
void Qupai(pai wugu[10],wujiang*w)
{
int i,x;
printf("五谷丰登开牌:\n");
for(i=0;(wugu[i].leixing)!=-1;i++)
{
printf("%d ",i);
wugu[i].Kanpai();
}
if((*w).juese)
{
for(;;)
{
printf("请选择你想要的卡牌,输入卡牌之前的编号,以回车结束!\n");
scanf("%d",&x);
if(wugu[x].leixing!=-1)
{
printf("玩家选择");
wugu[x].Kanpai();
(*w).shoupai[(*w).shoupaishu]=wugu[x];
((*w).shoupaishu)++;
for(i=x+1;i<=9;i++)wugu[i-1]=wugu[i];
wugu[9].leixing=-1;
break;
}
printf("你选择了一张空气加入手牌!");
}
}
else
{
printf("电脑选择");
wugu[0].Kanpai();
(*w).shoupai[(*w).shoupaishu]=wugu[0];
((*w).shoupaishu)++;
for(i=1;i<=9;i++)wugu[i-1]=wugu[i];
wugu[9].leixing=-1;
}
}
void Rengpai(pai wugu[10],pai qipaidui[104],int*qipaishu)
{
int i;
for(i=0;wugu[i].leixing!=-1;i++)
{
qipaidui[*qipaishu]=wugu[i];
(*qipaishu)++;
wugu[i].leixing=-1;
}
}
int Nanman(wujiang*w1,wujiang*w2,pai qipaidui[104],int*qipaishu)
{
int i,x;
if((*w1).juese)
{
for(x=0;x<((*w2).shoupaishu);x++)
{
if((*w2).shoupai[x].leixing==101)
{
printf("电脑打出");
((*w2).shoupai)[x].Kanpai();
qipaidui[*qipaishu]=((*w2).shoupai)[x];
for(int i=x+1;i<=((*w2).shoupaishu);i++)((*w2).shoupai)[i-1]=((*w2).shoupai)[i];
((*w2).shoupaishu)--;
(*qipaishu)++;
return 0;
break;
}
}
printf("玩家对电脑造成1点伤害!\n");
((*w2).tili)--;
i=Binsi(w1,w2,qipaidui,qipaishu);
return i;
}
else
{
for(;;)
{
printf("请打出一张【杀】响应【南蛮入侵】,否则你将受到1点伤害!\n请输入手牌之前的编号,或者输入“-1”放弃出【杀】,以回车结束!\n");
if(((*w2).zhuangbei[0].leixing==305))printf("如果想发动【丈八蛇矛】效果,请输入“100”,以回车结束!\n");
(*w2).Kanshoupai();
scanf("%d",&x);
if(x==-1)
{
int i;
((*w2).tili)--;
printf("电脑对玩家造成1点伤害!\n");
i=Binsi(w1,w2,qipaidui,qipaishu);
return i;
break;
}
else if(((*w2).zhuangbei[0].leixing==305)&&x==100)
{
pai p=Zhangba(w2,qipaidui,qipaishu);
p.paifu=-1;
printf("使用!\n");
return 0;
break;
}
else if((*w2).shoupai[x].leixing==101)
{
printf("玩家打出");
((*w2).shoupai)[x].Kanpai();
qipaidui[*qipaishu]=((*w2).shoupai)[x];
for(i=x+1;i<=((*w2).shoupaishu);i++)((*w2).shoupai)[i-1]=((*w2).shoupai)[i];
((*w2).shoupaishu)--;
(*qipaishu)++;
return 0;
break;
}
else printf("你确定你打出的是【杀】?\n");
}
}
}
int Wanjian(wujiang*w1,wujiang*w2,pai paidui[104],int*paiduishu,pai qipaidui[104],int*qipaishu)
{
int i;
i=Shan(w1,w2,paidui,paiduishu,qipaidui,qipaishu);
if(i==-1)
{
i=Binsi(w1,w2,qipaidui,qipaishu);
return i;
}
else return 0;
}
int Chupai(pai paidui[104],pai qipaidui[104],int *paiduishu,int*qipaishu,wujiang*w1,wujiang*w2,pai yuanshipaidui[2][4][13])
{
pai p1;
int sha=1;int y=-1,i,t=((*w1).shoupaishu)-1;
for(;;t--)
{
if((*w1).juese)
{
printf("\n电脑当前手牌数:%d\n",((*w2).shoupaishu));
(*w2).Kanzhuangbei();
(*w1).Kanshoupai();
(*w1).Kanzhuangbei();
}
int j=0;
if((*w1).juese&&((*w1).zhuangbei[0].leixing==305))printf("如果想发动【丈八蛇矛】效果,请输入“100”,以回车结束!\n");
y=Xuanpai(w1,t);
p1=Panpai(w1,&sha,y,qipaidui,qipaishu);
if((p1).leixing==-1)break;
else if((p1).leixing==0)continue;
else
{
int duixiang;
duixiang=Mubiao(p1,w1,w2,&sha);
if(duixiang==-2)continue;
else
{
Da1pai(w1,w2,qipaidui,qipaishu,y);
Miaoshu(p1,((*w1).juese),duixiang);
if(!((*w1).juese))
{
printf("\n电脑当前手牌数:%d\n",((*w1).shoupaishu));
(*w1).Kanzhuangbei();
(*w2).Kanshoupai();
(*w2).Kanzhuangbei();
}
switch(p1.leixing)
{
case 101:
i=Sha(w1,w2,paidui,paiduishu,qipaidui,qipaishu);
if(i==-1){return -1;break;}
if((*w1).juese)printf("玩家当前体力值:%d/%d\n电脑当前体力值:%d/%d\n",(*w1).tili,(*w1).tilishangxian,(*w2).tili,(*w2).tilishangxian);
else printf("玩家当前体力值:%d/%d\n电脑当前体力值:%d/%d\n",(*w2).tili,(*w2).tilishangxian,(*w1).tili,(*w1).tilishangxian);
break;
case 103:
Tao(w1);
break;
case 201:
for(;;)
{
i=Wuxie(&p1,w1,w2,qipaidui,qipaishu,0);
if(!i)break;
j++;
i=Wuxie(&p1,w2,w1,qipaidui,qipaishu,0);
if(!i)break;
j++;
}
if(!(j%2))Chai(w1,w2,qipaidui,qipaishu);
else;
if((*w1).juese)(*w1).Kanshoupai();
break;
case 202:
for(;;)
{
i=Wuxie(&p1,w1,w2,qipaidui,qipaishu,0);
if(!i)break;
j++;
i=Wuxie(&p1,w2,w1,qipaidui,qipaishu,0);
if(!i)break;
j++;
}
if(!(j%2))Qian(w1,w2);
else;
if((*w1).juese)(*w1).Kanshoupai();
break;
case 203:
for(;;)
{
i=Wuxie(&p1,w1,w2,qipaidui,qipaishu,0);
if(!i)break;
j++;
i=Wuxie(&p1,w2,w1,qipaidui,qipaishu,0);
if(!i)break;
j++;
}
if(!(j%2))Wuzhong(w1,paidui,paiduishu,qipaidui,qipaishu);
else;
break;
case 204:
for(;;)
{
i=Wuxie(&p1,w1,w2,qipaidui,qipaishu,0);
if(!i)break;
j++;
i=Wuxie(&p1,w2,w1,qipaidui,qipaishu,0);
if(!i)break;
j++;
}
if(!(j%2))
{
i=Juedou(w1,w2,qipaidui,qipaishu);
if(i==-1)return -1;
if((*w1).juese)printf("玩家当前体力值:%d/%d\n电脑当前体力值:%d/%d\n",(*w1).tili,(*w1).tilishangxian,(*w2).tili,(*w2).tilishangxian);
else printf("玩家当前体力值:%d/%d\n电脑当前体力值:%d/%d\n",(*w2).tili,(*w2).tilishangxian,(*w1).tili,(*w1).tilishangxian);
}
break;
case 205:
for(;;)
{
i=Wuxie(&p1,w1,w2,qipaidui,qipaishu,0);
if(!i)break;
j++;
i=Wuxie(&p1,w2,w1,qipaidui,qipaishu,0);
if(!i)break;
j++;
}
if(!(j%2))
{
i=Jiedao(w1,w2,paidui,paiduishu,qipaidui,qipaishu);
if(i==-1)return -1;
if((*w1).juese)printf("玩家当前体力值:%d/%d\n电脑当前体力值:%d/%d\n",(*w1).tili,(*w1).tilishangxian,(*w2).tili,(*w2).tilishangxian);
else printf("玩家当前体力值:%d/%d\n电脑当前体力值:%d/%d\n",(*w2).tili,(*w2).tilishangxian,(*w1).tili,(*w1).tilishangxian);
}
break;
case 206:
for(;;)
{
i=Wuxie(&p1,w1,w2,qipaidui,qipaishu,0);
if(!i)break;
j++;
i=Wuxie(&p1,w2,w1,qipaidui,qipaishu,0);
if(!i)break;
j++;
}
if(!(j%2))Taoyuan(w1);
j=0;
for(;;)
{
i=Wuxie(&p1,w2,w1,qipaidui,qipaishu,0);
if(!i)break;
j++;
i=Wuxie(&p1,w2,w1,qipaidui,qipaishu,0);
if(!i)break;
j++;
}
if(!(j%2))Taoyuan(w2);
break;
case 207:
pai wugu[10];
for(i=1;i<=10;i++)wugu[i-1].leixing=-1;
Kaipai(paidui,paiduishu,2,wugu);
for(;;)
{
i=Wuxie(&p1,w1,w2,qipaidui,qipaishu,0);
if(!i)break;
j++;
i=Wuxie(&p1,w2,w1,qipaidui,qipaishu,0);
if(!i)break;
j++;
}
if(!(j%2))Qupai(wugu,w1);
for(;;)
{
i=Wuxie(&p1,w2,w1,qipaidui,qipaishu,0);
if(!i)break;
j++;
i=Wuxie(&p1,w2,w1,qipaidui,qipaishu,0);
if(!i)break;
j++;
}
if(!(j%2))Qupai(wugu,w2);
Rengpai(wugu,qipaidui,qipaishu); printf("弃牌数:%d\n",*qipaishu);
break;
case 208:
for(;;)
{
i=Wuxie(&p1,w1,w2,qipaidui,qipaishu,0);
if(!i)break;
j++;
i=Wuxie(&p1,w2,w1,qipaidui,qipaishu,0);
if(!i)break;
j++;
}
if(!(j%2))
{
i=Nanman(w1,w2,qipaidui,qipaishu);
if(i==-1)return -1;
if((*w1).juese)printf("玩家当前体力值:%d/%d\n电脑当前体力值:%d/%d\n",(*w1).tili,(*w1).tilishangxian,(*w2).tili,(*w2).tilishangxian);
else printf("玩家当前体力值:%d/%d\n电脑当前体力值:%d/%d\n",(*w2).tili,(*w2).tilishangxian,(*w1).tili,(*w1).tilishangxian);
}
break;
case 209:
for(;;)
{
i=Wuxie(&p1,w1,w2,qipaidui,qipaishu,0);
if(!i)break;
j++;
i=Wuxie(&p1,w2,w1,qipaidui,qipaishu,0);
if(!i)break;
j++;
}
if(!(j%2))
{
i=Wanjian(w1,w2,paidui,paiduishu,qipaidui,qipaishu);
if(i==-1)return -1;
if((*w1).juese)printf("玩家当前体力值:%d/%d\n电脑当前体力值:%d/%d\n",(*w1).tili,(*w1).tilishangxian,(*w2).tili,(*w2).tilishangxian);
else printf("玩家当前体力值:%d/%d\n电脑当前体力值:%d/%d\n",(*w2).tili,(*w2).tilishangxian,(*w1).tili,(*w1).tilishangxian);
}
break;
case 361:
case 362:
case 363:
((*w1).juli[0])--;break;
case 381:
case 382:
case 383:
((*w2).juli[0])++;break;
default:break;
}
printf("\n");
}
}
}
return 0;
}
void Qipai(pai shoupai[20],int *shoupaishu,pai qipaidui[104],int *qipaishu,int juese,int *shoupaishangxian)
{
int x;
if((*shoupaishu)>(*shoupaishangxian))
{
if(juese!=1&&juese!=0)printf("身份参数错误!");
int q=(*shoupaishu)-(*shoupaishangxian);
int i,j;
for(j=1;j<=q;j++)
{
for(;;)
{
if(juese)
{
printf("弃牌请输入手牌之前的编号,以回车结束!\n注:一次只能弃一张牌\n");
printf("手牌数:%d\n",*shoupaishu);
scanf("%d",&x);
if(x>=0&&x<(*shoupaishu))break;
else printf("你弃掉了一张空气!\n");
}
else
{
srand((unsigned)time(NULL));
x=rand()%(*shoupaishu);
break;
}
}
qipaidui[*qipaishu]=shoupai[x];
for(i=x+1;i<=(*shoupaishu);i++)shoupai[i-1]=shoupai[i];
(*shoupaishu)--;
if(juese)printf("弃牌阶段玩家弃置");
else printf("弃牌阶段电脑弃置");
qipaidui[*qipaishu].Kanpai();
(*qipaishu)++;
int m;
if(juese)
{
printf("玩家当前手牌:\n");
for(m=0;m<=(*shoupaishu-1);m++)
{
printf("%d ",m);
(shoupai[m]).Kanpai();
}
} printf("弃牌堆:%d\n",*qipaishu);
}
}
}
int Huihe(pai A[104],pai B[104],int *x,int *y,pai yuanshipaidui[2][4][13],wujiang *w1,wujiang *w2)
{
printf("\n回合开始阶段……\n");
switch((*w1).huihekaishi)
{
case 0:break;
default:printf("回合开始阶段参数错误!\n");break;
}
printf("判定阶段……\n");
int K=0;
if((*w1).pandingshu>0)
{
int i,j;
for(;(*w1).pandingshu;)
{
switch((*w1).pandingpai[0].leixing)
{
case 251:printf("【乐不思蜀】开始判定……\n"); break;
case 252:printf("【闪电】开始判定……\n");break;
default:printf("【??】开始判定……\n");break;
}
j=0;
pai p=((*w1).pandingpai[0]);
for(;;)//在判定之前询问【无懈】
{
i=Wuxie(&p,w2,w1,B,y,0);
if(!i)break;
j++;
i=Wuxie(&p,w1,w2,B,y,0);
if(!i)break;
j++;
}
switch((*w1).pandingpai[0].leixing)
{
case 251:
if(!(j%2))
{
printf("【乐不思蜀】的判定牌是:");
Panding(A,x,B,y);
if((B[(*y)-1].huase)!=1)
{
printf("【乐不思蜀】判定成功!\n");
if((*w1).juese)printf("玩家");
else printf("电脑");
printf("跳过出牌阶段!\n");
K=-1;
}
else printf("【乐不思蜀】判定失败!\n");
}
B[*y]=(*w1).pandingpai[0];
((*w1).pandingshu)--;
(*w1).pandingpai[0]=(*w1).pandingpai[1];
(*w1).pandingpai[1]=(*w1).pandingpai[2];
(*w1).pandingpai[2].leixing=-1;
(*y)++;
break;
case 252:
if(!(j%2))
{
printf("【闪电】的判定牌是:");
Panding(A,x,B,y);
if((B[(*y)-1].huase==0)&&(B[(*y)-1].dianshu>=1)&&(B[(*y)-1].dianshu<=8))
{
printf("【闪电】判定成功!\n");
if((*w1).juese)printf("玩家");
else printf("电脑");
printf("受到3点雷电伤害!");
((*w1).tili)=((*w1).tili)-3;
i=Binsi(w2,w1,B,y);
B[*y]=(*w1).pandingpai[0];
((*w1).pandingshu)--;
(*w1).pandingpai[0]=(*w1).pandingpai[1];
(*w1).pandingpai[1]=(*w1).pandingpai[2];
(*w1).pandingpai[2].leixing=-1;
(*y)++;
if(i==-1)return -1;
}
else
{
printf("【闪电】判定失败!\n");
(*w2).pandingpai[2]=(*w2).pandingpai[1];
(*w2).pandingpai[1]=(*w2).pandingpai[0];
(*w2).pandingpai[0]=(*w1).pandingpai[0];
(*w1).pandingpai[0]=(*w1).pandingpai[1];
(*w1).pandingpai[1]=(*w1).pandingpai[2];
(*w1).pandingpai[2].leixing=-1;
((*w1).pandingshu)--;
((*w2).pandingshu)++;
}
break;
}
default:printf("判定牌错误!");
} printf("弃牌数:%d\n",*y);
}
}
else if(!((*w1).pandingshu));
else printf("判定阶段参数错误!\n");
printf("摸牌阶段……\n");
switch((*w1).mopai)
{
case 0:Mopai(&((*w1).shoupaishu),(*w1).shoupai,A,x,B,y,(*w1).juese);break;
case -1:break;
default:printf("摸牌阶段参数错误!\n");break;
}
if(K==-1)goto M;
printf("出牌阶段……\n");
switch((*w1).chupai)
{
case 0:
{
int i;
i=Chupai(A,B,x,y,w1,w2,yuanshipaidui);
if(i==-1)
{
return -1;
break;
}
else break;
}
case -1:break;
default:printf("出牌阶段参数错误!\n");break;
}
M:
printf("弃牌阶段……\n");
switch((*w1).qipai)
{
case 0:
Qipai((*w1).shoupai,&((*w1).shoupaishu),B,y,(*w1).juese,&((*w1).tili));break;
default:printf("弃牌阶段参数错误!\n");break;
}
printf("回合结束阶段……\n");
switch((*w1).huihejieshu)
{
case 0:break;
default:printf("回合结束阶段参数错误!\n");break;
}
return 0;
}
void yabagabaga()
{
void Kanshoupai(pai p);
pai yuanshipaidui[2][4][13],qipaidui[104],paidui[104];
wujiang wanjia,com;
com.tili=wanjia.tili=5;
com.tilishangxian=wanjia.tilishangxian=5;
com.huihekaishi=wanjia.huihekaishi=0;
com.panding=wanjia.panding=0;
com.mopai=wanjia.mopai=0;
com.chupai=wanjia.chupai=0;
com.qipai=wanjia.qipai=0;
com.huihejieshu=wanjia.huihejieshu=0;
com.shoupaishu=wanjia.shoupaishu=0;
com.pandingshu=wanjia.pandingshu=0;
com.zhuangbeishu=wanjia.zhuangbeishu=0;
com.juese=0;wanjia.juese=1;
pai p;
p.leixing=-1;
com.zhuangbei[0]=com.zhuangbei[1]=com.zhuangbei[2]=com.zhuangbei[3]=wanjia.zhuangbei[0]=wanjia.zhuangbei[1]=wanjia.zhuangbei[2]=wanjia.zhuangbei[3]=p;
com.zhuangbei[0].changdu=wanjia.zhuangbei[0].changdu=1;
com.pandingpai[0]=com.pandingpai[1]=com.pandingpai[2]=wanjia.pandingpai[0]=wanjia.pandingpai[1]=wanjia.pandingpai[2]=p;
com.juli[0]=wanjia.juli[0]=1;
int a,b,c;
for(a=0;a<=1;a++)
{
for(b=0;b<=3;b++)
{
for(c=0;c<=12;c++)
{
yuanshipaidui[a][b][c].paifu=a;
yuanshipaidui[a][b][c].huase=b;
yuanshipaidui[a][b][c].dianshu=c;
}
}
}
yuanshipaidui[0][0][0].leixing=204;
yuanshipaidui[0][0][1].leixing=331;
yuanshipaidui[0][0][2].leixing=201;
yuanshipaidui[0][0][3].leixing=201;
yuanshipaidui[0][0][4].leixing=304;yuanshipaidui[0][0][4].changdu=3;
yuanshipaidui[0][0][5].leixing=251;
yuanshipaidui[0][0][6].leixing=101;
yuanshipaidui[0][0][7].leixing=101;
yuanshipaidui[0][0][8].leixing=101;
yuanshipaidui[0][0][9].leixing=101;
yuanshipaidui[0][0][10].leixing=202;
yuanshipaidui[0][0][11].leixing=201;
yuanshipaidui[0][0][12].leixing=208;
yuanshipaidui[0][1][0].leixing=209;
yuanshipaidui[0][1][1].leixing=102;
yuanshipaidui[0][1][2].leixing=103;
yuanshipaidui[0][1][3].leixing=103;
yuanshipaidui[0][1][4].leixing=308;yuanshipaidui[0][1][4].changdu=5;
yuanshipaidui[0][1][5].leixing=103;
yuanshipaidui[0][1][6].leixing=103;
yuanshipaidui[0][1][7].leixing=103;
yuanshipaidui[0][1][8].leixing=103;
yuanshipaidui[0][1][9].leixing=101;
yuanshipaidui[0][1][10].leixing=101;
yuanshipaidui[0][1][11].leixing=103;
yuanshipaidui[0][1][12].leixing=102;
yuanshipaidui[0][2][0].leixing=204;
yuanshipaidui[0][2][1].leixing=101;
yuanshipaidui[0][2][2].leixing=101;
yuanshipaidui[0][2][3].leixing=101;
yuanshipaidui[0][2][4].leixing=101;
yuanshipaidui[0][2][5].leixing=101;
yuanshipaidui[0][2][6].leixing=101;
yuanshipaidui[0][2][7].leixing=101;
yuanshipaidui[0][2][8].leixing=101;
yuanshipaidui[0][2][9].leixing=101;
yuanshipaidui[0][2][10].leixing=101;
yuanshipaidui[0][2][11].leixing=205;
yuanshipaidui[0][2][12].leixing=205;
yuanshipaidui[0][3][0].leixing=204;
yuanshipaidui[0][3][1].leixing=102;
yuanshipaidui[0][3][2].leixing=102;
yuanshipaidui[0][3][3].leixing=102;
yuanshipaidui[0][3][4].leixing=102;
yuanshipaidui[0][3][5].leixing=101;
yuanshipaidui[0][3][6].leixing=101;
yuanshipaidui[0][3][7].leixing=101;
yuanshipaidui[0][3][8].leixing=101;
yuanshipaidui[0][3][9].leixing=101;
yuanshipaidui[0][3][10].leixing=102;
yuanshipaidui[0][3][11].leixing=103;
yuanshipaidui[0][3][12].leixing=101;
yuanshipaidui[1][0][0].leixing=252;
yuanshipaidui[1][0][1].leixing=302;yuanshipaidui[1][0][1].changdu=2;
yuanshipaidui[1][0][2].leixing=202;
yuanshipaidui[1][0][3].leixing=202;
yuanshipaidui[1][0][4].leixing=383;
yuanshipaidui[1][0][5].leixing=303;yuanshipaidui[1][0][5].changdu=2;
yuanshipaidui[1][0][6].leixing=208;
yuanshipaidui[1][0][7].leixing=101;
yuanshipaidui[1][0][8].leixing=101;
yuanshipaidui[1][0][9].leixing=101;
yuanshipaidui[1][0][10].leixing=210;
yuanshipaidui[1][0][11].leixing=305;yuanshipaidui[1][0][11].changdu=3;
yuanshipaidui[1][0][12].leixing=362;
yuanshipaidui[1][1][0].leixing=206;
yuanshipaidui[1][1][1].leixing=102;
yuanshipaidui[1][1][2].leixing=207;
yuanshipaidui[1][1][3].leixing=207;
yuanshipaidui[1][1][4].leixing=361;
yuanshipaidui[1][1][5].leixing=251;
yuanshipaidui[1][1][6].leixing=203;
yuanshipaidui[1][1][7].leixing=203;
yuanshipaidui[1][1][8].leixing=203;
yuanshipaidui[1][1][9].leixing=101;
yuanshipaidui[1][1][10].leixing=203;
yuanshipaidui[1][1][11].leixing=201;
yuanshipaidui[1][1][12].leixing=381;
yuanshipaidui[1][2][0].leixing=301;yuanshipaidui[1][2][0].changdu=1;
yuanshipaidui[1][2][1].leixing=331;
yuanshipaidui[1][2][2].leixing=201;
yuanshipaidui[1][2][3].leixing=201;
yuanshipaidui[1][2][4].leixing=382;
yuanshipaidui[1][2][5].leixing=251;
yuanshipaidui[1][2][6].leixing=208;
yuanshipaidui[1][2][7].leixing=101;
yuanshipaidui[1][2][8].leixing=101;
yuanshipaidui[1][2][9].leixing=101;
yuanshipaidui[1][2][10].leixing=101;
yuanshipaidui[1][2][11].leixing=210;
yuanshipaidui[1][2][12].leixing=210;
yuanshipaidui[1][3][0].leixing=301;yuanshipaidui[1][3][0].changdu=1;
yuanshipaidui[1][3][1].leixing=102;
yuanshipaidui[1][3][2].leixing=202;
yuanshipaidui[1][3][3].leixing=202;
yuanshipaidui[1][3][4].leixing=306;yuanshipaidui[1][3][4].changdu=3;
yuanshipaidui[1][3][5].leixing=102;
yuanshipaidui[1][3][6].leixing=102;
yuanshipaidui[1][3][7].leixing=102;
yuanshipaidui[1][3][8].leixing=102;
yuanshipaidui[1][3][9].leixing=102;
yuanshipaidui[1][3][10].leixing=102;
yuanshipaidui[1][3][11].leixing=307;yuanshipaidui[1][3][11].changdu=4;
yuanshipaidui[1][3][12].leixing=363;
int paiduishu=104;
int qipaishu=0;
printf("游戏开始! by cyh\n");
Qishixipai(yuanshipaidui,paidui);
Qishishoupai(&wanjia,paidui,&(paiduishu),qipaidui,&(qipaishu));
Qishishoupai(&com,paidui,&(paiduishu),qipaidui,&(qipaishu));
int i;
for(;;)
{
i=Huihe(paidui,qipaidui,&paiduishu,&qipaishu,yuanshipaidui,&wanjia,&com);
if(i==-1)break;
i=Huihe(paidui,qipaidui,&paiduishu,&qipaishu,yuanshipaidui,&com,&wanjia);
if(i==-1)break;
}
}
int mode2; // 游戏模式 1.经典模式 2.限时模式 3.无尽模式
int getch2()
{// 不回显的输入
struct termios nts, ots;
// 得到当前终端(0表示标准输入)的设置
if (tcgetattr(0, &ots) < 0) return EOF;
// 设置终端为Raw原始模式,该模式下所有的输入数据以字节为单位被处理
nts = ots;
cfmakeraw(&nts);
// 设置上更改之后的设置
if (tcsetattr(0, TCSANOW, &nts) < 0) return EOF;
// 设置还原成老的模式
int cr;
cr = getchar();
if (tcsetattr(0, TCSANOW, &ots) < 0) return EOF;
return cr;
}
// 打印1-4数字 num数字颜色标记为color
void print2(int num, string color)
{
cout << "\033[0;0H";
if (mode2 == 1) cout << " ==== 经典模式 ====" << endl;
if (mode2 == 2) cout << " ==== 限时模式 ====" << endl;
if (mode2 == 3) cout << " ==== 无尽模式 ====" << endl;
cout << " ";
for (int i = 1; i <= 4; i++)
{
if (i == num)
{
if (color == "black")
cout << "\033[37;40m " << i << " \033[0m";
if (color == "green")
cout << "\033[37;42m " << i << " \033[0m";
if (color == "red")
cout << "\033[37;41m " << i << " \033[0m";
}
else
{
cout << "\033[30;47m " << i << " \033[0m";
}
}
cout << endl;
}
void intro2() // 规则介绍
{
cout << "\033c" << flush;
cout << " =============================================" << endl;
cout << " 测测你的手速!Esc退出游戏!" << endl;
cout << " 开始后,你需要用最快的速度按下黑色数字按键。" << endl;
cout << " 游戏共有 3 种模式: 1.经典模式 2.限时模式 3.无尽模式" << endl;
cout << " 1.经典模式: 在最短时间内完成25次按键任务" << endl;
cout << " 2.限时模式: 在30s内完成尽可能多的按键任务" << endl;
cout << " 3.无尽模式: 不限时,按错为止" << endl;
cout << " 准备好了嘛?" << endl;
cout << " 按下对应数字(1~3)我们就开始了~" << endl;
cout << " *注意:请将输入法改为英文!" << endl;
cout << " =============================================" << endl;
}
void game2() // 游戏进程
{
srand(time(0));
int right = 0; // 按键次数
int start = time(0); // 开始时间
int tme = time(0) - start; // 已用时
cout << "\033c" << flush;
while (true)
{
// 结束游戏 1.经典模式 25次 2.限时模式 30s
if (mode2 == 1 && right >= 25) break;
if (mode2 == 2 && tme >= 30) break;
// 生成随机数
int r = rand() % 4 + 1;
print2(r, "black");
// 获取按键
char ch = getch2();
if (r == ch - '0') // 按键正确
{
right++;
print2(r, "green");
usleep(100000);
tme = time(0) - start;
cout << " 已用时: " << tme << " s " << endl;
cout << " 按键数: " << right << " 次 "<< endl;
}
else // 按键错误
{
tme = time(0) - start;
cout << "\033c" << flush;
print2(ch-'0', "red");
usleep(100000);
cout << " ==== GAME OVER! ====" << endl;
usleep(500000);
break;
}
}
// 游戏总结
cout << "\033c" << flush;
cout << " ==== 总结 ====" << endl;
cout << " 总用时: " << tme << " s" << endl;
cout << " 按键数: " << right << " 次" << endl;
cout << " 手 速: " << 1.0*right/tme << " 次/s" << endl;
cout << " ==============" << endl;
cout << " 按回车开始新游戏..." << endl;
getchar();
}
void mi_gong()
{
char map[6][6] =
{'#','#','#','#','#','#',
'#',' ','w','#',' ','>',
'#',' ','#','#',' ','#',
'#','>',' ','#',' ','#',
'#','#','>',' ',' ','#',
'#','#','#','#','#','#'};
for(int i = 0; i <= 5; i++)
{
for(int j = 0; j <= 5; j++)
{
cout << map[i][j];
}
cout << endl;
}
int x = 1, y = 2;
while(x != 1|| y != 5)
{
cout << "请输入w(上) s(下) a(左) d(右)"<< endl;
char ch;
cin >> ch;
if(ch == 's'&& map[x + 1][y] != '#')
{
map[x][y] = ' ';
x++;
map[x][y] = '0';
}
if(ch == 'w'&& map[x - 1][y] != '#')
{
map[x][y] = ' ';
x--;
map[x][y] = '0';
}
if(ch == 'a'&& map[x][y - 1] != '#')
{
map[x][y] = ' ';
y--;
map[x][y] = '0';
}
if(ch == 'd'&& map[x][y + 1] != '#')
{
map[x][y] = ' ';
y++;
map[x][y] = '0';
}
system("export TERM=xterm && clear");
for(int i = 0; i <= 5; i++)
{
for(int j = 0; j <= 5; j++)
{
cout << map[i][j];
}
cout << endl;
}
}
cout << "恭喜你走出迷宫!"<< endl;
cout<<"输入任意退出";
cin>>map[1][1];
}
void jin_bi()
{
//第一部分:规则
int jinbi=0,a,chu; //jinbi为随机1000-2000金币,a为停顿
cout<<"输入任何数开始"<<endl;
cin>>a;
if(a==1)
{
cout<<"游戏开始"<<endl;
}
cout<<"规则:玩家最开始有随机数量的金币,要用金币去换皮肤,不同的皮肤要花不同的金币,自然也有更多潮流值。潮流值:在和别人比拼中,潮流值更高的一方获胜,赢的一方获得200金币,平了各加150金币,输的一方扣掉100金币。卡牌:机器每隔一段时间就会发出三张卡牌,你可以三选一,不同的卡牌有不同的技能(都写在卡牌上了)。系统也会发放宝箱!遇到别人可选择躲避或比拼,也可查看对方的潮流值。(潮流值比不过对方就跑吧)攒到跟多金币就可以升级皮肤了。如果游戏结束后金币数数量大于初始金币数则获胜,否则失败!!!"<<endl;
srand(time(0));
jinbi=rand()%19001+1000;
chu=jinbi;
cout<<"这是你目前抽到的金币数(随机)"<<jinbi<<endl;
//第一部分完
//第二部分:选皮肤
cout<<"请选择皮肤"<<endl;
cout<<"1.新年服装,要花500金币,共50朝流值 2.中秋服装,要花400金币,共40潮流值 3.端午服装,要花600金币,共60潮流值"<<endl;
cout<<"请输入序号"<<endl;
int chao;
cin>>a;
if(a==1)
{
jinbi-=500;
chao=50;
cout<<"剩余金币:"<<jinbi<<endl;
cout<<"共有潮流值:"<<chao<<endl;
}
if(a==2)
{
jinbi-=400;
chao=40;
cout<<"剩余金币:"<<jinbi<<endl;
cout<<"共有潮流值:"<<chao<<endl;
}
if(a==3)
{
jinbi-=600;
chao=60;
cout<<"剩余金币:"<<jinbi<<endl;
cout<<"共有潮流值:"<<chao<<endl;
}
//第二部分完
//第三部分:遇人
srand(time(0));
int n=rand();
n=rand()%100+1;
cout<<"你遇到别人了,对方潮流值为"<<n<<endl;
cout<<"你要怎么办,请选择"<<endl;
cout<<"1.比拼 2.逃跑"<<endl;
cin>>a;
if(a==1)
{
if(chao>n)
{
cout<<"你赢了,奖励200金币"<<endl;
jinbi+=200;
cout<<"现在共有"<<jinbi<<"枚金币"<<endl;
}
else if(chao==n)
{
cout<<"打平了,获得150金币"<<endl;
jinbi+=150;
cout<<"现在共有"<<jinbi<<"枚金币"<<endl;
}
else if(chao<n)
{
cout<<"你输了,失去100金币"<<endl;
jinbi-=100;
cout<<"现在共有"<<jinbi<<"枚金币"<<endl;
}
}
else
{
cout<<"你现在共有"<<jinbi<<"枚金币"<<endl;
cout<<"请进行第二次皮肤选择(可不选)"<<endl;
cout<<"1.医生服装 要花400金币 共50潮流值 2.老师服装 要花500金币 共50潮流值 3.警察服装 要花800金币 共90潮流值 0.不选"<<endl;
cout<<"请输入序号"<<endl;
cin>>a;
if(a==1)
{
jinbi-=400;
chao=50;
cout<<"剩余金币:"<<jinbi<<endl;
cout<<"共有潮流值:"<<chao<<endl;
}
if(a==2)
{
jinbi-=500;
chao=50;
cout<<"剩余金币:"<<jinbi<<endl;
cout<<"共有潮流值:"<<chao<<endl;
}
if(a==3)
{
jinbi-=800;
chao=90;
cout<<"剩余金币:"<<jinbi<<endl;
cout<<"共有潮流值:"<<chao<<endl;
}
}
if(a==0)
{
cout<<"剩余金币:"<<jinbi<<endl;
cout<<"共有潮流值:"<<chao<<endl;
}
//第四部分:卡牌
cout<<"请选择卡牌"<<endl;
cout<<"1.神秘红包 获得1-50金币"<<endl;
cout<<"2.破罐破摔 获得或失去80-800金币"<<endl;
cout<<"3走钢丝 获得20潮流值或失去10潮流值"<<endl;
a=0;
cin>>a;
if(a==1)
{
int k=0;
srand(time(0));
k=rand()&50+1;
jinbi+=k;
cout<<"你获得了"<<k<<"枚金币"<<endl;
cout<<"剩余金币:"<<jinbi<<endl;
cout<<"共有潮流值:"<<chao<<endl;
}//卡牌一
int s=0,v=0,x=0;
if(a==2)
{
srand(time(0));
s=rand();
s=s%2+1;
if(s==1)
{
srand(time(0));
v=v%721+80;
jinbi+=v;
cout<<"你获得了"<<v<<"枚金币"<<endl;
cout<<"共有金币:"<<jinbi<<endl;
cout<<"共有潮流值:"<<chao<<endl;
}
if(s==2)
{
srand(time(0));
x=x%721+80;
jinbi-=x;
cout<<"你失去了"<<x<<"枚金币"<<endl;
cout<<"共有金币:"<<jinbi<<endl;
cout<<"共有潮流值:"<<chao<<endl;
}
}//卡牌二
int y=0;
if(a==3)//卡牌三
{
srand(time(0));
y=rand();
y=y%2+1;
if(y==1)
{
chao+=20;
cout<<"共有"<<jinbi<<"枚金币"<<endl;
cout<<"获得潮流值:20"<<endl;
cout<<"共有潮流值:"<<chao<<endl;
}
if(y==2)
{
chao-=10;
cout<<"共有"<<jinbi<<"枚金币"<<endl;
cout<<"失去潮流值:10"<<endl;
cout<<"共有潮流值:"<<chao<<endl;
}
}
//第五部分:宝箱
cout<<"请选择宝箱"<<endl;
cout<<"1号宝箱 2号宝箱 3号宝箱"<<endl;
cout<<"请做出选择"<<endl;
int p;
cin>>p;
if(p==1)
{
jinbi+=100;
cout<<"你获得了:100枚金币"<<endl;
cout<<"共有金币:"<<jinbi<<"枚金币"<<endl;
cout<<"共有潮流值:"<<chao<<endl;
}
if(p==2)
{
jinbi+=500;
cout<<"你获得了:500枚金币"<<endl;
cout<<"共有金币:"<<jinbi<<"枚金币"<<endl;
cout<<"共有潮流值:"<<chao<<endl;
}
if(p==3)
{
chao+=10;
cout<<"你获得了:10潮流值"<<endl;
cout<<"共有金币:"<<jinbi<<"枚金币"<<endl;
cout<<"共有潮流值:"<<chao<<endl;
}
//第五部分完
//第六部分:突发事件
cout<<"突发事件"<<endl;
int q=0,l=0,m=0,a1=0,a2=0;
srand(time(0));
q=rand();
q=q%4+1;
if(q==1)
{
cout<<"突发事件:天降福星"<<endl;
cout<<"获得1-200"<<endl;
srand(time(0));
l=rand();
l=l%200+1;
jinbi+=l;
cout<<"你获得了:"<<l<<"枚金币"<<endl;
cout<<"共有金币:"<<jinbi<<"枚金币"<<endl;
cout<<"共有潮流值:"<<chao<<endl;
}
if(q==2)
{
cout<<"突发事件:发放潮流值"<<endl;
cout<<"获得1-200"<<endl;
srand(time(0));
m=rand();
m=m%20+1;
chao+=m;
cout<<"你获得了潮流值:"<<m<<endl;
cout<<"共有金币:"<<jinbi<<"枚金币"<<endl;
cout<<"共有潮流值:"<<chao<<endl;
if(q==3)
{
cout<<"突发事件:海潮金币"<<endl;
cout<<"获得1-2000"<<endl;
srand(time(0));
a1=rand();
l=a1%2000+1;
jinbi+=a1;
cout<<"你获得了:"<<a1<<"枚金币"<<endl;
cout<<"共有金币:"<<jinbi<<"枚金币"<<endl;
cout<<"共有潮流值:"<<chao<<endl;
}
if(q==3)
{
cout<<"突发事件:海量潮流值"<<endl;
cout<<"获得1-200"<<endl;
srand(time(0));
a2=rand();
a2=a2%200+1;
chao+=a2;
cout<<"你获得了潮流值:"<<a2<<endl;
cout<<"共有金币:"<<jinbi<<"枚金币"<<endl;
cout<<"共有潮流值:"<<chao<<endl;
}
//第六部分完
//第七部分:再遇人
srand(time(0));
int a3=rand();
a3=rand()%100+1;
cout<<"对方潮流值为:"<<a3<<"你必须跟他比拼"<<endl;
if(chao>a3)
{
cout<<"你赢了,奖励200金币"<<endl;
jinbi+=200;
cout<<"现在共有"<<jinbi<<"枚金币"<<endl;
}
else if(chao==a3)
{
cout<<"打平了,获得150金币"<<endl;
jinbi+=150;
cout<<"现在共有"<<jinbi<<"枚金币"<<endl;
}
else
{
cout<<"你输了,失去100金币"<<endl;
jinbi-=100;
cout<<"现在共有"<<jinbi<<"枚金币"<<endl;
}
}
//第七部分完
//第八部分:分胜负
cout<<"来吧!!一决胜负吧!!!"<<endl;
cout<<"共有金币:"<<jinbi<<"枚金币"<<endl;
cout<<"共有潮流值:"<<chao<<endl;
cout<<"初始金币为:"<<chu<<endl;
if(jinbi>chu)
{
cout<<"你现在的金币数大于初始金币数,看来赚了不少金币!!!"<<endl;
cout<<"你赢了!!!"<<endl;
}
else if(jinbi==chu)
{
cout<<"你现在的金币数等于初始金币数!"<<endl;
cout<<"你白干了!!!"<<endl;
}
else if(jinbi<chu)
{
cout<<"你现在的金币数小于初始金币数,看来亏了不少金币!!!"<<endl;
cout<<"你输了!!!"<<endl;
}
}
void wuuw()
{
printf("你想玩勇夺宝箱1还是勇夺宝箱2?(1/2)");
short a9;
scanf("%hd",a9);
if(a9==1)
{
srand(time(0)); //评测需注释掉这一行
int a, score;
cout << "输入任意数字第一次开箱:" << endl;
cin >> a;
score = rand()%1+100;
cout << "本次获得积分:" << score << endl << endl;
if (score >= 95)
{
cout << "【欧皇装备】" << endl;
}
else
{
cout << "啥都没中!输入任意数字第二次开箱:" << endl;
cin >> a;
/*把第二次开箱的分数累加到score中*/
score+=rand()%41+100;
cout << "本次开箱后共有积分:" << score << endl << endl;
if (score >= 170)
{
cout << "【稀有皮肤】" << endl;
}
else
{
cout << "啥都没中!输入任意数字第三次开箱:" << endl;
cin >> a;
/*把第三次开箱的分数累加到score中*/
score+=rand()%41+100;
cout << "本次开箱后共有积分:" << score << endl << endl;
if (score >= 240)
{
cout << "【灵兽】" << endl;
}
else
{
cout << "【谢谢光临!】"<< endl;
}
}
}
}
else
{
srand(time(0)); //评测需注释掉本行
int a, tot = 150, score = tot; // tot 是开始积分
if (score >= 100)
{
score -= 100; //开箱消耗100积分
cout << "【你当然可以走到这里!】" << endl ;
cout << "输入任意数字开始吧:" << endl;
cin >> a;
int res = rand()%150+1; //随机产生1~150的积分
score+=res; //将这一轮产生的积分累加到score中
cout << "^_^本关结束,目前积分为:"<< score << endl;
if (score >= 100)
{
score -= 100;
cout << "【看来你赚了不少积分!】" << endl << endl;
cout << "输入任意数字继续:" << endl;
cin >> a;
res = rand()%150+1;
score += res;
cout << "^_^本关结束,目前积分为:" << score << endl;
if (score >= 100)
{
score -=100;
cout << "【竟然能走到最后一关!】" << endl << endl;
cout << "来吧,输入任意数字一决胜负:" << endl;
cin >> a;
res = rand()%150+1;
score += res;
cout << "^_^本关结束,目前积分为:" << score << endl << endl;
}
else
{
cout << "【哦吼,已经不错啦!】" << endl;
}
}
else
{
cout << "【有缘再见啦!】" << endl;
}
}
else
{
cout << "【一次都没有?出bug啦!】" << endl;
}
cout << "本次活动结束,目前积分为:" << score << endl;
if (tot<score) //判断最终积分是否多于开始积分
{
cout << "【You're a lucky guy!】";
}
else
{
cout << "【What happened?】";
}
}
}
void play_game() {
int secretNumber = rand() % 100 + 1;
int guess = 0;
printf("Welcome to the number guessing game!\n");
printf("I'm thinking of a number between 1 and 100.\n");
while (guess != secretNumber) {
printf("Enter a guess: ");
scanf("%d", &guess);
if (guess < secretNumber) {
printf("Too low, try again!\n");
} else if (guess > secretNumber) {
printf("Too high, try again!\n");
}
}
printf("Congratulations, you guessed the right number: %d!\n", secretNumber);
}
string O;
bool M=true;
int cnt1=0;
int cnt2=0;
bool andchachengchu(int a1)
{
while (cnt1!=10)
{
cnt1++;
srand((unsigned int)time(NULL));
int a = rand() % 100 + 1;
int b = rand() % 100 + 1;
int c = rand() % 4 + 1;
if (c == 1)
{
int da = a + b;
cout << a << " + " << b << " = ";
int n;
cin >> n;
if (n == da)
{
cout << "对了" << endl;
cnt2++;
}
else
{
cout << "错了" << endl;
}
}
if (c == 2)
{
int da = a + b;
cout << a << " + " << b << " = ";
int n;
cin >> n;
if (n == da)
{
cout << "对了" << endl;
cnt2++;
}
else
{
cout << "错了" << endl;
}
}
if (c == 3)
{
double da = a * b;
cout << a << " * " << b << " = ";
int n;
cin >> n;
if (n == da)
{
cout << "对了" << endl;
cnt2++;
}
else
{
cout << "错了" << endl;
}
}
if (c == 4)
{
if (a < b)
{
int temp = a;
a = b;
b = temp;
}
bool flag = false;
for (int i = a; i >= 1; i--)
{
for (int j = b; j >= 1; j--)
{
if (i % j == 0)
{
flag = true;
a = i;
b = j;
break;
}
}
if (flag)
{
break;
}
}
double da = a * 1.0 / b;
cout << a << " / " << b << " = ";
double n;
cin >> n;
if (n == da)
{
cout << "对了" << endl;
cnt2++;
}
else
{
cout << "错了" << endl;
}
}
}
}
int winner;
int health1=5 , health2=5 ;//55
int power1=0 , power2=0 ;//00
int cnt=0 ;//0
void intro1()
{
health1 = 5; health2 = 5;
power1 = 0; power2 = 0;
cnt = 0;
srand(time(NULL));
cout << endl << endl;
cout << "两人回合制游戏,每回合双方同时在“攻击、防御、集气、必杀”四种行动中选一种。" << endl << endl;
// 补充游戏介绍函数
cout << "两人回合制游戏,每回合双方同时在“攻击、防御、集气、必杀”四种行动中选一种。" << endl << endl;
cout << "1. “生命”:每人 5 点生命,生命归 0 立即死亡;" << endl << endl;
cout << "2. “伤害”:攻击造成 1 伤害,防御免除攻击伤害,互相攻击双方都不受伤害,必杀造成 3 伤害;" << endl << endl;
cout << "“必杀”:必杀需消耗 2“气”,双方同时必杀则相安无事,否则放必杀者造成伤害,对手的行动无任何效果;" << endl << endl;
cout << "4. “气”:防御对方攻击增加 1 气,集气且不受到伤害增加 1 气。" << endl << endl;
cout << "----------单挑开始,你是武将1,电脑指挥武将2----------" << endl << endl;
}
// 人的策略函数
namespace human
{
int strategy()
{
// 输出出卡提示
cout << "用数字代表本回合武将1的行动:1攻击,2防御,3集气,4必杀" << endl;
// 读入人的策略
int x;
scanf("%d",&x);
return x;
}
}
// 片段4 确定电脑策略
// 确定电脑策略
namespace ai
{
int strategy()
{
//补充函数:产生1~3的随机数,并返回
if (power2 >= 2)return 4;
{
return rand() % 3 + 1;
}
}
}
//片段5 根据双方行动, 执行一回合的对战
bool fight(int d1, int d2)
{
if (d1 < 1 || d1 > 4)
{
cout << "【【【武将1没有这种策略啦~重新开始回合" << cnt << "!】】】" << endl;
return true;
}
if ((d1 == 4 && power1 < 2))
{
cout << "【【【武将1不够气来放必杀!重新开始回合" << cnt << "!】】】" << endl;
return true;
}
cout << "【【【" ;
if (d1 == 1 && d2 == 1)
{
cout << "两人同时攻击,相安无事";
}
if (d1 == 1 && d2 == 2)
{
power2++;
cout << "武将2防御了武将1的攻击,得1气";
}
if (d1 == 2 && d2 == 1)
{
power1++;
cout << "武将1防御了武将2的攻击,得1气";
}
if (d1 == 2 && d2 == 2)
{
cout << "两人同时防御,相安无事";
}
if (d1 == 1 && d2 == 3)
{
health2--;
cout << "武将2集气时受到武将1的攻击,损失1生命";
}
if (d1 == 3 && d2 == 1)
{
health1--;
cout << "武将1集气时受到武将2的攻击,损失1生命";
}
if (d1 == 2 && d2 == 3)
{
power2++;
cout << "武将2趁武将1防御时集气,得1气";
}
if (d1 == 3 && d2 == 2)
{
power1++;
cout << "武将1趁武将2防御时集气,得1气";
}
if (d1 == 3 && d2 == 3)
{
power1++;
power2++;
cout << "双方同时集气,各得1气";
}
if (d1 == 4 && d2 != 4)
{
power1 -= 2;
health2 -= 3;
cout << "武将1使出必杀,对对手造成3伤害";
}
if (d1 != 4 && d2 == 4)
{
power2 -= 2;
health1 -= 3;
cout << "武将2使出必杀,对对手造成3伤害";
}
if (d1 == 4 && d2 == 4)
{
power1 -= 2;
power2 -= 2;
cout << "双方同时必杀,相安无事";
}
cout << "】】】" << endl;
return false;
}
//片段6 本回合战后统计
void result()
{
cout << "【双方状态】" << endl;
cout << "*武将1: 生命" << health1 << " 气" << power1 << endl;
cout << "*武将2: 生命" << health2 << " 气" << power2 << endl << endl;
}
//片段7 公布对战结果, winner == 1 代表武将1胜, winner == 2 代表武将2胜
void showWinner(int winner)
{
cout << endl << "【单挑结束!!!!!】" << endl;
if (winner == 1) cout << "武将1击败对手获胜!!!!" << endl;
else cout << "武将2击败对手获胜!!!!" << endl;
cout << endl << endl;
}
//片段2 进行游戏
int pk()
{
for(;;)
{
// 一方倒下游戏结束
if (health1 <= 0) return 2;
if (health2 <= 0) return 1;
cout << "【开始回合" << ++cnt << "】" << endl;
// 片段3 确定人类策略,
int human = human::strategy();
// 片段4 确定电脑策略
int ai = ai::strategy();
//片段5 对战
bool err = fight(human, ai);
//片段6 本回合战后统计
if (!err) result();
else cnt--;
}
}
int a[230];
string d[3]={" ","O","X"};
int TIMES ; // 出题数
int correct, wrong;
int getch()
{// 不回显的输入
struct termios nts, ots;
// 得到当前终端(0表示标准输入)的设置
if (tcgetattr(0, &ots) < 0) return EOF;
// 设置终端为Raw原始模式,该模式下所有的输入数据以字节为单位被处理
nts = ots;
cfmakeraw(&nts);
// 设置上更改之后的设置
if (tcsetattr(0, TCSANOW, &nts) < 0) return EOF;
// 设置还原成老的模式
int cr;
cr = getchar();
if (tcsetattr(0, TCSANOW, &ots) < 0) return EOF;
return cr;
}
int print(int black)
{// 打印0-9数字 black数字标黑
cout << "\033[0;0H";
for (int i = 1; i <= 10; i++)
{
if (i%10 == black)
cout << "\033[7m " << i%10 << " \033[0m";
else
cout << "\033[47;30m " << i%10 << " \033[0m";
}
}
int print_keyboard(char ch, string color)
{// 打印键盘 ch字符设定为color颜色,其余默认
char key[7][15] = {
"1234567890-=",
"QWERTYUIOP[]\\",
"ASDFGHJKL;'",
"ZXCVBNM,./",
"{}?><|~!@#",
"$%^&*()_+"
};
cout << "\033[2;1H";
for (int i = 0; i < 4; i++)
{
for (int j = 0; j < i; j++)
{
cout << " ";
}
for (int j = 0; key[i][j] != 0; j++)
{
if (ch == key[i][j])
{
if (color == "black")
cout << "\033[7m " << key[i][j] << " \033[0m";
else if (color == "green")
cout << "\033[42;30m " << key[i][j] << " \033[0m";
else if (color == "red")
cout << "\033[41;30m " << key[i][j] << " \033[0m";
}
else
cout << "\033[47;30m " << key[i][j] << " \033[0m";
}
cout << endl;
}
}
int typewritting()
{// 打字过程,返回总用时
// 键盘字符集
char s[] = "1234567890-=QWERTYUIOP[]\\ASDFGHJKL;'ZXCVBNM,./";
int len = strlen(s);
srand(time(0));
correct = 0;
wrong = 0;
int last = 0;
int sta = time(0);
wrong--;
for (int i = 0; i <= TIMES; i++)
{
cout << "\033c" << flush;
cout << "对: " << correct << " 错: " << wrong << "\n";
// 抽取键盘字符集下标
int r = rand() % len;
// 避免连续两次按键相同
while (r == last) r = rand() % len;
last = r;
print_keyboard(s[r], "black");
char ch = getch();
if (ch == s[r] || (islower(ch) && ch == tolower(s[r])))
{
print_keyboard(s[r], "green");
correct++;
}
else
{
if (islower(ch))
print_keyboard(toupper(ch), "red");
else
print_keyboard(ch, "red");
wrong++;
}
usleep(300000);
}
int end = time(0);
return end - sta;
}
void intro()
{// 规则介绍
cout<<"你输入多少个字符?";
cin>>TIMES;
cout << "\033c" << flush;
cout << "欢迎使用C++打字通!" << endl;
sleep(1);
cout << "开始后,你需要用最快的速度按下黑色字符所对应的按键。" << endl;
sleep(1);
printf("共%d个字符\n",TIMES);
sleep(1);
cout << "*注意:请将输入法改为英文!" << endl;
sleep(1);
cout << "准备好了嘛?" << endl;
cout << "\033c" << flush;
cout << "3" << endl;
sleep(1);
cout << "2" << endl;
sleep(1);
cout << "1" << endl;
sleep(1);
cout << "开始!" << endl;
usleep(300000);
}
// 问题和答案的结构体
struct Question {
string question;
string answer;
};
// 初始化问题和答案
void initQuestions(Question questions[]) {
questions[0] = {"What is the capital of France?", "Paris"};
questions[1] = {"What is the largest planet in our solar system?", "Jupiter"};
questions[2] = {"Which country is known as the Land of the Rising Sun?", "Japan"};
questions[3] = {"What is the currency of China?", "Yuan"};
questions[4] = {"Is orange round?", "Yes"};
questions[5] = {"What is the chemical symbol for gold?", "Au"};
questions[6] = {"Is James a basketball player?", "Yes"};
questions[7] = {"Usain Bolt is fast or slow?", "fast"};
questions[8] = {"Which animal is known as the 'King of the Jungle'?", "Lion"};
questions[9] = {"What is the day between Monday and Wednesday?", "Tuesday"};
}
const int ROW = 10;
const int COL = 10;
const int MINE_NUM = 10;
vector<vector<int>> mineMap(ROW, vector<int>(COL, 0));
vector<vector<int>> showMap(ROW, vector<int>(COL, -1));
bool checkBound(int x, int y)
{
if (x < 0 || x >= ROW || y < 0 || y >= COL) return false;
return true;
}
void randomMine()
{
int count = 0;
while (count < MINE_NUM) {
int x = rand() % ROW;
int y = rand() % COL;
if (mineMap[x][y] == 0) {
mineMap[x][y] = 9;
count++;
}
}
}
int calCount(int x, int y)
{
int count = 0;
for (int i = x - 1; i <= x + 1; i++) {
for (int j = y - 1; j <= y + 1; j++) {
if (checkBound(i, j) && mineMap[i][j] == 9) count++;
}
}
return count;
}
void spread(int x, int y)
{
if (!checkBound(x, y) || showMap[x][y] > -1 || mineMap[x][y] == 9) return;
int count = calCount(x, y);
showMap[x][y] = count;
if (count == 0) {
spread(x - 1, y - 1);
spread(x - 1, y);
spread(x - 1, y + 1);
spread(x, y - 1);
spread(x, y + 1);
spread(x + 1, y - 1);
spread(x + 1, y);
spread(x + 1, y + 1);
}
}
void printMap()
{
for (int i = 0; i < ROW; i++)
{
cout << i << " ";
for (int j = 0; j < COL; j++)
{
if (showMap[i][j] == -1)
{
cout << "* ";
}
else if (showMap[i][j] == 0)
{
cout << " ";
}
else if (showMap[i][j] == 10)
{
cout << "X ";
}
else
{
cout << showMap[i][j] << " ";
}
}
cout << endl;
}
}
bool checkWin()
{
for (int i = 0; i < ROW; i++)
{
for (int j = 0; j < COL; j++)
{
if (showMap[i][j] == -1 && mineMap[i][j] != 9)
{
return false;
}
}
}
return true;
}
int program()
{
cout << "想体验哪种模式(1 : 挑战模式,2 : 练习模式):" << "\n";
int x;
cin >> x;
if(x == 1)
{
srand((unsigned)time(NULL));
randomMine();
while (true) {
cout << " 0 1 2 3 4 5 6 7 8 9\n";
printMap();
char cx, cy;
cout << "请输入要打开的位置坐标(如0(x)1(y)),或输入-1结束游戏:" << endl;
cin >> cx >> cy;
int x = cx - '0',y = cy - '0';
if(x == 12345666787878 && y == 45456663222) {
cout << "你赢了!高手高高手!" << endl;
break;
}
if (x == -1 || y == -1) {
break;
}
if (mineMap[x][y] == 9) {
cout << "你输了,请再来一局吧!" << endl;
break;
} else {
spread(x, y);
if (checkWin()) {
cout << "你赢了!高手高高手!" << endl;
break;
}
}
}
}
else if(x == 2)
{
bool f = 1;
while(f = 1)
{
srand((unsigned)time(NULL));
randomMine();
while (true)
{
cout << " 0 1 2 3 4 5 6 7 8 9\n";
printMap();
char cx = '^',cy = '^';
cout << "请输入要打开的位置坐标(如0(x)1(y)),或输入-1结束游戏:" << endl;
cin >> cx >> cy;
int x = cx - '0',y = cy - '0';
if(x == 12345666787878 && y == 45456663222)
{
cout << "你赢了!高手高高手!" << endl;
break;
}
if (x == -1 || y == -1)
{
break;
}
if (mineMap[x][y] == 9)
{
cout << "你输了,是否再试试有没有其他方法吧!(Yes/No):";
string s;
cin >> s;
if(s != "Yes")
{
return 1;
}
}
else
{
spread(x, y);
}
}
}
return 1;
}
}
void recursion()
{
if(program() > -1)
{
cout << "是否继续(Yes/No):";
string s;
cin >> s;
if(s == "Yes")
{
mineMap.assign(ROW, vector<int>(COL, 0));
showMap.assign(ROW, vector<int>(COL, -1));
recursion();
}
}
}
void playplayplayplay()
{
long long B;
int A;
B=10000000000;
for(int j=0;j<1;B=100000000000)
{
if(M)
cout<<"请选择你想玩的游戏(请先登录):"<<endl<<"1、趣味22题 2、石头剪刀布 3、计算小达人 4、计算器 5、今日运势 6、勇夺宝箱 7、金币 8、无头小子照片 9、学霸才做的加法题 10、火影忍者 11、欢迎贵宾玩扫雷 12、英语回答问题 13、愤怒的皮皮 14、打字游戏 15、战争世界 16、双人五子棋 17、小伙见到一沓钱 18、迷宫 19、武将pk 20、猜数 21、死亡空格 22、循环诗 23、打印单位矩阵 24、计算 25、运算 26、打印数字金字塔 27、ASCII码查询 28、字符串反转 29、猜数英文版 30、数字炸弹 31、测手速 32、三国杀(密码114666888)。如果不想玩了输入0 (注意:不要乱输入字符、21和22谨慎使用)<( ̄︶ ̄)↗[GO!]"<<endl;
else
cout<<"用户:@"<<O;
printf(" 请选择你想玩的游戏:1、趣味22题 2、石头剪刀布 3、计算小达人 4、计算器 5、牛人游戏 6、打字不要后悔 7、金币 8、无头小子照片 9、学霸才做的加法题 10、火影忍者 11、欢迎贵宾玩扫雷 12、英语回答问题 13、愤怒的皮皮 14、打字游戏 15、战争世界 16、双人五子棋 17、小伙见到一沓钱 18、计算(除法为整数除法,只要余数) 19、武将pk 20、猜数 21、死亡空格 22、循环诗 23、打印单位矩阵 24、计算 25、运算 26、打印数字金字塔 27、ASCII码查询 28、字符串反转(密码114666888)。如果不想玩了输入0 (注意:不要乱输入字符、21和22谨慎使用)<( ̄︶ ̄)↗[GO!]",O);
cin>>A;
if(M)
{
cout<<"请输入用户名:";
cin>>O;
M=false;
cout<<"您的用户名是:@"<<O<<endl;
}
if(A==3)
{
clear();
sleep(1);
srand(time(0));
int tsum = 0;
int maxt = 0;
long long mint = 99999999999;
int wrongCount = 0, rightCount = 0;
for (int i = 1; i <= 10 ; i++) //请写出循环条件
{
long double a = rand() % 10 + 1;
long double b = rand() % 10 + 1;
long double op = rand() % 4 + 1;
int res;
if (op == 1) // 加法
{
cout << a << " + " << b << " = " << endl;
res = a + b;
}
if (op == 2) // 减法
{
if (a < b)
{
int c = a;
a = b;
b = c;
}
cout << a << " - " << b << " = " << endl;
res = a - b;
}
if (op == 3) // 乘法
{
cout << a << " * " << b << " = " << endl;
res = a * b;
}
if (op == 4) // 除法
{
cout << a * b << " / " << a << " = " << endl;
res = b;
}
int ans, beg = time(0); // 开始时间
cout << "请输入你的计算结果:" << endl;
cin >> ans;
if (ans == res)
{
cout << "(^-^)V 答对了!" << endl;
rightCount++;
}
else
{
cout << "┭┮﹏┭┮ 答错了!" << endl;
wrongCount++;
}
cout << endl;
int end = time(0); // 结束时间
tsum += end - beg;
if (end - beg > maxt)
{
maxt = end - beg;
}
if(mint>end-beg)
{
mint=end-beg;
}
cout << "本题用时:" << end - beg << " 秒" << endl << endl;
sleep(1);
clear();
sleep(1);
}
cout << "( ̄▽ ̄)~* 游戏结束!" << endl;
cout << "总计:" << rightCount * 10.0<< " 分" <<endl;
cout << "对:" << rightCount << " 道" << endl;
cout << "错:" << wrongCount << " 道" << endl;
cout << "总用时:" << tsum << " 秒" << endl;
cout << "平均用时:" << tsum / 10.0 << " 秒" << endl;
cout << "最慢用时:" << maxt <<"秒"<< endl;
cout << "最快用时:" << mint <<"秒"<< endl;
}
else if(A==2)
{
int e1,u,h;
cout<<"和垃圾版AI玩石头剪刀布,你想要几局几胜?"<<endl;
cout<<"1、三局两胜 2、五局三胜 3、七局四胜";
cin>>e1;
if(e1==1)
{
e1=3;
}
else if(e1==2)
{
e1=5;
}
else if(e1==3)
{
e1=7;
}
else if(e1>3)
{
e1=3;
}
else
{
e1=7;
}
// 任务1 玩家出招
for(int u=0;u<e1;u++)
{
cout << "和AI玩石头剪刀布,请输入你的选择:"<< endl;
cout << "1、石头" << endl;
cout << "2、剪刀" << endl;
cout << "3、布" << endl;
int a1;
cin >> a1;
if(a1>3)
{
a1=a1%3+1;
}
if(a1== 1)
{
cout << "你出的是石头" << endl;
}
if(a1== 2)
{
cout << "你出的是剪刀" << endl;
}
if(a1 == 3)
{
cout << "你出的是布" << endl;
}
// 任务2 AI出招
srand(time(0)); //评测时请注释掉这行数据
int b1 = rand()%3 +1;
if(b1 == 1)
{
cout << "AI出的是石头" << endl;
}
if(b1== 2)
{
cout << "AI出的是剪刀" << endl;
}
if(b1 == 3)
{
cout << "AI出的是布" << endl;
}
// 任务3 判断胜负
// 使用if嵌套来完成判断
if(a1==b1)
{
cout<<"平手"<<endl;
}
else
{
if(a1<b1)
{
if(b1-a1==2)
{
h+=1;
cout<<"你输了";
}
else
{
u+=1;
cout<<"你赢了";
}
}
else
{
if(a1-b1==2)
{
u+=1;
cout<<"你赢了";
}
else
{
h+=1;
cout<<"你输了";
}
}
}
}
if(u>=h)
{
cout<<"总场结算:你赢了。";
}
else
{
cout<<"总场结算:你输了。";
}
}
else if(A==1)
{
int a,b,c,d;
long double e;//a是选择,b是做对题目数,c是想做的题目数,d是你想做的关卡;
cout<<"请选择你想做的题目数:";
cin>>c;
b=0;
for(int i=1;i<=c;i++)
{
cout<<"第"<<i<<"次答题,请选择你想做的关卡(一共22题)";
cin>>d;
if(d>22)
d=d%22+1;
if(d==1)
{
cout<<"请问地球🌏最深的海沟是什么海沟?"<<endl;
cout<<"1、日本海沟🗾 2、秘鲁-智利海沟 3、马里亚纳海沟";
cin>>a;
if(a>3||a==0)
a=a%3+1;
if(a==3)
{
b+=1;
cout<<"(^ - ^)V答对了!";
}
else if(a==1||a==2)
{
cout<<"~_~ 答错了";
}
else
{
cout<<"没有该答案哦,继续";
cin>>a;
if(a==3)
{
b+=1;
cout<<"(^ - ^)V答对了!";
}
else
{
cout<<"~_~ 答错了";
}
}
}
if(d==2)
{
cout<<"请问全球最大的沙漠是什么沙漠🏜?"<<endl;
cout<<"1、利比亚沙漠 2、撒哈拉沙漠 3、阿拉伯沙漠";
cin>>a;
if(a>3||a==0)
a=a%3+1;
if(a==2)
{
b+=1;
cout<<"(^ _ ^)V答对了!";
}
else
{
cout<<"答错了/(ㄒoㄒ)/~~";
}
}
if(d==3)
{
cout<<"世界上最长的裂缝是什么?"<<endl;
cout<<"1、加拿大北极裂谷 2、东非大裂谷 3、大西洋裂缝";
cin>>a;
if(a>3||a==0)
a=a%3+1;
if(a==3)
{
b+=1;
cout<<"答对啦!";
}
else
{
cout<<"答错了";
}
}
if(d==4)
{
cout<<"全世界最安全的房子是什么?"<<endl;
cout<<"1、白宫 2、生存公寓 3、亚历山大堡";
cin>>a;
if(a>3||a==0)
a=a%3+1;
if(a==3)
{
b+=1;
cout<<"(*^_^*)答对啦!";
}
else
{
cout<<"/(ㄒoㄒ)/~~答错了。";
}
}
if(d==5)
{
cout<<"世界上最长的堵车发生在哪里?"<<endl;
cout<<"1、巴西 2、俄罗斯 3、亚特兰大";
cin>>a;
if(a>3||a==0)
a=a%3+1;
if(a==1)
{
b+=1;
cout<<"答对啦";
}
else
{
cout<<"答错了";
}
}
if(d==6)
{
cout<<"世界上最危险的海洋生物是什么?"<<endl;
cout<<"1、大白鲨 2、姥鲨 3、鲸鲨";
cin>>a;
if(a>3||a==0)
a=a%3+1;
if(a==3)
{
b+=1;
cout<<"答对啦";
}
else{
cout<<"答错了";
}
}
if(d==7)
{
cout<<"人类已知宇宙中最大的黑洞是什么?"<<endl;
cout<<"1、人马座a 2、Phoenix a 3、TON 618";
cin>>a;
if(a>3||a==0)
a=a%3+1;
if(a==2)
{
b+=1;
cout<<"答对啦q(≧▽≦q)";
}
else
{
cout<<"答错了啊( •̀ ω •́ )继续加油✧";
}
}
if(d==8)
{
cout<<"人类已知宇宙中体积最大的恒星是什么?"<<endl;
cout<<"1、史蒂文森2-18 2、太阳☀ 3、盾牌座uy";
cin>>a;
if(a>3||a==0)
a=a%3+1;
if(a==1)
{
b+=1;
cout<<"答对啦";
}
else
{
cout<<"答错了";
}
}
if(d==9)
{
cout<<"人类已知宇宙中最高的山是什么?"<<endl;
cout<<"1、珠穆朗玛峰 2、奥林匹斯山 3、瑞亚希尔维娅山";
cin>>a;
if(a>3||a==0)
a=a%3+1;
if(a==2)
{
cout<<"答对啦";
b+=1;
}
else
{
cout<<"答错了";
}
}
if(d==10)
{
cout<<"人类已知宇宙中最大的天体?"<<endl;
cout<<"1、室女座超星系团 2、拉尼亚凯亚星系团 3、武仙-北冕座长城";
cin>>a;
if(a>3||a==0)
a=a%3+1;
if(a==3)
{
b+=1;
cout<<"答对啦";
}
else
{
cout<<"答错了";
}
}
if(d==11)
{
cout<<"conversation是什么意思?"<<endl;
cout<<"1、谈话 2、绘画 3、地点";
cin>>a;
if(a>3||a==0)
a=a%3+1;
if(a==1)
{
b+=1;
cout<<"bingo答对啦";
}
else
{
cout<<"I am sad.答错了/(ㄒoㄒ)/~~";
}
}
if(d==12)
{
cout<<"龙在英语中的新语言是什么?"<<endl;
cout<<"1、loong 2、dragon 3、dinosaur";
cin>>a;
if(a>3||a==0)
a=a%3+1;
if(a==1)
{
b+=1;
cout<<"答对啦";
}
else
{
cout<<"答错了";
}
}
if(d==13)
{
cout<<"'你(们)的'在英语里怎么说?"<<endl;
cout<<"1、you 2、your 3、this";
cin>>a;
if(a>3||a==0)
a=a%3+1;
if(a==2)
{
b+=1;
cout<<"答对啦(〃 ̄︶ ̄)人( ̄︶ ̄〃)";
}
else
{
cout<<"答错了≡(▔﹏▔)≡";
}
}
if(d==14)
{
cout<<"2*50=?ヾ(•ω•`)o"<<endl;
cout<<"1、100 2、50 3、我去拿个计算机(@_@;)";
cin>>a;
if(a>3||a==0)
a=a%3+1;
if(a==1)
{
b+=1;
cout<<"答对啦";
}
else if(a==3)
{
cout<<"本题不支持使用计算机,回答错误";
}
else
{
cout<<"回答错误(⊙o⊙)";
}
}
if(d==15)
{
cout<<"Mid-Autumn Festval是什么意思?"<<endl;
cout<<"1、女神节 2、中秋节 3、七夕节";
cin>>a;
if(a>3||a==0)
a=a%3+1;
if(a==2)
{
b+=1;
cout<<"回答正确。";
}
else
{
cout<<"回答错误。";
}
}
if(d==16)
{
cout<<"请问'三十功名尘与土,八千里路云和月'是杜甫写的吗?"<<endl;
cout<<"1、对 2、错";
cin>>a;
if(a>3||a==0)
a=a%3+1;
if(a==2)
{
b+=1;
cout<<"回答正确";
}
else
{
cout<<"回答错误,'三十功名尘与土,八千里路云和月。'出自岳飞的《满江红 写怀》";
}
}
if(d==17)
{
cout<<"double是什么"<<endl;
string A;
cout<<"a、浮点数 b、平方数 c、整数";
cin>>A;
cout<<endl;
if(A=="a")
{
b+=1;
cout<<"你也是会C++的";
}
else
{
cout<<"你不会C++";
}
}
if(d==18)
{
cout<<"unordered_motimap出自哪个头文件?"<<endl;
cout<<"1、unordered_map 2、functional 3、map";
cin>>a;
if(a>3||a==0)
a=a%3+1;
if(a==1)
{
b+=1;
cout<<"你竟然对了!";
}
else
{
cout<<"就知道你会错(•̀ ω •́ )✧";
}
}
if(d==19)
{
cout<<"'int main(){}'这个编程成不成立"<<endl;
cout<<"1、成立 2、不成立";
cin>>a;
if(a>3||a==0)
a=a%3+1;
if(a==1)
{
b+=1;
cout<<"确实";
}
else
{
cout<<"确实才怪";
}
}
if(d==20)
{
cout<<"请问以下哪个不是MC的全称?"<<endl;
cout<<"1、Minecraft 2、microphone Controler 3、Mine Coffee";
cin>>a;
if(a>3||a==0)
a=a%3+1;
if(a==3)
{
b+=1;
cout<<"什么!你竟然对了!!!";
}
else
{
cout<<"haha cool!你错了!";
}
}
if(d==21)
{
cout<<"世界上最厉害的武器是什么?"<<endl<<"1、UMG-133A弹道导弹 2、撒旦导弹 3、沙皇炸弹大伊万【💣(╯‵□′)╯炸弹!•••*~●】";
cin>>a;
if(a>3||a==0)
a=a%3+1;
if(a==3)
{
cout<<"答对啦";
b+=1;
}
else
{
cout<<"答错了";
}
}
if(d==22)
{
cout<<"请问至2019年,最流行的编程语言是什么?"<<endl;
cout<<"1、Python 2、C++ 3、Fortran"<<endl;
cin>>a;
if(a>3||a==0)
a=a%3+1;
if(a==1)
{
cout<<"答对啦";
b++;
}
else
{
cout<<"答错了/(|!*o!*|)/~~";
}
}
}
cout<<"你对了"<<b<<"题"<<endl;
cout<<"你错了"<<c-b<<"题"<<endl;
cout<<"正确率:"<< double(100/c*b)<<"%"<<endl;
}
else if(A==4)
{
while(1)
{
long long a2;
cout<<"一、1、整数加法(long long+) 2、整数减法(long long-) 3、整数乘法(long long*) 4、整数除法(long long / %) 5、小数加法(long double+) 6、小数减法(long double-) 7、小数乘法(double*) 8、小数除法(long double /) 9、判断奇偶数 10、将小数四舍五入到几位 11、绝对值 12、double类型向上取整(floor) 13、double类型向下取整(ceil) 14、最大值 15、最小值 16、菱形 17、退出 18、倒立直角三角形 19、长方形 20、等腰三角形 21、整数平方(pow) 22、整数绝对值(abs) 23、float类型向上取整(ceilf) 24、float类型向下取整(floorf) 25、long double类型向上取整(ceill) 26、long double类型向下取整(floorl) 27、平方根(sprt) 28、立方根(cbrt) 29、double类型小数绝对值(fabs) 30、float类型小数绝对值(fabsf) 31、long double类型绝对值(fabsl) 二、商是整数的小数除法 32、double类型的求余(fmod) 33、int类型的求余(int%) 34、float类型的求余(fmodf) 35、long double类型的求余(fmodl) 三、36、hypot 37、float类型平方(powf) 38、long double类型平方(powl) 39、float类型平方根(sqrtf) 40、long double类型平方根(sqrtl) 41、long类型绝对值(labs) 42、c++最大储存范围(unsigned long long) 43、acos 44、acosl 45、acosl 46、asin 47、asinf 48、asinl 49、atan 50、atan2 51、atan2f 52、atan2l 53、atanf 54、atanl 55、cos 56、cosf 57、cosh 58、coshf 59、coshl 60、cosl 61、exp 62、expf 63、expl 64、C++单位转换 65、log 66、logf 67、logl 68、log10 69、log10f 70、log10l(可能超出数据范围,或cout默认精度)";
cin>>a2;
if(a2==1)
{
long long a3;
cout<<"请输入你想相加的数:";
cin>>a2>>a3;
cout<<endl;
cout<<a2<<"+"<<a3<<"="<<a2+a3<<endl;
}
if(a2==2)
{
long long b1,b2;
cout<<"请输入被减数:";
cin>>b1;
cout<<endl;
cout<<"请输入被减数:";
cin>>b2;
cout<<endl;
cout<<b1<<"-"<<b2<<"="<<b1-b2<<endl;
}
if(a2==3)
{
long long c1,c2;
cout<<"请输入你想相乘的数:";
cin>>c1>>c2;
cout<<endl;
cout<<c1<<"*"<<c2<<"="<<c1*c2<<endl;
}
if(a2==4)
{
long long d1,d2;
cout<<"请输入被除数:";
cin>>d1;
cout<<endl;
cout<<"请输入除数:";
cin>>d2;
cout<<endl;
cout<<d1<<"/"<<d2<<"="<<d1/d2<<"……"<<d1%d2<<endl;
}
if(a2==5)
{
long double f1,f2;
cout<<"请输入你想相加的数:";
cin>>f1>>f2;
cout<<endl;
cout<<f1<<"+"<<f2<<"="<<f1+f2<<endl;
}
if(a2==6)
{
long double g1,g2;
cout<<"请输入被减数:";
cin>>g1;
cout<<endl;
cout<<"请输入减数:";
cin>>g2;
cout<<endl;
cout<<g1<<"-"<<g2<<"="<<g1-g2<<endl;
}
if(a2==7)
{
long double man1,man2;
cout<<"请输入你想相乘的数:";
cin>>man1>>man2;
cout<<endl;
cout<<man1<<"*"<<man2<<"="<<man1*man2<<endl;
}
if(a2==8)
{
long double say1,say2;
cout<<"请输入被除数:";
cin>>say1;
cout<<endl;
cout<<"请输入除数:";
cin>>say2;
cout<<endl;
cout<<say1<<"/"<<say2<<"="<<say1/say2<<endl;
}
if(a2==9)
{
long long you;
cout<<"请输入你要判断的数:";
cin>>you;
if(you%2==0)
{
cout<<you<<"是偶数"<<endl;
}
else
{
cout<<you<<"是奇数"<<endl;
}
}
if(a2==10)
{
long double WC;
long Wc;
cout<<"请输入一个小数:";
cin>>WC;
cout<<"保留几位小数:";
cin>>Wc;
cout<<fixed<<setprecision(Wc)<<WC<<endl;
}
if(a2==11)
{
long long pig;
cout<<"请输入一个整数:";
cin>>pig;
cout<<"绝对值是"<<abs(pig)<<endl;
}
if(a2==12)
{
cout<<"请输入一个double类型小数:";
long double dog;
cin>>dog;
cout<<ceil(dog)<<endl;
}
if(a2==13)
{
long double yukky;
cout<<"请输入一个double类型小数:";
cin>>yukky;
cout<<floor(yukky)<<endl;
}
if(a2==14)
{
long double sun2,maxn=-9e18;
long long sun1;
cout<<"请输入你要多少个数的最大值:";
cin>>sun1;
cout<<"请输入这几个数,用空格隔开。";
for(int j=0;j<sun1;j++)
{
cin>>sun2;
maxn=fmax(sun2,maxn);
}
cout<<"最大值是"<<maxn<<endl;
}
if(a2==15)
{
long long sha;
long double sha1,minn=9e18;
cout<<"请输入你想要多少个数的最小值:";
cin>>sha;
cout<<"请输入这几个数,用空格隔开。";
for(int s=0;s<sha;s++)
{
cin>>sha1;
minn=fmin(minn,sha1);
}
cout<<"最小值是"<<minn<<endl;
}
if(a2==16)
{
cout<<"输入一个数";
int n;
cin >> n;
for (int i = 1; i <= n; i++) {
for (int j = 1; j <= n - i; j++) {
cout << ' ';
}
for (int j = 1; j <= i; j++) {
cout << "* ";
}
cout << endl;
}
for(int i=n-1;1<=i;i--)
{
for (int j = 1; j <= n - i; j++) {
cout << ' ';
}
for (int j = 1; j <= i; j++) {
cout << "* ";
}
cout << endl;
}
}
if(a2==17)
{
break;
}
if(a2==18)
{
int n;
printf("输入一个数\n");
cin >> n;
for (int i = n; 1 <= i; i--) {
for (int j = 1; j <= i; j++) {
cout << '*';
}
cout << endl;
}
}
if(a2==19)
{
cout<<"输入长和宽";
int n, m;
cin >> m >> n;
for(int i=1; i<=m;i++)
{
for(int j=1;j<=n;j++)
{
cout<<'*';
}
cout<<endl;
}
}
if(a2==20)
{
int n;
cin >> n;
for(int i=1;i<=n;i++)
{
for(int j=1;j<=n-i;j++)
{
cout<<' ';
}
for(int j=1;j<=2*i-1;j++)
{
cout<<'*';
}
cout<<endl;
}
}
if(a2==21)
{
long long a,b;
printf("输入多少的多少次方");
cin>>a>>b;
cout<<pow(a,b)<<endl;
}
if(a2==22)
{
printf("Enter a number");
int n1;cin>>n1;cout<<abs(n1)<<endl;
}
if(a2==23)
{
cout<<"输入一个float类型小数:";
float a3;
cin>>a3;
cout<<"是"<<ceilf(a3)<<endl;
}
if(a2==24)
{
cout<<"输入一个float类型的小数:";
float b3;
cin>>b3;
cout<<"是"<<floorf(b3)<<endl;
}
if(a2==25)
{
cout<<"输入一个long double类型的小数:";
long double c3;
cin>>c3;
cout<<"是"<<ceill(c3)<<endl;
}
if(a2==26)
{
cout<<"输入一个long double类型的小数:";
long double d3;
cin>>d3;
cout<<"是"<<floorl(d3)<<endl;
}
if(a2==27)
{
cout<<"输入要求多少的平方根:";
long double r;
cin>>r;
cout<<r<<"的平方根是"<<sqrt(r)<<endl;
}
if(a2==28)
{
cout<<"输入要求多少的立方根:";
long double s;
cin>>s;
cout<<s<<"的立方根是"<<cbrt(s)<<endl;
}
if(a2==29)
{
cout<<"输入一个小数:";
double s1;
cin>>s1;
cout<<"是"<<fabs(s1)<<endl;
}
if(a2==30)
{
cout<<"输入一个float类型的小数:";
float dd;
cin>>dd;
cout<<"是"<<fabsf(dd)<<endl;
}
if(a2==31)
{
cout<<"输入一个long double类型的小数:";
long double aa;
cin>>aa;
cout<<"是"<<fabsl(aa)<<endl;
}
if(a2==32)
{
cout<<"输入要求多少除以多少的余数:";
double aa,aaa;
cin>>aa>>aaa;
cout<<"是"<<fmod(aa,aaa)<<endl;
}
if(a2==33)
{
cout<<"输入要求多少除以多少的余数:";
int aaaa,aaaaa;
cin>>aaaa>>aaaaa;
cout<<"是"<<aaaa%aaaaa<<endl;
}
if(a2==34)
{
cout<<"输入要求多少除以多少的余数:";
float bbb,bbbb;
cin>>bbb>>bbbb;
cout<<"是"<<fmodf(bbb,bbbb)<<endl;
}
if(a2==35)
{
cout<<"输入要求多少除以多少的余数:";
long double ddd,dddd;
cin>>ddd>>dddd;
cout<<"是"<<fmodl(ddd,dddd)<<endl;
}
if(a2==36)
{
cout<<"输入两个数:";
long double ee,eee;
cin>>ee>>eee;
cout<<"约等于"<<hypot(ee,eee)<<endl;
}
if(a2==37)
{
float tt,ttt;
cout<<"输入要求多少的多少次方";
cin>>tt>>ttt;
cout<<"是"<<powf(tt,ttt)<<endl;
}
if(a2==38)
{
long double gg,ggg;
cout<<"输入要求多少的多少次方";
cin>>gg>>ggg;
cout<<"是"<<powl(gg,ggg)<<endl;
}
if(a2==39)
{
float sp;
cout<<"输入要求多少的平方根";
cin>>sp;
cout<<sp<<"的平方根是"<<sqrtf(sp)<<endl;
}
if(a2==40)
{
long double sb;
cout<<"输入要求多少的平方根";
cin>>sb;
cout<<sb<<"的平方根是"<<sqrtl(sb)<<endl;
}
if(a2==41)
{
long ed;
cout<<"输入一个long类型的数";
cin>>ed;
cout<<"是"<<labs(ed)<<endl;
}
if(a2==42)
{
unsigned long long aaaaaa=18446744073709551615;
cout<<aaaaaa<<endl;
}
if(a2==43)
{
cout<<"输入一个double类型的数(-1~1):";
double a6;
cin>>a6;
cout<<"是"<<acos(a6)<<endl;
}
if(a2==44)
{
cout<<"输入一个float类型的数(-1~1):";
float a7;
cin>>a7;
cout<<"是"<<acosf(a7)<<endl;
}
if(a2==45)
{
cout<<"输入一个long double类型的数(-1~1):";
long double a8;
cin>>a8;
cout<<"是"<<acosl(a8)<<endl;
}
if(a2==46)
{
cout<<"输入一个double类型的数:";
double b2;
cin>>b2;
cout<<"是"<<asin(b2)<<endl;
}
if(a2==47)
{
cout<<"输入一个float类型的数:";
float ab;
cin>>ab;
cout<<"是"<<asinf(ab)<<endl;
}
if(a2==48)
{
cout<<"输入一个long double类型的数:";
long double bc;
cin>>bc;
cout<<"是"<<asinl(bc)<<endl;
}
if(a2==49)
{
cout<<"输入一个double类型的数:";
double cd;
cin>>cd;
cout<<"是"<<atan(cd)<<endl;
}
if(a2==50)
{
cout<<"输入两个double类型的数:";
double de,ef;
cin>>de>>ef;
cout<<"是"<<atan2(de,ef)<<endl;
}
if(a2==51)
{
cout<<"输入两个float类型的数:";
float ac,bd;
cin>>ac>>bd;
cout<<"是"<<atan2f(ac,bd);
}
if(a2==52)
{
cout<<"输入两个long double类型的数:";
long double ad,ba;
cin>>ad,ba;
cout<<"是"<<atan2l(ad,ba)<<endl;
}
if(a2==53)
{
cout<<"输入一个float类型的数:";
float fd;
cin>>fd;
cout<<"是"<<atanf(fd);
}
if(a2==54)
{
cout<<"输入一个long double类型的数:";
long double sa;
cin>>sa;
cout<<"是"<<atanl(sa)<<endl;
}
if(a2==55)
{
cout<<"输入一个double类型的数:";
double value;
cin>>value;
cout<<"是"<<cos(value)<<endl;
}
if(a2==56)
{
cout<<"输入一个float类型的数:";
float lann;
cin>>lann;
cout<<"是"<<cosf(lann)<<endl;
}
if(a2==57)
{
cout<<"输入一个double类型的数:";
double xy;
cin>>xy;
cout<<"是"<<cosh(xy)<<endl;
}
if(a2==58)
{
cout<<"输入一个float类型的数:";
float yx;
cin>>yx;
cout<<"是"<<coshf(yx)<<endl;
}
if(a2==59)
{
cout<<"输入一个long double类型的数:";
long double yz;
cin>>yz;
cout<<"是"<<coshl(yz)<<endl;
}
if(a2==60)
{
cout<<"输入一个long double类型的数:";
long double ggg;
cin>>ggg;
cout<<"是"<<cosl(ggg)<<endl;
}
if(a2==61)
{
cout<<"输入一个double类型的数:";
long double ZLB;
cin>>ZLB;
cout<<"是"<<exp(ZLB)<<endl;
}
if(a2==62)
{
cout<<"输入一个float类型的数:";
float zlb;
cin>>zlb;
cout<<"是"<<expf(zlb)<<endl;
}
if(a2==63)
{
cout<<"输入一个long double类型的数:";
long double zlb1;
cin>>zlb1;
cout<<"是"<<expl(zlb1)<<endl;
}
if(a2==64)
{
cout<<"输入一串东西:";
string aac;
cin>>aac;
cout<<"C++单位转换:"<<aac<<"要"<<sizeof(aac)<<"个单位"<<"(不管怎样都是32,因为我用的是string类型)"<<endl;
}
if(a2==65)
{
cout<<"输入一个double类型的数:";
double aa1;
cin>>aa1;
cout<<"是"<<log(aa1)<<endl;
}
if(a2==66)
{
cout<<"输入一个float类型的数:";
float aa2;
cin>>aa2;
cout<<"是"<<logf(aa2)<<endl;
}
if(a2==67)
{
cout<<"输入一个long double类型的数:";
long double aa3;
cin>>aa3;
cout<<"是"<<logl(aa3)<<endl;
}
if(a2==68)
{
cout<<"输入一个double类型的数:";
double ac1;
cin>>ac1;
cout<<"是"<<log10(ac1)<<endl;
}
if(a2==69)
{
cout<<"输入一个float类型的数:";
float ac2;
cin>>ac2;
cout<<"是"<<log10f(ac2)<<endl;
}
if(a2==70)
{
cout<<"输入一个long double类型的数:";
long double ac3;
cin>>ac3;
cout<<"是"<<log10l(ac3)<<endl;
}
}
}
else if(A==5)
{
srand(time(0)); // 评测需注释掉本行
int luck = rand() % 101;
cout << "你的今日运势:" << endl;
cout << luck << endl;
if (luck>=85)
{
cout << "今天幸运值爆棚呀!" << endl;
}
else
{
if(luck>=60)
{
cout << "今天是平凡的一天~" << endl;
}
else
cout<<"~~~~~~~~~~~~~~~~~~~end";
}
}
else if(A==6)
{
wuuw();
}
else if(A==7)
{
jin_bi();
}
else if(A==8)
{
cout<<" ********* /\\ "<<endl;
cout<<" ************ * * /* \\ "<<endl;
cout<<" ***** ***** ** /* \\ "<<endl;
cout<<"** * * * / * / "<<endl;
cout<<"* ******** * * / ** / "<<endl;
cout<<"* *** *** ********* /_*__/ "<<endl;
cout<<"* * *** / * \\ "<<endl;
cout<<"* * *********\\__*__/ "<<endl;
cout<<"* * / */ "<<endl;
cout<<"* ********************/* / "<<endl;
cout<<"* * /__/ "<<endl;
cout<<"* * "<<endl;
cout<<"********************* "<<endl;
cout<<"* * * * "<<endl;
cout<<"* * * * "<<endl;
cout<<"* * * * "<<endl;
cout<<"* * * * "<<endl;
cout<<"* * * * "<<endl;
cout<<"* * * * "<<endl;
cout<<"***** ***** "<<endl;
}
else if(A==9)
{
cout<<"分数>=100成为第一。"<<endl;
srand(time(0));
int w=0;
int t=0;
int i=0;
while(i<1)
{
int a=rand()%1000000+1;
int b=rand()%1000000+1;
cout <<a <<"+"<<b <<"="<<"(0结束)";
int t1=time(0);
int q;
cin >>q;
int t2=time(0);
t+=t2-t1;
if (a+b==q&&q!=0)
{
cout <<"答对了,你真棒!○( ^皿^)っHiahiahia…"<<"挑战共用时"<<t<<"秒"<<endl;
w+=10;
}
else if(q!=0)
{
cout <<"答错了,正确答案是:" <<a+b <<"___*(  ̄皿 ̄)/#____"<<endl;
w-=5;
}
if(q==0)
{
cout<<"下次再来玩吧。分数为"<<w<<endl;
i=1;
}
if(t<20&&q!=0)
{
cout <<"手速太快了,简直是神!😆";
}
else if(t>75&&t!=0)
{
cout <<"手速有点慢,继续努力😥";
}
if (w>=100)
{
cout <<"恭喜你,挑战成功,成为第一~~~///(^v^)\\\~~~"<<"挑战共用时"<<t<<"秒";
i=1;
}
if (w<=0&&q!=0)
{
cout <<"你的分数低于0,对不起,挑战失败,再接再厉┭┮﹏┭┮";
i=1;
}
}
}
else if(A==10)
{
clear();
cout << "战斗开始,请选择难度:" << endl;
cout << "1.简单 2.普通 3.困难 4.硬核 5.噩梦 6.地狱 7.深渊" << endl;
int z;
cin >> z;
int yhp = 0;
int chp = 0;
if(z == 1)
{
yhp += 1000;
chp=1500;
}
else if(z == 2)
{
yhp += 750;
chp += 2000;
}
else if(z == 3)
{
yhp += 500;
chp += 2250;
}
else if(z == 4)
{
yhp += 200;
chp += 3500;
}
else if(z == 5)
{
yhp += 500;
chp += 7000;
}
else if(z == 6)
{
yhp += 500;
chp += 9999;
}
else if(z == 7)
{
yhp += 250;
chp += 10000;
}
else if(z == 8)
{
yhp += 500;
chp += 20000;
}
else
{
cout<< "II 没有这个选项,请重新开始选择! II"<<endl;
cout << "----------------------------------------" << endl;
if(z == 1)
{
yhp += 1000;
chp=1500;
}
else if(z == 2)
{
yhp += 750;
chp += 2000;
}
else if(z == 3)
{
yhp += 500;
chp += 2250;
}
else if(z == 4)
{
yhp += 200;
chp += 3500;
}
else if(z == 5)
{
yhp += 500;
chp += 7000;
}
else if(z == 6)
{
yhp += 500;
chp += 9999;
}
else if(z == 7)
{
yhp += 250;
chp += 10000;
}
else if(z == 8)
{
yhp += 500;
chp += 20000;
}
else
{
cout<< "II 没有这个选项,请重新开始选择! II"<<endl;
cout << "----------------------------------------" << endl;
continue;
}
}
int aaa = 0;
int lan = 2000;
int du = 0;
int tuy = 0;
for(int i = 1; true; i++)
{
if(lan<=0)
{
cout <<"法术值不足,请重新开始!";
continue;
}
clear();
cout<<"你的血量:" <<yhp<<endl<<"电脑血量:"<<chp<<endl<<"剩余法术值:"<<lan<<endl<<"毒素层数:"<<du<<endl<<"护盾值:"<<tuy<<endl;
cout<<"1.普攻:恢复5生命,恢复25法术值,造成10点伤害"<<endl;
cout<<"2.恢复:恢复30生命,消耗10法术值,造成0点伤害"<<endl;
cout<<"3.火遁|火球术:恢复3生命,消耗33法术值,造成66点伤害"<<endl;
cout<<"4.咒印|剧毒:消耗44法术值,造成25点伤害,毒素叠加一点,伤害每回合造成4伤害"<<endl;
cout<<"5.土遁|地动:恢复15生命,消耗55法术值,护盾生命为自身生命值的50%"<<endl;
cout<<"6.召唤物攻击:恢复5生命,消耗50法术值,造成75点伤害"<<endl;
cout<<"7.恢复法术值:恢复15生命,恢复66法术值,造成0点伤害"<<endl;
cout<<"8.替身术:恢复66生命,消耗150法术值,造成85点伤害"<< endl;
cout<<"9.影袭:恢复50生命,消耗200法术值,造成100伤害"<< endl;
cout<<"10.斩空波:扣除50生命,消耗300法术值,造成666伤害!"<< endl;
cout<<"11.反手里剑:扣除100生命,消耗1000法术值,造成1000伤害!"<<endl;
cout<<"12.苦无:扣除10生命,消耗30法术值,造成50伤害"<<endl;
cout<<"13.螺旋丸:恢复15生命,消耗50法术值,造成25伤害"<<endl;
cout<<"14.献祭:扣除175生命,恢复300法术值,造成50伤害"<<endl;
cout<<"15.‘写轮眼’|三勾玉:扣除100生命,消耗250法术值,造成225点伤害"<<endl;
cout<<"16.‘写轮眼’|万花筒:扣除200生命,消耗500法术值,造成675伤害"<<endl;
cout<<"17.九尾术:扣除500生命,消耗500法术值,造成1000伤害,叠加毒素10点"<<endl;
cout<<"18.水土转生:恢复500生命,消耗500法术值,造成250伤害,毒素减少5点"<<endl;
cout<<"19.白眼:恢复50生命,消耗25法术值,造成10伤害"<<endl;
cout<<"20.雾影:恢复100生命,消耗100法术值,造成75伤害"<<endl;
cout<<"21.飞雷神:扣除50生命,消耗200法术值,造成350伤害"<<endl;
cout<<"22.地爆天星:扣除500生命,恢复200法术值,造成375伤害"<<endl;
cout<<"23:尾兽行星手里剑:恢复200生命,消耗1000法术值,造成1500伤害"<<endl;
cout<<"24.时空间多重连丸:扣除10生命,消耗200法术值,造成300伤害"<<endl;
cout<<""<<endl;
cin>>aaa;
if(lan<=0)
{
cout << "法术值不足!请重新开始!"<<endl;
continue;
}
if(aaa==1)
{
yhp+=5;
chp-=10;
lan+=25;
}
if(aaa==2)
{
yhp+=30;
lan-=10;
}
if(aaa==3)
{
yhp+=3;
lan-=33;
chp-=66;
}
if(aaa==4)
{
lan-=44;
chp-=25;
du++;
}
if(aaa==5)
{
yhp+=15;
lan-=55;
tuy+=yhp/2;
}
if(aaa==6)
{
yhp+=5;
lan-=50;
chp-=75;
}
if(aaa==7)
{
yhp+=15;
lan+=66;
}
if(aaa==8)
{
yhp+=66;
lan-=150;
chp -= 85;
}
if(aaa==9)
{
yhp+=50;
lan-=200;
chp-=100;
}
if(aaa==10)
{
yhp-=50;
lan-=300;
chp-=666;
}
if (aaa==11)
{
yhp-=100;
lan-=1000;
chp-=1000;
}
if(aaa==12)
{
yhp-=10;
lan-=30;
chp-=50;
}
if(aaa==13)
{
yhp+=15;
lan-=50;
chp-=25;
}
if(aaa==14)
{
yhp-=175;
lan+=300;
chp-=50;
}
if(aaa==15)
{
yhp-=100;
lan-=250;
chp-=225;
}
if(aaa==16)
{
yhp-=200;
lan-=500;
chp-=675;
}
if(aaa==17)
{
yhp-=500;
lan-=500;
chp-=1000;
du+=10;
}
if(aaa==18)
{
yhp+=500;
lan-=500;
chp-=250;
du-=5;
}
if(aaa==19)
{
yhp+=50;
lan-=25;
chp-=10;
}
if(aaa==20)
{
yhp+=100;
lan-=100;
chp-=75;
}
if(aaa==21)
{
yhp-=100;
lan-=200;
chp-=350;
}
if(aaa==22)
{
yhp-=500;
lan+=200;
chp-=375;
}
if(aaa==23)
{
yhp+=200;
lan-=1000;
chp-=1500;
}
if(aaa==24)
{
yhp-=10;
lan-=200;
chp-=300;
}
if(lan<=0)
{
cout << "法术值不足!请重新开始!"<<endl;
continue;
}
chp-=du*4;
//电脑攻击
if(tuy==0)
{
yhp-=50;
}
else if(tuy<50)
{
yhp-=50-tuy;
tuy=0;
}
else
{
tuy-=50;
}
if(z==4)
{
yhp-=10;
}
if(yhp<=0)
{
cout<<"你输了!";
break;
}
if(chp<=0)
{
cout<<"你赢了!";
break;
}
}
}
else if(A==11)
{
string password;
cout << "请输入密码:";
cin >> password;
if(password == "114666888")
{
cout << "欢迎贵客!\n";
recursion();
}
else
{
cout << "密码错误!";
}
}
else if(A==12)
{
Question questions[10];
initQuestions(questions);
int numQuestions = sizeof(questions) / sizeof(questions[0]);
int score = 0;
// 遍历所有问题
for (int i = 0; i < numQuestions; i++) {
cout << "Question " << i+1 << ": " << questions[i].question << endl;
string userAnswer;
cout << "Your answer: ";
cin >> userAnswer;
if (userAnswer == questions[i].answer) {
cout << "Correct answer!" << endl;
score++;
} else {
cout << "Wrong answer. The correct answer is: " << questions[i].answer << endl;
}
cout << std::endl;
}
cout << "Game over! Your final score is: " << score << "/" << numQuestions << endl;
}
else if(A==13)
{
cout << "欢迎来到愤怒的皮皮!" << endl;
sleep(1);
cout << "你的目标是炸毁那些堡垒!" << endl;
sleep(1);
int n;
srand(time(0));
int sum = 0; // 总分计数器
int bg = time (0); // 记录开始时间
for (int t = 1; t <= 999; t++)
{
cout << "来!第" << t << "个堡垒!" << endl;
int score = 0; // 单次得分计数器
int dis = rand() % 8 + 3; // 到目标距离
int n = rand() % 5 + 3; // 堡垒大小
int num = rand() % 2; // 随机产生正方形或平行四边形两种堡垒:0表示正方形堡垒,1表示平行四边形堡垒
// cin >> num;
if (num == 0) // 0表示正方形堡垒
{
// 1.1 打印爆破之前的正方形堡垒图
for (int i = 1; i <= n; i++) // 总共有n行
{
for (int j = 1; j <= dis; j++) // 每行前dis列先打印空格
{
if (i == n && j == 1) // 打印前dis列的左下角的时候输出炮,其余都输出空格
{
cout << "➹";
}
else
{
cout << " ";
}
}
for (int j = 1; j <= n; j++) // 接下来的n列输出#
{
cout << "#";
}
cout << endl;
}
cout << "设置瞄准高度:" << endl;
int x, y;
cin >> x;
x = n - x + 1; // 高度和行坐标恰好相反,需要计算出来反过来的x
cout << "设置远攻距离:" << endl;
cin >> y; // 远攻距离y, 远攻距离为距左边的空格数
y = y - dis; // 由于打印图形是拼接的,实际处理爆炸范围需要减去空格数dis
// 1.2 打印爆破之后的正方形堡垒图
int lk = rand() % 3 + 1; // 设置爆炸范围,爆炸范围是1~3的随机数
for (int i = 1; i <= n; i++)
{
for (int j = 1; j <= dis; j++)
{
if (i == n && j == 1) // 打印到左下角的时候输出炮,其余都输出空格
{
cout << "➹";
}
else
{
cout << " ";
}
}
for (int j = 1; j <= n; j++) // 输出轰炸之后的图形
{
if ( abs(i - x) + abs(j - y) <= lk) // 曼哈顿距离在lk以内的输出*,表示被炸到了;否则输出#
{
cout << "*";
score++; // 记录得分
}
else
{
cout << "#"; // 未被轰炸的地方原样输出
}
}
cout << endl;
}
cout << "【本次得分" << score << "分】" << endl;
sleep(2);
clear(); // 清屏
}
else if (num == 1) // 1表示平行四边形堡垒
{
// 2.1 打印爆破之前的平行四边形堡垒图
for (int i = 1; i <= n; i++) // 总共有n行
{
for (int j = 1; j <= dis; j++) // 每行前dis列先打印空格
{
if (i == n && j == 1) // 打印前dis列的左下角的时候输出炮,其余都输出空格
{
cout << "➹";
}
else
{
cout << " ";
}
}
for (int j = 1; j <= n - i + 1; j++) // 平行四边形每行额外输出上三角形的空格
cout << " ";
for (int j = 1; j <= n; j++) // 接下来的n列输出#
cout << "#";
cout << endl;
}
cout << "设置瞄准高度:" << endl;
int x, y;
cin >> x;
x = n - x + 1; // 高度和行坐标恰好相反,需要计算出来反过来的x
cout << "设置远攻距离:" << endl;
cin >> y; // 远攻距离y, 远攻距离为距左边的空格数
y = y - dis; // 由于打印图形是拼接的,实际处理爆炸范围需要减去空格数dis
y -= n - x + 1;
// 2.2 打印爆破之后的平行四边形堡垒图
int lk = rand() % 3 + 1; // 设置爆炸范围,爆炸范围是1~3的随机数
for (int i = 1; i <= n; i++)
{
for (int j = 1; j <= dis; j++)
{
if (i == n && j == 1) // 打印到左下角的时候输出炮,其余都输出空格
{
cout << "➹";
}
else
{
cout << " ";
}
}
for (int j = 1; j <= n - i + 1; j++) // 输出此行上三角的空格个数
{
cout << " ";
}
for (int j = 1; j <= n; j++) // 输出轰炸之后的图形
{
if ( abs(i - x) + abs(j - y) <= lk) // 曼哈顿距离在lk以内的输出*,表示被炸到了;否则输出#
{
cout << "*";
score++; // 记录得分
}
else
{
cout << "#"; // 未被轰炸的地方原样输出
}
}
cout << endl;
}
cout << "【本次得分" << score << "分】" << endl;
sleep(2);
clear(); // 清屏
}
sum += score; // 累计每一轮获得的分数
int now = time(0); // 记录结束时间
if (now - bg >= 30) // 游戏时间 >= 30,游戏结束
{
t = 10000;
}
}
cout << "游戏结束,总分" << sum << "分" << endl;
}
else if(A==14)
{
intro();
int tme = typewritting();
cout << "\033c" << flush;
cout << "对: " << correct << " 错: " << wrong << "\n";
cout << "总用时" << tme << " 秒" << "\n";
cout << "正确率:" <<1.0*100/TIMES*correct <<"%"<<endl;
}
else if(A==15)
{
cout << "欢迎来到战争世界!" << endl;
cout << "要开始游戏吗?" << endl;
cout << "1要 2不要";
int a_;
cin >> a_;
if (a_ == 1)
{
cout << "好的,游戏开始!" << endl;
cout << "你要去哪?" << endl;
cout << "1城市 2海港 3密室 4大厦 5无人区" << endl;
int b_;
cin >> b_;
if (b_ == 3)
{
cout << "密室监控看到你,向你发射子弹,你被射死了。";
}
else if (b_ == 2)
{
cout << "你来到了一艘轮船上。" << endl;
cout << "听到远处枪声阵阵,你迅速赶了过去。" << endl;
cout << "原来是一个集装箱,上面有特等空投,大家在抢它呢。" << endl;
cout << "你要去抢吗?1要去 2不去" << endl;
int c_;
cin >> c_;
if (c_ == 1)
{
cout << "你在枪声中死掉了。" << endl;
}
else if (c_ == 2)
{
cout << "你做出了聪明的选择,奖励:1把加特林、1把MC74、20个手榴弹" << endl;
cout << "你想回到轮船上,船开走了。" << endl;
cout << "是否用无线广播叫轮船回来?1叫回来 2算了" << endl;
int d_;
cin >> d_;
if (d_ == 1)
{
cout << "你在翻呢,几个人冲过来把你干掉了。" << endl;
}
else
{
cout << "你错过了轮船,至少等1小时。";
cout << "几个人冲了过来,想干你。" << endl;
cout << "你要干嘛?1逃跑 2迎战";
int e_;
cin >> e_;
if (e_ == 1)
{
cout << "没用,他们把你包围了,你寡不敌众,变盒子了。" << endl;
}
else
{
cout << "你用啥武器?1加特林 2MC74 3G63Y 4手榴弹";
int f_;
cin >> f_;
if (f_ == 1 || f_ == 3)
{
cout << "没用,你在翻呢,他们冲过来把你干掉了。" << endl;
}
else if (f_ == 2)
{
cout << "你把那几个人干了,从他们身上搜出了空投。" << endl;
cout << "里面啥都没有!" << endl;
cout << "忽然,轰的一声,末影龙出现,你被吃了。" << endl;
}
else if(f_ == 4)
{
cout << "你把那几个人干了,从他们身上搜出了被烧焦的空投。" << endl;
cout << "里面啥都没有!" << endl;
cout << "忽然,轰的一声,末影龙出现,你怎么办?1一个字:跑 2 AK47 3 SDM2" << endl;
int sss;
cin >> sss;
if (sss == 2)
cout << "射的有点慢,你被它咬死了。" << endl;
else if (sss == 3)
cout << "任务完成了!" << endl;
else if (sss == 1)
cout << "你有点慢,你死了。" << endl;
}
}
}
}
}
else if (b_ == 1)
{
cout << "不知什么事,城市地震,你被埋了。";
cout << "你要求救吗?1要 2不要" << endl;
int g_;
cin >> g_;
if (g_ == 1)
{
cout << "救生人员接受到你的求救信号,来救你了。你被救了。" << endl;
cout << "你的子弹掉光了,只剩MW24和手榴弹(因为你把MW24的子弹放到了背包里)" << endl;
cout << "你修整了一会,又去吃鸡了。" << endl;
cout << "出现怪物万圣节魔鬼,你要干什么?1离开 2迎战" << endl;
int h_;
cin >> h_;
if (h_ == 1)
{
cout << "没用,怪物太快,你被吃了。" << endl;
}
else
{
cout << "你用啥武器?1MW24 2手榴弹 3P85" << endl;
int k_;
cin >> k_;
if (k_ != 1)
{
cout << "没用,你在翻呢。怪物太快,你被吃了。";
}
else
cout << "怪物翻了,你赢了。任务完成了!" << endl;
}
int h__;
cin >> h__;
if (h__ == 1)
{
cout << "没用,怪物太快,你被吃了。" << endl;
}
else
{
cout << "你用啥武器?1MW24 2手榴弹 3P85" << endl;
int k__;
cin >> k__;
if (k__ != 2)
{
cout << "没用,你在翻呢。怪物太快,你被吃了。";
}
else
cout << "怪物被你炸死了,你赢了。任务完成了!" << endl;
}
}
}
else if (b_ == 4)
{
cout << "你发现大厦里有枪声,于是你进了那层楼。" << endl;
cout << "5个房间,去哪个?";
int l_;
cin >> l_;
if(l_ == 3)
{
cout << "你进去了,果然是有强盗。" << endl;
cout << "你要用啥武器? 1加特林 2CW66 3E232";
int m_;
cin >> m_;
if(m_ == 1)
cout << "你用加特林打死了强盗,任务完成了!" << endl;
else
{
cout << "你在翻呢,强盗把你轰死了" << endl;
}
}
else
{
cout << "没人,你被强盗发现了,你死了。" << endl;
}
}
if(b_ == 5)
{
cout << "你运气很好,捡到了空投" << endl;
cout << "里面有10个手雷、一把AK47、1辆吉普车" << endl;
cout << "Oh! No!敌人来袭!";
cout << "交战中……";
cout << "敌人在翻" << endl;
cout << "你怎么办?1手雷 2AK47";
int z_;
cin >> z_;
if(z_ == 1)
{
cout << "你炸死了他" << endl;
cout << "任务完成!" << endl;
}
else
{
cout << "你也正在翻" << endl;
cout << "敌人翻完了!!!!!!!!!!!" << endl;
cout << "YOU DIED!" << endl;
}
}
cout << "想玩选择赛吗?1想2不想";
int data;
cin >> data;
if(data == 2)
cout << "谢谢光临!";
else
{
cout << "你去了迪斯尔摩天大厦。" << endl;
cout << "强盗在5楼或者6楼,你去哪间? 501、502、503、504、505、601、602、603、604、605。(一堆选项)" << endl;
int dataspace;
cin >> dataspace;
if(dataspace == 504 || dataspace == 505 || dataspace == 602 || dataspace == 604)
cout << "你打死了自称“不死人”的强盗!奖励500硬币\n";
else if(dataspace == 502 || dataspace == 503 || dataspace == 603)
cout << "你打死了自称“翼龙”的强盗!奖励800硬币\n";
else
cout << "啥都没有,你被发现了,你死了\n";
}
}
else
{
cout << "谢谢光临!";
}
}
else if(A==16)
{
int k=1,m,n;
while(true)
{
cout<<0;
for(int i=0;i<=15;i++)
{
printf("%d ",i/10);
}
cout<<"\n0";
for(int i=0;i<=15;i++)
{
printf("%d ",i%10);
}
cout<<"\n";
for(int i=1;i<=15;i++)
{
printf("%02d ",i);
for(int j=1;j<=14;j++)
{
if(a[i*15+j-15]==0)cout<<"+-";
else cout<<d[a[i*15+j-15]]<<"-";
}
if(a[i*15]==0)cout<<"+\n";
else cout<<d[a[i*15]]<<"\n";
}
int h;
printf("请玩家%d输入",k);
cin>>m>>n;
h=15*(m-1)+n;
if(a[h]!=0||m>15||n>15||m<=0||n<=0)
while(1)
{
printf("请玩家%d重新输入",k);
cin>>m>>n;
h=15*(m-1)+n;
if(a[h]==0&&n<=15&&m<=15&&n>0&&m>0)break;
}
a[h]=k;
cout<<"\033c";
int maxn=1,x=0;
for(int i=1;i<=4;i++)
{
x+=(a[h]==a[h+i])+(a[h]==a[h-i]);
}
maxn=max(maxn,x);
x=0;
for(int i=1;i<=4;i++)
{
x+=(a[h]==a[h+i*15])+(a[h]==a[h-i*15]);
}
maxn=max(maxn,x);
x=0;
for(int i=1;i<=4;i++)
{
x+=(a[h]==a[h+i*14])+(a[h]==a[h-i*16]);
}
maxn=max(maxn,x);
x=0;
for(int i=1;i<=4;i++)
{
x+=(a[h]==a[h+i*16])+(a[h]==a[h-i*14]);
}
maxn=max(maxn,x);
if(maxn>=4)
{
printf("玩家%d胜利",k);
break;
}
if(k==1)k=2;
else k=1;
}
}
else if(A==17)
{
printf("小伙捡到一沓钱,以为捡到的是美元\n翻过了一看是冥币,小伙直呼真晦气\n这冥币只要你一碰,半夜女鬼来索命\n小伙嘴角微微笑,转身来到一寺庙\n小伙丝毫也不慌,把冥币投进功德箱\n半夜女鬼真来到,发现自己中了套\n寺庙佛祖金光闪,女鬼吓得腿都软\n佛祖打出五连鞭,打得女鬼直冒烟\n佛祖骂她神经病,赶上寺庙来索命\n骂完觉得还不爽,还打出降龙十八掌\n\n不知过了多少天,女鬼重现人世间\n这次目的就一个,要让小伙死俏俏\n小伙也是很鸡贼,知道自己要倒霉\n于是掏出新手机,点开美团APP\n女鬼不知上了当,变成外卖小哥的模样\n顺着地址找上门,却直接吓得丢了魂\n外卖地址是茅山,里面全部是上仙\n上仙说女鬼太猖狂,敢来茅山耍流氓\n于是掏出桃木剑,一路火花带闪电\n\n不知过了多少天,女鬼再现人世间\n这会女鬼变小心,直接录了一段音\n这段录音很诡异,谁听立马就嗝屁\n谁知小伙不上当,把录音传到l网上\n接下来操作有点狠,把录音转发到日本\n隔天此时上新闻,整个岛国变成坟\n阎王此时也慌了神,咋死的全是日本人\n");
sleep(3);
}
else if(A==0)
{
j=B+1;
if(j=10000000000)
{
cout<<"再见ヾ( ̄▽ ̄)Bye~Bye~!"<<endl;
auto end = std::chrono::high_resolution_clock::now();
auto duration = std::chrono::duration_cast<std::chrono::nanoseconds>(end - start);
std::cout << "程序运行时间: " << duration.count() << " 纳秒" << std::endl;
}
}
else if(A==18)
{
clear();
printf("你是w 你的目标是吃掉所有的>\n输入任意字符我们就开始了",O);
cin>>O;
clear();
mi_gong();
}
else if(A==19)
{
// 游戏介绍
intro1();
// 进行游戏
winner = pk();
clear();
// 公布对战结果
showWinner(winner);
}
else if(A==20)
{
int n, number, sum;
bool flag = true;
string str;
srand((unsigned int)time(NULL));
number = rand() % 20;
cout << "准备好了吗,游戏要开始咯" << endl;
cout << "回复“no”再准备一下,回复任意开始游戏..." << endl;
cin >> str;
if (str == "no" || str == "No" || str == "nO" || str == "NO")
{
cout << "小朋友再准备一下,欢迎下次再来玩哟~" << endl;
exit(0);
}
cout << endl << "|游戏开始|" << endl << "你想有几次机会呢?" << endl;
cin >> sum;
cout << "请输入猴博士心中所想的数字(0 ~ 19),你有" << sum << "次机会哦~:";
while (sum)
{
cin >> n;
if (number > n)
{
cout << "↑ 猜小啦 ↑" << endl;
}
else if (number < n)
{
cout << "↓ 猜大啦 ↓" << endl;
}
else
{
cout << "猜对啦~,小朋友真棒!" << endl;
cout << endl << "恭喜你成功完成!( ?? ω ?? )y" << endl;
flag = false;
break;
}
sum--;
if (sum) cout << endl << "继续猜猜看,接着输入猴博士想的那个数字:" << endl;
}
if (flag)
{
cout << endl << "小朋友机会用完了哦~,猴博士心中所想的数字是: " << number << endl;
cout << "点击下方运行再尝试一次吧~"<< endl;
}
}
else if(A==21)
{
while(1)
{
cout<<"\n";
}
}
else if(A==22)
{
for(long long i=-9223372036854779808;i<=9223372036854779807;i++)
{
printf("从前有座山\n山里有座庙\n庙里有个老和尚在给小和尚讲故事\n讲的是什么故事呢\n");
}
}
else if(A==23)
{
int n;
printf("几乘几?(one number)");
cin >> n;
for (int i = 1; i <= n; i++)
{
for (int j = 1; j <= n; j++) {
if(i==j)
{
cout<<"1 ";
}
else
{
cout<<"0 ";
}
}
cout << endl;
}
}
else if(A==24)
{
cout<<"给我两个数,我输出加、减、乘、除、模";
int a, b;
cin>>a>>b;
cout << a + b << endl;
cout << a - b << endl;
cout << a * b << endl;
cout << a / b << endl;
cout << a % b << endl;
}
else if(A==25)
{
andchachengchu(1);
printf("你对了%d题",cnt2);
}
else if(A==26)
{
cout<<"Enter a number(two to nine)";
int a;
cin>>a;
a=a%11;
for(int i=1;i<=a;i++)
{
for(int j=1;j<=a-i;j++)
{
cout<<" ";
}
for(int j=1;j<=i;j++)
{
cout<<j;
}
for(int j=i-1;j>=1;j--)
{
cout<<j;
}
for(int j=1;j<=a-i;j++)
{
cout<<" ";
}
cout<<endl;
}
}
else if(A==27)
{
cout<<"ASCII里面是什么?(33~126)";
short a;
cin>>a;
cout<<"是"<<(char)(a)<<endl;
}
else if(A==28)
{
printf("输入一个字符串\n");
std::string text;
cin>>text;
reverse(text.begin(), text.end());
std::cout << text << std::endl;
}
else if(A==29)
{
srand(time(0));
play_game();
}
else if(A==30)
{
int magic;
int guess = 0;
int counter;
int k = 0;
int a = 1;
int b = 1000;
magic = rand() % 1000 + 1;
counter = 0;
printf("数字已生成,请输入1~1000内一个数字:");
while (guess != magic)
{
scanf("%d", &guess);
if(guess<=a||guess>=b)
{
std::cout<<"无效输入"<<std::endl;
continue;
}
counter++;
if (magic < guess)
{
printf("大了,请输入%d~%d内一个数字:", counter, a,guess);
b = guess;
}
else if(magic > guess)
{
printf("小了,请输入%d~%d内一个数字:", counter, guess,b);
a = guess;
}
else
{
counter++;
printf("爆炸了!!!您所用的次数为:%d", counter);
}
}
}
else if(A==31)
{
while (true)
{
intro2();
char ch = getch2();
if (ch >= '1' && ch <= '3')
{
mode2 = ch - '0'; // 设定模式
game2();
}
else if (ch == 27) // ESC的ascii是27
{
cout << " 退出游戏!" << endl;
break;
}
else cout << " 输入有误,请再次输入!" << endl;
}
}
else if(A==32)
{
yabagabaga();
}
else
{
cout<<"没有该答案!!!!!!!!!!!!!!!!!!!!!"<<endl;
}
}
}
int main()
{
playplayplayplay();
}