GWHBOB 发表于 2013-1-29 14:03:05

人人上看到一个三国杀的cpp,有兴趣的人去移植一下

未验证其是否能工作#include <iostream>
#include <sstream>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <string>
#include <vector>
#include <set>
#include <cctype>
#include <algorithm>
#include <cmath>
#include <deque>
#include <queue>
#include <map>
#include <queue>
#include <list>
#include <iomanip>
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,pai paidui)
{
int i,m,x,y,z,a={0};
srand((unsigned)time(NULL));
for(i=1;i<=104;i++)
{
while(a);
a=i;
}
for(i=0;i<=103;i++)
{
x=(a-1)/52;
y=((a-1)-52*x)/13;
z=(a-1)%13;
paidui=A;
}
}
void Xipai(pai paidui,int*paiduishu,pai qipaidui,int*qipaishu)
{
int i,m,a={0};
srand((unsigned)time(NULL));
for(i=1;i<=(*qipaishu);i++)
{
while(a);
a=i;
}
for(i=0;i<=((*qipaishu)-1);i++)
{
paidui=qipaidui];
qipaidui].leixing=-1;
(*paiduishu)++;
(*qipaishu)--;
}
for(i=(*paiduishu);i<=103;i++)paidui.leixing=-1;
}
pai Mo1pai(pai A,int *x,pai B,int*y,int *b)
{
pai p;
if((*x)==0)Xipai(A,x,B,y);
else if((*x)<0)printf("摸牌参数错误!");
else;
p=A;
(*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;
int shoupaishu;
pai zhuangbei;
int zhuangbeishu;
pai pandingpai;
int pandingshu;
int juli;
void Kanshoupai()
{
printf("玩家当前手牌:\n");
if(shoupaishu)
{
int m;
for(m=0;m<=(shoupaishu-1);m++)
{
printf("%d ",m);
(shoupai).Kanpai();
}
}
else printf("空城!\n");
printf("\n");
}
void Kanzhuangbei()
{
if(juese)printf("玩家");
else printf("电脑");
printf("当前装备:\n");
printf("0 武器: ");
if((zhuangbei).leixing==-1)printf("空\n");
else (zhuangbei).Kanpai();
printf("1 防具: ");
if((zhuangbei).leixing==-1)printf("空\n");
else (zhuangbei).Kanpai();
printf("2 进攻马: ");
if((zhuangbei).leixing==-1)printf("空\n");
else (zhuangbei).Kanpai();
printf("3 防御马: ");
if((zhuangbei).leixing==-1)printf("空\n");
else (zhuangbei).Kanpai();
printf("\n");
}
void Kanpandingpai()
{
if(juese)printf("玩家");
else printf("电脑");
printf("当前判定区:\n");
if((pandingpai).leixing==-1)printf("空\n");
else
{
printf("0 ");
(pandingpai).Kanpai();
if((pandingpai).leixing==-1);
else
{
printf("1 ");
(pandingpai).Kanpai();
if((pandingpai).leixing==-1);
else
{
printf("2 ");
(pandingpai).Kanpai();
}
}
}
}
};
void Mopai(int*shoupaishu,pai shoupai,pai A,int *x,pai B,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).Kanpai();
}
}
printf("牌堆还剩%d张牌!\n\n",*x);
}
void Qishishoupai(wujiang *w,pai A,int *x,pai B,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).Kanpai();
}
}
printf("牌堆还剩%d张牌!\n\n",*x);
}
void Panding(pai paidui,int*paiduishu,pai qipaidui,int*qipaishu)
{
paidui[*paiduishu].Kanpai();
qipaidui[*qipaishu]=paidui[*paiduishu];
(*paiduishu)--;
(*qipaishu)++;
}
pai Zhangba(wujiang*w,pai qipaidui,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.huase)%2)+(((*w).shoupai.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;
(*w).shoupai.leixing=-1;
((*w).shoupaishu)--;
(*qipaishu)++;
qipaidui[*qipaishu]=(*w).shoupai;
(*w).shoupai.leixing=-1;
((*w).shoupaishu)--;
(*qipaishu)++; printf("弃牌数:%d",*qipaishu);
for(i=0;i<=(((*w).shoupaishu)+1);i++)
{
if((*w).shoupai.leixing==-1)
{
for(j=i+1;j<=(((*w).shoupaishu)+2);j++)
(*w).shoupai=(*w).shoupai;
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.leixing==305)))
{
return x;
break;
}
printf("你打出了一张空气!\n");
}
}
else return t;
}
pai Panpai(wujiang*w1,int*sha,int y,pai qipaidui,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.leixing)
{
case 101:
if(((*sha)>0)||((*w1).zhuangbei.leixing==301))
{
if(((*w1).zhuangbei.leixing==301))printf("武器【诸葛连弩】效果被触发!\n");
return (*w1).shoupai;
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;
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;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.changdu>=(*w1).juli)
{
(*sha)--;
return((*w2).juese);
}
else
{
printf("武器长度不够!\n");
return -2;
}
}
else
{
printf("目标错误!\n");
return -2;
}
}
else
{
if((*w1).zhuangbei.changdu>=(*w1).juli)
{
(*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<=1))return((*w2).juese);
else
{
printf("目标没有牌!\n");
return -2;
}
}
else
{
printf("目标错误!\n");
return -2;
}
}
else
{
if((*w1).juli<=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).leixing<=300||((*w2).zhuangbei).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.changdu)<(*w2).juli)
{
printf("武器距离不够!\n");
return -2;
}
else
return((*w2).juese);
}
}
}
}
else
{
if(((*w2).zhuangbei).leixing<=300||((*w2).zhuangbei).leixing>=331)return -2;
else
{
if(((*w2).zhuangbei.changdu)<(*w2).juli)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.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.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.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,int *qipaishu,int x)
{
int i;
if((x<0||x>=((*w1).shoupaishu))&&x!=100)
printf("你的牌呢?!\n");
else
{
switch(((*w1).shoupai).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);
for(i=x+1;i<=((*w1).shoupaishu);i++)((*w1).shoupai)=((*w1).shoupai);
((*w1).shoupaishu)--;
(*qipaishu)++;
break;
case 251:
for(i=1;i>=0;i--)(*w2).pandingpai=(*w2).pandingpai;
(*w2).pandingpai=(*w1).shoupai;
for(i=x+1;i<=((*w1).shoupaishu);i++)((*w1).shoupai)=((*w1).shoupai);
((*w1).shoupaishu)--;
((*w2).pandingshu)++;
break;
case 252:
for(i=1;i>=0;i--)(*w1).pandingpai=(*w1).pandingpai;
(*w1).pandingpai=(*w1).shoupai;
for(i=x+1;i<=((*w1).shoupaishu);i++)((*w1).shoupai)=((*w1).shoupai);
((*w1).shoupaishu)--;
((*w1).pandingshu)++;
break;
case 301:
case 302:
case 303:
case 304:
case 305:
case 306:
case 307:
case 308:
if((*w1).zhuangbei.leixing==-1)((*w1).zhuangbeishu)++;
else
{
qipaidui[*qipaishu]=((*w1).zhuangbei);
(*qipaishu)++;
}
(*w1).zhuangbei=(*w1).shoupai;
for(i=x+1;i<=((*w1).shoupaishu);i++)((*w1).shoupai)=((*w1).shoupai);
((*w1).shoupaishu)--;
break;
case 331:
if((*w1).zhuangbei.leixing==-1)((*w1).zhuangbeishu)++;
else
{
qipaidui[*qipaishu]=((*w1).zhuangbei);
(*qipaishu)++;
}
(*w1).zhuangbei=(*w1).shoupai;
for(i=x+1;i<=((*w1).shoupaishu);i++)((*w1).shoupai)=((*w1).shoupai);
((*w1).shoupaishu)--;
break;
case 361:
case 362:
case 363:
if((*w1).zhuangbei.leixing==-1)((*w1).zhuangbeishu)++;
else
{
qipaidui[*qipaishu]=((*w1).zhuangbei);
(*qipaishu)++;
}
(*w1).zhuangbei=(*w1).shoupai;
for(i=x+1;i<=((*w1).shoupaishu);i++)((*w1).shoupai)=((*w1).shoupai);
((*w1).shoupaishu)--;
break;
case 381:
case 382:
case 383:
if((*w1).zhuangbei.leixing==-1)((*w1).zhuangbeishu)++;
else
{
qipaidui[*qipaishu]=((*w1).zhuangbei);
(*qipaishu)++;
}
(*w1).zhuangbei=(*w1).shoupai;
for(i=x+1;i<=((*w1).shoupaishu);i++)((*w1).shoupai)=((*w1).shoupai);
((*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,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.leixing==210)
{
printf("电脑使用");
((*w2).shoupai).Kanpai();
printf("对象是");
(*p).Kanpai();
(*p)=((*w2).shoupai);
qipaidui[*qipaishu]=((*w2).shoupai);
for(int i=x+1;i<=((*w2).shoupaishu);i++)((*w2).shoupai)=((*w2).shoupai);
((*w2).shoupaishu)--;
(*qipaishu)++;
a++;
break;
}
}
break;
}
else if((*w1).shoupai.leixing==210)
{
printf("玩家使用");
((*w1).shoupai).Kanpai();
printf("对象是");
(*p).Kanpai();
(*p)=((*w1).shoupai);
qipaidui[*qipaishu]=((*w1).shoupai);
for(int i=x+1;i<=((*w1).shoupaishu);i++)((*w1).shoupai)=((*w1).shoupai);
((*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.leixing==210)
{
printf("玩家使用");
((*w2).shoupai).Kanpai();
printf("对象是");
(*p).Kanpai();
(*p)=((*w2).shoupai);
qipaidui[*qipaishu]=((*w2).shoupai);
for(int i=x+1;i<=((*w2).shoupaishu);i++)((*w2).shoupai)=((*w2).shoupai);
((*w2).shoupaishu)--;
(*qipaishu)++;
(*w2).Kanshoupai();
a++;
break;
}
else printf("你确定你使用的是【无懈可击】?\n");
}
}
return a;
}
int Qiutao(wujiang*w,pai qipaidui,int*qipaishu)
{
int x;
if((*w).juese)
{
for(;;)
{
printf("如果要使用【桃】请输入手牌之前的编号,不需要请输入“-1”,以回车结束!\n");
scanf("%d",&x);
if(x==-1)
{
return -1;
break;
}
else if((*w).shoupai.leixing==103)
{
qipaidui[*qipaishu]=((*w).shoupai);
for(int i=x+1;i<=((*w).shoupaishu);i++)((*w).shoupai)=((*w).shoupai);
((*w).shoupaishu)--;
(*qipaishu)++;
return 0;
break;
}
else printf("你确定你使用的是【桃】?\n");
}
}
else
{
for(x=0;x<((*w).shoupaishu);x++)
{
if((*w).shoupai.leixing==103)
{
qipaidui[*qipaishu]=((*w).shoupai);
for(int i=x+1;i<=((*w).shoupaishu);i++)((*w).shoupai)=((*w).shoupai);
((*w).shoupaishu)--;
(*qipaishu)++;
return 0;
break;
}
}
return -1;
}
}
int Binsi(wujiang*w1,wujiang*w2,pai qipaidui,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,int*paiduishu,pai qipaidui,int*qipaishu)
{
int x;
if((*w2).juese)
{
if(((*w2).zhuangbei.leixing==331)&&((*w1).zhuangbei.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.leixing==331)&&((*w1).zhuangbei.leixing==303))printf("【青釭剑】锁定技被触发!\n");
for(;;)
{
printf("请输入手牌之前的编号,或者输入“-1”放弃打出【闪】,以回车结束!\n");
scanf("%d",&x);
if(x==-1)
{
return -1;
break;
}
else if((*w2).shoupai.leixing==102)
{
printf("玩家打出");
((*w2).shoupai).Kanpai();
qipaidui[*qipaishu]=((*w2).shoupai);
for(int i=x+1;i<=((*w2).shoupaishu);i++)((*w2).shoupai)=((*w2).shoupai);
((*w2).shoupaishu)--;
(*qipaishu)++;
return 0;
break;
}
else printf("你确定你打出的是【闪】?\n");
}
}
else
{
if(((*w2).zhuangbei.leixing==331)&&((*w1).zhuangbei.leixing!=303))
{
Panding(paidui,paiduishu,qipaidui,qipaishu);
if(qipaidui[(*qipaishu)-1].huase%2)
{
printf("【八卦阵】判定成功!\n");
return 0;
}
else printf("【八卦阵】判定失败!\n");
}
else if(((*w2).zhuangbei.leixing==331)&&((*w1).zhuangbei.leixing==303))printf("【青釭剑】锁定技被触发!\n");
int i;
for(x=0;x<((*w2).shoupaishu);x++)
{
if((*w2).shoupai.leixing==102)
{
printf("电脑打出");
((*w2).shoupai).Kanpai();
qipaidui[*qipaishu]=((*w2).shoupai);
for(i=x+1;i<=((*w2).shoupaishu);i++)((*w2).shoupai)=((*w2).shoupai);
((*w2).shoupaishu)--;
(*qipaishu)++;
return 0;
break;
}
}
return -1;
}
}
int Sha(wujiang *w1,wujiang*w2,pai paidui,int*paiduishu,pai qipaidui,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.leixing==306))
{
int i;
if(((*w1).shoupaishu)>=2)
{
printf("电脑弃掉:\n");
((*w1).shoupai).Kanpai();
qipaidui[*qipaishu]=((*w1).shoupai);
for(i=1;i<=((*w1).shoupaishu);i++)((*w1).shoupai)=((*w1).shoupai);
((*w1).shoupaishu)--;
(*qipaishu)++;
((*w1).shoupai).Kanpai();
qipaidui[*qipaishu]=((*w1).shoupai);
for(i=1;i<=((*w1).shoupaishu);i++)((*w1).shoupai)=((*w1).shoupai);
((*w1).shoupaishu)--;
(*qipaishu)++;
printf("发动【贯石斧】武器效果使【杀】造成伤害!\n");
((*w2).tili)--;
i=Binsi(w1,w2,qipaidui,qipaishu);
return i;
}
else return 0;
}
else if(x==0&&((*w1).zhuangbei.leixing==304))
{
int i;
for(x=0;x<((*w1).shoupaishu);x++)
{
if((*w1).shoupai.leixing==101)
{
printf("电脑发动【青龙偃月刀】效果对玩家使用");
((*w1).shoupai).Kanpai();
qipaidui[*qipaishu]=((*w1).shoupai);
for(i=x+1;i<=((*w1).shoupaishu);i++)((*w1).shoupai)=((*w1).shoupai);
((*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.leixing==308)
{
for(;;)
{
printf("是否发动【麒麟弓】武器效果?\n0 否\n1 是\n");
scanf("%d",&x);
if(x==1)
{
if(((*w2).zhuangbei.leixing==-1)&&((*w2).zhuangbei.leixing==-1))
{
printf("电脑根本没有马,射你妹的马啊!\n");
break;
}
else
{
for(;;)
{
printf("0 ");
((*w2).zhuangbei).Kanpai();
printf("1 ");
((*w2).zhuangbei).Kanpai();
printf("请选择要弃掉的马,输入之前的编号,以回车结束!\n");
scanf("%d",&x);
if((x==0)&&((*w2).zhuangbei.leixing!=-1))
{
printf("你弃掉了电脑的");
((*w2).zhuangbei).Kanpai();
qipaidui[*qipaishu]=((*w2).zhuangbei);
((*w2).zhuangbeishu)--;
(*qipaishu)++;
((*w2).zhuangbei).leixing=-1;
((*w2).juli)++;
break;
}
else if((x==1)&&((*w2).zhuangbei.leixing!=-1))
{
printf("你弃掉了电脑的");
((*w2).zhuangbei).Kanpai();
qipaidui[*qipaishu]=((*w2).zhuangbei);
((*w2).zhuangbeishu)--;
(*qipaishu)++;
((*w2).zhuangbei).leixing=-1;
((*w1).juli)--;
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.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).Kanpai();
qipaidui[*qipaishu]=((*w1).shoupai);
for(i=x+1;i<=((*w1).shoupaishu);i++)((*w1).shoupai)=((*w1).shoupai);
((*w1).shoupaishu)--;
(*qipaishu)++;
}
else
{
for(;;)
{
(*w1).Kanzhuangbei();
printf("请输入装备之前的编号,以回车键结束!\n");
scanf("%d",&x);
if((((*w1).zhuangbei).leixing!=-1)&&(x>=0)&&(x<=3))
{
printf("你弃掉了");
((*w1).zhuangbei).Kanpai();
qipaidui[*qipaishu]=((*w1).zhuangbei);
((*w1).zhuangbeishu)--;
(*qipaishu)++;
((*w1).zhuangbei).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.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.leixing==101)
{
int i;
printf("玩家对电脑使用");
((*w1).shoupai).Kanpai();
qipaidui[*qipaishu]=((*w1).shoupai);
for(i=x+1;i<=((*w1).shoupaishu);i++)((*w1).shoupai)=((*w1).shoupai);
((*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,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).Kanpai();
qipaidui[*qipaishu]=((*w2).shoupai);
for(i=y+1;i<=((*w2).shoupaishu);i++)((*w2).shoupai)=((*w2).shoupai);
((*w2).shoupaishu)--;
(*qipaishu)++;
break;
case 1:
for(;;)
{
(*w2).Kanzhuangbei();
printf("请输入装备之前的编号,以回车键结束!\n");
scanf("%d",&y);
if((((*w2).zhuangbei).leixing!=-1)&&(y>=0)&&(y<=3))
{
printf("你弃掉了电脑的");
((*w2).zhuangbei).Kanpai();
qipaidui[*qipaishu]=((*w2).zhuangbei);
((*w2).zhuangbeishu)--;
(*qipaishu)++;
((*w2).zhuangbei).leixing=-1;
if(!y)((*w2).zhuangbei).changdu=1;
else if(y==2)((*w2).juli)++;
else if(y==3)((*w1).juli)--;
break;
}
else printf("你弃掉了一张空气!\n");
}
break;
case 2:
for(;;)
{
(*w2).Kanpandingpai();
printf("请输入判定牌之前的编号,以回车键结束!\n");
scanf("%d",&y);
if((*w2).pandingpai.leixing!=-1)
{
printf("你弃掉了电脑的");
((*w2).pandingpai).Kanpai();
qipaidui[*qipaishu]=((*w2).pandingpai);
((*w2).pandingshu)--;
(*qipaishu)++;
((*w2).pandingpai).leixing=-1;
break;
}
else printf("你弃掉了一张空气!\n");
}
break;
default:break;
}
}
else
{
if((*w2).zhuangbeishu)
{
if((*w2).zhuangbei.leixing!=-1)
{
printf("电脑弃掉了玩家的");
((*w2).zhuangbei).Kanpai();
qipaidui[*qipaishu]=((*w2).zhuangbei);
((*w2).zhuangbeishu)--;
(*qipaishu)++;
((*w2).zhuangbei).leixing=-1;
}
else if((*w2).zhuangbei.leixing!=-1)
{
printf("电脑弃掉了玩家的");
((*w2).zhuangbei).Kanpai();
qipaidui[*qipaishu]=((*w2).zhuangbei);
((*w2).zhuangbeishu)--;
(*qipaishu)++;
((*w2).zhuangbei).leixing=-1;
((*w1).juli)--;
}
else if((*w2).zhuangbei.leixing!=-1)
{
printf("电脑弃掉了玩家的");
((*w2).zhuangbei).Kanpai();
qipaidui[*qipaishu]=((*w2).zhuangbei);
((*w2).zhuangbeishu)--;
(*qipaishu)++;
((*w2).zhuangbei).leixing=-1;
((*w2).zhuangbei).changdu=1;
}
else
{
printf("电脑弃掉了玩家的");
((*w2).zhuangbei).Kanpai();
qipaidui[*qipaishu]=((*w2).zhuangbei);
((*w2).zhuangbeishu)--;
(*qipaishu)++;
((*w2).zhuangbei).leixing=-1;
((*w2).juli)++;
}
}
else
{
srand((unsigned)time(NULL));
y=rand()%((*w2).shoupaishu);
printf("电脑弃掉了玩家的手牌");
((*w2).shoupai).Kanpai();
qipaidui[*qipaishu]=((*w2).shoupai);
for(i=y+1;i<=((*w2).shoupaishu);i++)((*w2).shoupai)=((*w2).shoupai);
((*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).Kanpai();
(*w1).shoupai[(*w1).shoupaishu]=((*w2).shoupai);
for(i=y+1;i<=((*w2).shoupaishu);i++)((*w2).shoupai)=((*w2).shoupai);
((*w2).shoupaishu)--;
((*w1).shoupaishu)++;
break;
case 1:
for(;;)
{
(*w2).Kanzhuangbei();
printf("请输入装备之前的编号,以回车键结束!\n");
scanf("%d",&y);
if((((*w2).zhuangbei).leixing!=-1)&&(y>=0)&&(y<=3))
{
printf("你牵走了电脑的");
((*w2).zhuangbei).Kanpai();
(*w1).shoupai[(*w1).shoupaishu]=((*w2).zhuangbei);
((*w2).zhuangbeishu)--;
((*w1).shoupaishu)++;
((*w2).zhuangbei).leixing=-1;
if(!y)((*w2).zhuangbei).changdu=1;
else if(y==2)((*w2).juli)++;
else if(y==3)((*w1).juli)--;
break;
}
else printf("你弃掉了一张空气!\n");
}
break;
case 2:
for(;;)
{
(*w2).Kanpandingpai();
printf("请输入判定牌之前的编号,以回车键结束!\n");
scanf("%d",&y);
if((*w2).pandingpai.leixing!=-1)
{
printf("你牵走了电脑的");
((*w2).pandingpai).Kanpai();
(*w1).shoupai[(*w1).shoupaishu]=((*w2).pandingpai);
((*w2).pandingshu)--;
((*w1).shoupaishu)++;
((*w2).pandingpai).leixing=-1;
break;
}
else printf("你牵走了一张空气!\n");
}
break;
default:break;
}
}
else
{
if((*w2).zhuangbeishu)
{
if((*w2).zhuangbei.leixing!=-1)
{
printf("电脑牵走了玩家的");
((*w2).zhuangbei).Kanpai();
(*w1).shoupai[(*w1).shoupaishu]=((*w2).zhuangbei);
((*w2).zhuangbeishu)--;
((*w1).shoupaishu)++;
((*w2).zhuangbei).leixing=-1;
}
else if((*w2).zhuangbei.leixing!=-1)
{
printf("电脑牵走了玩家的");
((*w2).zhuangbei).Kanpai();
(*w1).shoupai[(*w1).shoupaishu]=((*w2).zhuangbei);
((*w2).zhuangbeishu)--;
((*w1).shoupaishu)++;
((*w2).zhuangbei).leixing=-1;
((*w1).juli)--;
}
else if((*w2).zhuangbei.leixing!=-1)
{
printf("电脑牵走了玩家的");
((*w2).zhuangbei).Kanpai();
(*w1).shoupai[(*w1).shoupaishu]=((*w2).zhuangbei);
((*w2).zhuangbeishu)--;
((*w1).shoupaishu)++;
((*w2).zhuangbei).leixing=-1;
((*w2).zhuangbei).changdu=1;
}
else
{
printf("电脑牵走了玩家的");
((*w2).zhuangbei).Kanpai();
(*w1).shoupai[(*w1).shoupaishu]=((*w2).zhuangbei);
((*w2).zhuangbeishu)--;
((*w1).shoupaishu)++;
((*w2).zhuangbei).leixing=-1;
((*w2).juli)--;
}
}
else
{
srand((unsigned)time(NULL));
y=rand()%((*w2).shoupaishu);
printf("电脑牵走了玩家的手牌");
((*w2).shoupai).Kanpai();
(*w1).shoupai[(*w1).shoupaishu]=((*w2).shoupai);
for(i=y+1;i<=((*w2).shoupaishu);i++)((*w2).shoupai)=((*w2).shoupai);
((*w2).shoupaishu)--;
((*w1).shoupaishu)++;
}
}
}
void Wuzhong(wujiang*w1,pai A,int *x,pai B,int*y)
{
Mopai(&((*w1).shoupaishu),(*w1).shoupai,A,x,B,y,(*w1).juese);
}
int Juedou(wujiang*w1,wujiang*w2,pai qipaidui,int*qipaishu)
{
int i,j,x;
if((*w1).juese)
{
for(;;)
{
j=0;
for(x=0;x<((*w2).shoupaishu);x++)
{
if((*w2).shoupai.leixing==101)
{
printf("电脑打出");
((*w2).shoupai).Kanpai();
qipaidui[*qipaishu]=((*w2).shoupai);
for(int i=x+1;i<=((*w2).shoupaishu);i++)((*w2).shoupai)=((*w2).shoupai);
((*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.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.leixing==305)&&x==100)
{
pai p=Zhangba(w1,qipaidui,qipaishu);
p.paifu=-1;
printf("打出!\n");
j=1;
break;
}
else if((*w1).shoupai.leixing==101)
{
printf("玩家打出");
((*w1).shoupai).Kanpai();
qipaidui[*qipaishu]=((*w1).shoupai);
for(i=x+1;i<=((*w1).shoupaishu);i++)((*w1).shoupai)=((*w1).shoupai);
((*w1).shoupaishu)--;
(*qipaishu)++;
j=1;
break;
}
else printf("你确定你打出的是【杀】?\n");
}
}
}
else
{
for(;;)
{
j=0;
for(;;)
{
printf("请打出一张【杀】响应【决斗】,否则你将受到1点伤害!\n请输入手牌之前的编号,或者输入“-1”放弃出【杀】,以回车结束!\n");
if(((*w1).zhuangbei.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.leixing==305)&&x==100)
{
pai p=Zhangba(w2,qipaidui,qipaishu);
p.paifu=-1;
printf("打出!\n");
j=1;
break;
}
else if((*w2).shoupai.leixing==101)
{
printf("玩家打出");
((*w2).shoupai).Kanpai();
qipaidui[*qipaishu]=((*w2).shoupai);
for(i=x+1;i<=((*w2).shoupaishu);i++)((*w2).shoupai)=((*w2).shoupai);
((*w2).shoupaishu)--;
(*qipaishu)++;
j=1;
break;
}
else printf("你确定你打出的是【杀】?\n");
}
j=0;
for(x=0;x<((*w1).shoupaishu);x++)
{
if((*w1).shoupai.leixing==101)
{
printf("电脑打出");
((*w1).shoupai).Kanpai();
qipaidui[*qipaishu]=((*w1).shoupai);
for(int i=x+1;i<=((*w1).shoupaishu);i++)((*w1).shoupai)=((*w1).shoupai);
((*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,int*paiduishu,pai qipaidui,int*qipaishu)
{
int i,j=0,x;
if((*w1).juese)
{
for(x=0;x<((*w2).shoupaishu);x++)
{
if((*w2).shoupai.leixing==101)
{
printf("电脑对玩家使用");
((*w2).shoupai).Kanpai();
qipaidui[*qipaishu]=((*w2).shoupai);
for(int i=x+1;i<=((*w2).shoupaishu);i++)((*w2).shoupai)=((*w2).shoupai);
((*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.Kanpai();
(*w1).shoupai[(*w1).shoupaishu]=((*w2).zhuangbei);
((*w2).zhuangbeishu)--;
((*w1).shoupaishu)++;
((*w2).zhuangbei).leixing=-1;
((*w2).zhuangbei).changdu=1;
(*w1).Kanshoupai();
return 0;
}
}
else
{
for(;;)
{
printf("请对电脑使用一张【杀】,否则电脑将获得你的武器!\n请输入手牌之前的编号,或者输入“-1”放弃出【杀】,以回车结束!\n");
if(((*w2).zhuangbei.leixing==305))printf("如果想发动【丈八蛇矛】效果,请输入“100”,以回车结束!\n");
(*w2).Kanshoupai();
scanf("%d",&x);
if(x==-1)break;
else if(((*w2).zhuangbei.leixing==305)&&x==100)
{
pai p=Zhangba(w2,qipaidui,qipaishu);
p.paifu=-1;
printf("使用!\n");
j=1;
break;
}
else if((*w2).shoupai.leixing==101)
{
printf("玩家对电脑使用");
((*w2).shoupai).Kanpai();
qipaidui[*qipaishu]=((*w2).shoupai);
for(i=x+1;i<=((*w2).shoupaishu);i++)((*w2).shoupai)=((*w2).shoupai);
((*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).Kanpai();
(*w1).shoupai[(*w1).shoupaishu]=((*w2).zhuangbei);
((*w2).zhuangbeishu)--;
((*w1).shoupaishu)++;
((*w2).zhuangbei).leixing=-1;
((*w2).zhuangbei).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,int* paiduishu,int renshu,pai wugu)
{
int i;
printf("五谷丰登开牌:\n");
for(i=1;i<=renshu;i++)
{
wugu=paidui;
(*paiduishu)--;
printf("%d ",i-1);
wugu.Kanpai();
}
}
void Qupai(pai wugu,wujiang*w)
{
int i,x;
printf("五谷丰登开牌:\n");
for(i=0;(wugu.leixing)!=-1;i++)
{
printf("%d ",i);
wugu.Kanpai();
}
if((*w).juese)
{
for(;;)
{
printf("请选择你想要的卡牌,输入卡牌之前的编号,以回车结束!\n");
scanf("%d",&x);
if(wugu.leixing!=-1)
{
printf("玩家选择");
wugu.Kanpai();
(*w).shoupai[(*w).shoupaishu]=wugu;
((*w).shoupaishu)++;
for(i=x+1;i<=9;i++)wugu=wugu;
wugu.leixing=-1;
break;
}
printf("你选择了一张空气加入手牌!");
}
}
else
{
printf("电脑选择");
wugu.Kanpai();
(*w).shoupai[(*w).shoupaishu]=wugu;
((*w).shoupaishu)++;
for(i=1;i<=9;i++)wugu=wugu;
wugu.leixing=-1;
}
}
void Rengpai(pai wugu,pai qipaidui,int*qipaishu)
{
int i;
for(i=0;wugu.leixing!=-1;i++)
{
qipaidui[*qipaishu]=wugu;
(*qipaishu)++;
wugu.leixing=-1;
}
}
int Nanman(wujiang*w1,wujiang*w2,pai qipaidui,int*qipaishu)
{
int i,x;
if((*w1).juese)
{
for(x=0;x<((*w2).shoupaishu);x++)
{
if((*w2).shoupai.leixing==101)
{
printf("电脑打出");
((*w2).shoupai).Kanpai();
qipaidui[*qipaishu]=((*w2).shoupai);
for(int i=x+1;i<=((*w2).shoupaishu);i++)((*w2).shoupai)=((*w2).shoupai);
((*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.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.leixing==305)&&x==100)
{
pai p=Zhangba(w2,qipaidui,qipaishu);
p.paifu=-1;
printf("使用!\n");
return 0;
break;
}
else if((*w2).shoupai.leixing==101)
{
printf("玩家打出");
((*w2).shoupai).Kanpai();
qipaidui[*qipaishu]=((*w2).shoupai);
for(i=x+1;i<=((*w2).shoupaishu);i++)((*w2).shoupai)=((*w2).shoupai);
((*w2).shoupaishu)--;
(*qipaishu)++;
return 0;
break;
}
else printf("你确定你打出的是【杀】?\n");
}
}
}
int Wanjian(wujiang*w1,wujiang*w2,pai paidui,int*paiduishu,pai qipaidui,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,pai qipaidui,int *paiduishu,int*qipaishu,wujiang*w1,wujiang*w2,pai yuanshipaidui)
{
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.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;
for(i=1;i<=10;i++)wugu.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)--;break;
case 381:
case 382:
case 383:
((*w2).juli)++;break;
default:break;
}
printf("\n");
}
}
}
return 0;
}
void Qipai(pai shoupai,int *shoupaishu,pai qipaidui,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;
for(i=x+1;i<=(*shoupaishu);i++)shoupai=shoupai;
(*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).Kanpai();
}
} printf("弃牌堆:%d\n",*qipaishu);
}
}
}
int Huihe(pai A,pai B,int *x,int *y,pai yuanshipaidui,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.leixing)
{
case 251:printf("【乐不思蜀】开始判定……\n"); break;
case 252:printf("【闪电】开始判定……\n");break;
default:printf("【??】开始判定……\n");break;
}
j=0;
pai p=((*w1).pandingpai);
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.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;
((*w1).pandingshu)--;
(*w1).pandingpai=(*w1).pandingpai;
(*w1).pandingpai=(*w1).pandingpai;
(*w1).pandingpai.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;
((*w1).pandingshu)--;
(*w1).pandingpai=(*w1).pandingpai;
(*w1).pandingpai=(*w1).pandingpai;
(*w1).pandingpai.leixing=-1;
(*y)++;
if(i==-1)return -1;
}
else
{
printf("【闪电】判定失败!\n");
(*w2).pandingpai=(*w2).pandingpai;
(*w2).pandingpai=(*w2).pandingpai;
(*w2).pandingpai=(*w1).pandingpai;
(*w1).pandingpai=(*w1).pandingpai;
(*w1).pandingpai=(*w1).pandingpai;
(*w1).pandingpai.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;
}
int main()
{
void Kanshoupai(pai p);
pai yuanshipaidui,qipaidui,paidui;
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=com.zhuangbei=com.zhuangbei=com.zhuangbei=wanjia.zhuangbei=wanjia.zhuangbei=wanjia.zhuangbei=wanjia.zhuangbei=p;
com.zhuangbei.changdu=wanjia.zhuangbei.changdu=1;
com.pandingpai=com.pandingpai=com.pandingpai=wanjia.pandingpai=wanjia.pandingpai=wanjia.pandingpai=p;
com.juli=wanjia.juli=1;
int a,b,c;
for(a=0;a<=1;a++)
{
for(b=0;b<=3;b++)
{
for(c=0;c<=12;c++)
{
yuanshipaidui.paifu=a;
yuanshipaidui.huase=b;
yuanshipaidui.dianshu=c;
}
}
}
yuanshipaidui.leixing=204;
yuanshipaidui.leixing=331;
yuanshipaidui.leixing=201;
yuanshipaidui.leixing=201;
yuanshipaidui.leixing=304;yuanshipaidui.changdu=3;
yuanshipaidui.leixing=251;
yuanshipaidui.leixing=101;
yuanshipaidui.leixing=101;
yuanshipaidui.leixing=101;
yuanshipaidui.leixing=101;
yuanshipaidui.leixing=202;
yuanshipaidui.leixing=201;
yuanshipaidui.leixing=208;
yuanshipaidui.leixing=209;
yuanshipaidui.leixing=102;
yuanshipaidui.leixing=103;
yuanshipaidui.leixing=103;
yuanshipaidui.leixing=308;yuanshipaidui.changdu=5;
yuanshipaidui.leixing=103;
yuanshipaidui.leixing=103;
yuanshipaidui.leixing=103;
yuanshipaidui.leixing=103;
yuanshipaidui.leixing=101;
yuanshipaidui.leixing=101;
yuanshipaidui.leixing=103;
yuanshipaidui.leixing=102;
yuanshipaidui.leixing=204;
yuanshipaidui.leixing=101;
yuanshipaidui.leixing=101;
yuanshipaidui.leixing=101;
yuanshipaidui.leixing=101;
yuanshipaidui.leixing=101;
yuanshipaidui.leixing=101;
yuanshipaidui.leixing=101;
yuanshipaidui.leixing=101;
yuanshipaidui.leixing=101;
yuanshipaidui.leixing=101;
yuanshipaidui.leixing=205;
yuanshipaidui.leixing=205;
yuanshipaidui.leixing=204;
yuanshipaidui.leixing=102;
yuanshipaidui.leixing=102;
yuanshipaidui.leixing=102;
yuanshipaidui.leixing=102;
yuanshipaidui.leixing=101;
yuanshipaidui.leixing=101;
yuanshipaidui.leixing=101;
yuanshipaidui.leixing=101;
yuanshipaidui.leixing=101;
yuanshipaidui.leixing=102;
yuanshipaidui.leixing=103;
yuanshipaidui.leixing=101;
yuanshipaidui.leixing=252;
yuanshipaidui.leixing=302;yuanshipaidui.changdu=2;
yuanshipaidui.leixing=202;
yuanshipaidui.leixing=202;
yuanshipaidui.leixing=383;
yuanshipaidui.leixing=303;yuanshipaidui.changdu=2;
yuanshipaidui.leixing=208;
yuanshipaidui.leixing=101;
yuanshipaidui.leixing=101;
yuanshipaidui.leixing=101;
yuanshipaidui.leixing=210;
yuanshipaidui.leixing=305;yuanshipaidui.changdu=3;
yuanshipaidui.leixing=362;
yuanshipaidui.leixing=206;
yuanshipaidui.leixing=102;
yuanshipaidui.leixing=207;
yuanshipaidui.leixing=207;
yuanshipaidui.leixing=361;
yuanshipaidui.leixing=251;
yuanshipaidui.leixing=203;
yuanshipaidui.leixing=203;
yuanshipaidui.leixing=203;
yuanshipaidui.leixing=101;
yuanshipaidui.leixing=203;
yuanshipaidui.leixing=201;
yuanshipaidui.leixing=381;
yuanshipaidui.leixing=301;yuanshipaidui.changdu=1;
yuanshipaidui.leixing=331;
yuanshipaidui.leixing=201;
yuanshipaidui.leixing=201;
yuanshipaidui.leixing=382;
yuanshipaidui.leixing=251;
yuanshipaidui.leixing=208;
yuanshipaidui.leixing=101;
yuanshipaidui.leixing=101;
yuanshipaidui.leixing=101;
yuanshipaidui.leixing=101;
yuanshipaidui.leixing=210;
yuanshipaidui.leixing=210;
yuanshipaidui.leixing=301;yuanshipaidui.changdu=1;
yuanshipaidui.leixing=102;
yuanshipaidui.leixing=202;
yuanshipaidui.leixing=202;
yuanshipaidui.leixing=306;yuanshipaidui.changdu=3;
yuanshipaidui.leixing=102;
yuanshipaidui.leixing=102;
yuanshipaidui.leixing=102;
yuanshipaidui.leixing=102;
yuanshipaidui.leixing=102;
yuanshipaidui.leixing=102;
yuanshipaidui.leixing=307;yuanshipaidui.changdu=4;
yuanshipaidui.leixing=363;
int paiduishu=104;
int qipaishu=0;
printf("游戏开始!\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;
}
}

diameter 发表于 2013-1-29 19:04:34

作者是不是不会E文...Judge居然写成Panding....

juntokov 发表于 2013-1-29 19:32:07

2000多行的代码啊……这工作量

wtof1996 发表于 2013-1-30 14:37:58

本帖最后由 wtof1996 于 2013-1-30 14:42 编辑

既然是C++了用什么printf、scanf啊......
另外可能是忘了#include<ctime>,不然编译不过

81100118 发表于 2013-1-30 19:22:57

话说我曾经编了一个g1m的三国杀,五人局pvp 有5个武将

GWHBOB 发表于 2013-2-4 23:33:20

diameter 发表于 2013-1-29 19:04 static/image/common/back.gif
作者是不是不会E文...Judge居然写成Panding....

我一般用check(检定)
话说我现在大概算隐退了,所以也不长在线。结果3D现在还没有做,惭愧啊

乐观的萝卜 发表于 2013-2-7 20:14:11

觉得这很不靠谱啊

liuchang988 发表于 2013-2-11 11:29:37

diameter 发表于 2013-1-29 19:04 static/image/common/back.gif
作者是不是不会E文...Judge居然写成Panding....

还有yuanshipaidui leixing paidui qipaidui huihe...
页: [1]
查看完整版本: 人人上看到一个三国杀的cpp,有兴趣的人去移植一下