首页 > 其他分享 >超多行的游戏

超多行的游戏

时间:2024-11-16 15:48:42浏览次数:3  
标签:多行 游戏 int else w2 w1 printf cout

代码(运用到小猴编程编辑器的头文件:<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<<"请问地球

标签:多行,游戏,int,else,w2,w1,printf,cout
From: https://blog.csdn.net/seewo1325/article/details/143818580

相关文章

  • 自制C++游戏头文件:C++自己的游戏头文件!!!(后续会更新)
    引言在这个数字时代,计算机游戏已经成为人们生活中不可或缺的一部分。它们不仅为我们带来了无尽的乐趣,还激发了我们的创造力和解决问题的能力。今天,我们将深入探讨一个特别的头文件——CPPgame.h,它包含了多个结构体和函数,用于实现多种精彩的游戏体验。无论你是游戏开发者还是游......
  • ssm毕设主机游戏商城系统的设计与实现程序+论文+部署
    本系统(程序+源码)带文档lw万字以上 文末可获取一份本项目的java源码和数据库参考。系统程序文件列表开题报告内容一、主机游戏商城系统设计与实现的相关阐述(一)研究背景随着科技的不断发展,主机游戏产业蓬勃发展,吸引了众多游戏爱好者。主机游戏凭借其高质量的画面、独特的......
  • PinBall击球游戏
    packagecom.shrimpking.t9;importjavax.swing.*;importjava.awt.*;importjava.awt.event.ActionEvent;importjava.awt.event.ActionListener;importjava.awt.event.KeyEvent;importjava.awt.event.KeyListener;/***CreatedbyIntelliJIDEA.**@Auth......
  • (分享源码)计算机毕业设计必看必学 上万套实战教程手把手教学JAVA、PHP,node.js,C++、pyth
    摘要随着计算机科学技术日渐成熟,人们已经深刻认识到了计算机功能的强大,计算机已经进入到了人类社会发展的各个领域,并且发挥着十分重要的作用。通过管理系统在电脑上的应用,人们能更好的管理信息,储存数据。为了能够提供游戏商城的方便性,开发了基于vue的游戏网站。此游戏网站......
  • C++ 游戏开发入门教程:从基础到实践
    引言C++是一种广泛应用于游戏开发的编程语言,因其高性能和对硬件资源的精细控制能力,成为了许多大型游戏和引擎的首选语言。无论是开发2D还是3D游戏,C++都能够提供高效的计算和优异的性能,尤其在需要处理大量数据和实时计算的情况下,如渲染、物理计算和网络通信等。本文将介......
  • c语言——三子棋基础游戏
    首先,我们先有整体思路:它的棋盘到底是怎么样子的?它实现的过程是怎么一步一步来的棋盘到底是怎么样子的?大概是这么一个轮廓。实现过程中,我们该如何思考呢?1.我们想到,开始游戏的时候,我们肯定会一个菜单的吧?2.利用菜单选择是否开始游戏3.开始游戏后,我们就开始设计排版棋盘了:1......
  • Unity 6发布:付费下载机制下线,游戏运行效果显著提升
    Unity6发布:付费下载机制下线,游戏运行效果显著提升点击蓝链领取游戏开发教程在十月中旬,Unity公司在多个平台上隆重发布了其游戏开发引擎的全新力作——Unity6版本,此版本恰好紧随Unity官方宣布废除“付费下载”制度之后问世,标志着一次重要的版本迭代。点击蓝链领取游戏......
  • 怎么用云游戏玩Steam?ToDesk云电脑新手入门教程
    对于新手玩家来说,想要上手Steam游戏,这门槛真有点高。不说要从众多真假难辨的软件中找出正版,遇到Steam内想玩的游戏还得等着下载安装解压,费时又费力。玩家想解决这个困难也很简单,只需下个ToDesk云游戏即可。它是ToDesk云电脑中专门玩游戏的版块,预安装了上百款热门游戏,免费使用加......
  • 网络游戏安全现状及相关应对方案
    中国网络游戏历经十余年的飞速发展,取得了显著成就,但与此同时,也陷入了诸多安全问题的泥沼。一、中国网络游戏发展中的安全困境(一)灰色产业链滋生外挂、私服、盗号、打金工作室以及网络信息诈骗等灰色产业链在游戏行业中肆意生长。这些问题严重影响了游戏的正常运营与发展,成为行业......
  • 【鸣潮,原神PC端启动器】仿二次元手游PC端游戏启动器,以鸣潮为例。
    二游GAMELanucher启动器1.前言许多二次元手游(原神,鸣潮,少女前线)的PC端启动器都是使用Qt做的,正好最近正在玩鸣潮,心血来潮,便仿鸣潮启动器,从头写一个。先下载一个官方版的PC启动器,找到图标,背景图等素材,然后对着界面写代码就行。效果如下2.划分模块游戏启动器大致可以......