📄 aa.cpp
字号:
for(kl=0;kl<11;kl++) /*把不在test数组中的九张放到test数组中*/
{if(kl==i)
{
kl=kl+2;
if(kl==11)
break;
}
test[ill++]=pi[kl];
}
isthree(test,ii-2);
}
}
else if(ii=12)
isthree(pi,ii);
else if(ii=14)
for(i=0;i<13;i++)
{
for(j=0;j<2;j++)
{test[j]=pi[i+j];
}
if(istwo(test))
{ ill=0;
for(kl=0;kl<11;kl++) /*把不在test数组中的九张放到test数组中*/
{if(kl==i)
{
kl=kl+2;
if(kl==14)
break;
}
test[ill++]=pi[kl];
}
isthree(test,ii-2);
}
}
if(ff==2)
istwo(pf);
else if(ff==3)
isthree(pf,ff);
else if(ff==5)
/*pf[5]原始牌数组,假设已经升序排列*/
/*test[3]用来放置测试牌的数组*/
for(i=0;i<4;i++)
{
for(j=0;j<2;j++)
{test[j]=pf[i+j];
}
if(istwo(test))
{ ill=0;
for(kl=0;kl<5;kl++) /*把不在test数组中的三张放到test数组中*/
{if(kl==i)
{
kl=kl+2;
if(kl==5)
break;
}
test[ill++]=pf[kl];
}
isthree(test);
}
}
else if(ff==6)
isthree(pf,ff);
else if(ff==8)
for(i=0;i<7;i++)
{
for(j=0;j<2;j++)
{test[j]=pf[i+j];
}
if(istwo(test))
{ ill=0;
for(kl=0;kl<8;kl++) /*把不在test数组中的六张放到test数组中*/
{if(kl==i)
{
kl=kl+2;
if(kl==8)
break;
}
test[ill++]=pf[kl];
}
isthree(test,ff-2);
}
}
else if(ff==9)
isthree(pw,ww);
else if(ff==11)
for(i=0;i<10;i++)
{
for(j=0;j<2;j++)
{test[j]=pf[i+j];
}
if(istwo(test))
{ ill=0;
for(kl=0;kl<11;kl++) /*把不在test数组中的九张放到test数组中*/
{if(kl==i)
{
kl=kl+2;
if(kl==11)
break;
}
test[ill++]=pf[kl];
}
isthree(test,ff-2);
}
}
else if(ff=12)
isthree(pf,ff);
else if(ff=14)
for(i=0;i<13;i++)
{
for(j=0;j<2;j++)
{test[j]=pf[i+j];
}
if(istwo(test))
{ ill=0;
for(kl=0;kl<11;kl++) /*把不在test数组中的九张放到test数组中*/
{if(kl==i)
{
kl=kl+2;
if(kl==14)
break;
}
test[ill++]=pf[kl];
}
isthree(test,ff-2);
}
}
}
void main(void)
{
FILE *bmp;
static char *name[2]={"ff.bmp","logo.bmp"};
char *p;
int *lingshi;
int x,y,i,j,t=2,cont=13,temp,n=0,onetothirteen=13,oneorthirteen=13,l=0,ll=0,kk,u;
int every=0,w=0,x1,x2,y1,y2,every1=0;
int logo,lg,lgg,logoo,b=0,c=0,pg=0,h,h1,g=0,kkk,kkkk,r=0,d,o=0,dwei=0,dweig=0,dw[3],nn;
BYTE palette[256][3];
SETVGA;
getch();
while(t--)
{
bmp=fopen(name[t],"rb");
fseek(bmp,54,SEEK_SET);
for(i=0;i<256;i++)
{
palette[i][2]=fgetc(bmp)>>2;
palette[i][1]=fgetc(bmp)>>2;
palette[i][0]=fgetc(bmp)>>2;
fgetc(bmp);
Set_Palette(i,palette[i][0],palette[i][1],palette[i][2]);
}
for (y=0;y<200;y++)
for(x=0;x<320;x++)
pokeb(0xa000,y*320+x,fgetc(bmp));
fclose(bmp);
getch();
}
getch();
fillRectangle(0,0,320,200,0);
getch();
randomize();
me.m=onetothirteen;
while(me.m>0) /*先循环,给自己拿牌*/
{
temp=random(136);
if(m[temp].data2==0 && m[temp].data1==0)
{
me.pp[n].k=m[temp].name; /*把136中之一的牌放到我的手上*/
me.pp[n].oneorfour=m[temp].number; /*判断同一个花色中的第几张*/
me.pp[n].number=temp; /*第几张,用来排序*/
m[temp].data2=1; /*判断牌是谁的*/
kk=1;
}
if(kk==0) /*判断如果又选择了,就从新再选*/
{
me.m++;
n--;
}
me.m--;
n++;
kk=0;
}
me.m=12;
melipai(); /*理牌*/
n=13;
while(l<n)
{
z=z+20;
showbmp(l);
l++;
}
randomize();
computer.m=oneorthirteen;
n=0;
while(computer.m>0) /*循环,给对方拿牌*/
{
temp=random(136);
if(m[temp].data2==0 && m[temp].data1==0)
{
computer.pp[n].k=m[temp].name; /*把136中之一的牌放到电脑的手上*/
computer.pp[n].oneorfour=m[temp].number; /*判断同一个花色中的第几张*/
computer.pp[n].number=temp; /*第几张,用来排序*/
m[temp].data2=2; /*判断牌是谁的,2为电脑*/
kk=1;
}
if(kk==0) /*判断如果又选择了,就从新再选*/
{
computer.m++;
n--;
}
computer.m--;
n++;
kk=0;
}
computer.m=12;
comlipai(); /*电脑理牌*/
n=13;
while(ll<n)
{
zy=zy+20;
showybmp(ll);
ll++;
}
z=54400;
while(key!=ESC)
{
keyy=bioskey(0);
if(keyy==LEFT)
{ w=1;
if(every==0)
{
every=1;
z=54440-5*320;
}
zz=zz+5*320;
showbmp(every);
if(every==0)
{
x1=20;
y1=165;
fillRectangle(x1,y1,x1+20,y1+4,0);
}
if(every==1)
{
x1=40;
y1=165;
fillRectangle(x1,y1,x1+20,y1+4,0);
}
if(every==2)
{
x1=60;
y1=165;
fillRectangle(x1,y1,x1+20,y1+4,0);
}
if(every==3)
{
x1=80;
y1=165;
fillRectangle(x1,y1,x1+20,y1+4,0);
}
if(every==4)
{
x1=100;
y1=165;
fillRectangle(x1,y1,x1+20,y1+4,0);
}
if(every==5)
{
x1=120;
y1=165;
fillRectangle(x1,y1,x1+20,y1+4,0);
}
if(every==6)
{
x1=140;
y1=165;
fillRectangle(x1,y1,x1+20,y1+4,0);
}
if(every==7)
{
x1=160;
y1=165;
fillRectangle(x1,y1,x1+20,y1+4,0);
}
if(every==8)
{
x1=180;
y1=165;
fillRectangle(x1,y1,x1+20,y1+4,0);
}
if(every==9)
{
x1=200;
y1=165;
fillRectangle(x1,y1,x1+20,y1+4,0);
}
if(every==10)
{
x1=220;
y1=165;
fillRectangle(x1,y1,x1+20,y1+4,0);
}
if(every==11)
{
x1=240;
y1=165;
fillRectangle(x1,y1,x1+20,y1+4,0);
}
if(every==12)
{
x1=260;
y1=165;
fillRectangle(x1,y1,x1+20,y1+4,0);
}
zz=0;
every--;
z=z-20;
}
if(keyy==RIGHT)
{ if(w==0)
{
z=54440-5*320;
z=z-20;
w=1;
}
if(every==12)
{
every=11;
z=54640-5*320;
}
zz=zz+5*320;
showbmp(every);
if(every==0)
{
x1=20;
y1=165;
fillRectangle(x1,y1,x1+20,y1+4,0);
}
if(every==1)
{
x1=40;
y1=165;
fillRectangle(x1,y1,x1+20,y1+4,0);
}
if(every==2)
{
x1=60;
y1=165;
fillRectangle(x1,y1,x1+20,y1+4,0);
}
if(every==3)
{
x1=80;
y1=165;
fillRectangle(x1,y1,x1+20,y1+4,0);
}
if(every==4)
{
x1=100;
y1=165;
fillRectangle(x1,y1,x1+20,y1+4,0);
}
if(every==5)
{
x1=120;
y1=165;
fillRectangle(x1,y1,x1+20,y1+4,0);
}
if(every==6)
{
x1=140;
y1=165;
fillRectangle(x1,y1,x1+20,y1+4,0);
}
if(every==7)
{
x1=160;
y1=165;
fillRectangle(x1,y1,x1+20,y1+4,0);
}
if(every==8)
{
x1=180;
y1=165;
fillRectangle(x1,y1,x1+20,y1+4,0);
}
if(every==9)
{
x1=200;
y1=165;
fillRectangle(x1,y1,x1+20,y1+4,0);
}
if(every==10)
{
x1=220;
y1=165;
fillRectangle(x1,y1,x1+20,y1+4,0);
}
if(every==11)
{
x1=240;
y1=165;
fillRectangle(x1,y1,x1+20,y1+4,0);
}
if(every==12)
{
x1=260;
y1=165;
fillRectangle(x1,y1,x1+20,y1+4,0);
}
zz=0;
every++;
z=z+20;
}
showbmp(every);
key=keyy;
if(keyy==ENTER)
{
rgzn(every); /*********************/
if(sing==1) /*如果可以乓,做相应的处理*/
{
kkk=0;
kkkk=0;
while(kkk<=computer.m)
{
if(computer.pp[kkk].p!=1)
{
comp.pp[kkkk].k=computer.pp[kkk].k;
comp.pp[kkkk].oneorfour=computer.pp[kkk].oneorfour;
comp.pp[kkkk].number=computer.pp[kkk].number;
kkkk++;
}
else
{
m[computer.pp[kkk].number].data1=1;
dwei=computer.pp[kkk].number;
computer.pp[kkk].p=0;
}
kkk++;
}
ll=0;
while(ll<3)
{ zl=zl+20;
bmpp(dwei); /*显示乓的牌*/
ll++;
}
zl=zl+9600-60;
kkk=0;
computer.m=computer.m-2;
while(kkk<=computer.m)
{
computer.pp[kkk].k=comp.pp[kkk].k;
computer.pp[kkk].oneorfour=comp.pp[kkk].oneorfour;
computer.pp[kkk].number=comp.pp[kkk].number;
kkk++;
}
ll=0;
temp=random(computer.m); /*出牌等待完善*/
zyy=zyy+9280+20;
showcbmp(temp);
zyy=zyy-9280;
/*****/
rgznme(temp);
panduan();
if(me.m==0)
if(second==1 && threes==0)
printf("you win!");
if(me.m==3)
if(second==1 && threes==1)
printf("you win!");
if(me.m==6)
if(second==1 && threes==2)
printf("you win!");
if(me.m==9)
if(second==1 && threes==3)
printf("you win!");
if(me.m==12)
if(second==1 && threes==4)
printf("you win!");
kkk=0;
kkkk=0;
while(kkk<=computer.m)
{
if(kkk!=temp)
{
comp.pp[kkkk].k=computer.pp[kkk].k;
comp.pp[kkkk].oneorfour=computer.pp[kkk].oneorfour;
comp.pp[kkkk].number=computer.pp[kkk].number;
kkkk++;
}
else
m[computer.pp[kkk].number].data1=1;
kkk++;
}
kkk=0;
computer.m=computer.m-1;
while(kkk<=computer.m)
{
computer.pp[kkk].k=comp.pp[kkk].k;
computer.pp[kkk].oneorfour=comp.pp[kkk].oneorfour;
computer.pp[kkk].number=comp.pp[kkk].number;
kkk++;
}
fillRectangle(0,0,320,30,0);
n=computer.m;
ll=0;
zy=0;
while(ll<=n)
{
zy=zy+20;
showybmp(ll);
ll++;
}
ll=0;
getch();
sing=0;
sing1=1;
}
if(sing==2) /*如果可以杠的做相应处理*/
{
kkk=0;
kkkk=0;
while(kkk<=computer.m)
{
if(computer.pp[kkk].g!=1)
{
comp.pp[kkkk].k=computer.pp[kkk].k;
comp.pp[kkkk].oneorfour=computer.pp[kkk].oneorfour;
comp.pp[kkkk].number=computer.pp[kkk].number;
kkkk++;
}
else
{
m[computer.pp[kkk].number].data1=1;
dweig=computer.pp[kkk].number;
computer.pp[kkk].g=0;
}
kkk++;
}
ll=0;
while(ll<=3)
{ zl=zl+20;
bmpp(dweig); /*显示杠的牌*/
ll++;
}
zl=zl+9600-60;
kkk=0;
computer.m=computer.m-3;
while(kkk<=computer.m)
{
computer.pp[kkk].k=comp.pp[kkk].k;
computer.pp[kkk].oneorfour=comp.pp[kkk].oneorfour;
computer.pp[kkk].number=comp.pp[kkk].number;
kkk++;
}
kk=0;
computer.m++; /*加一个牌的容量*/
while(kk!=1)
{
temp=random(136); /*出牌*/
if(m[temp].data2==0 && m[temp].data1==0)
{
computer.pp[computer.m].k=m[temp].name; /*把136中之一的牌放到电脑的手上*/
computer.pp[computer.m].oneorfour=m[temp].number; /*判断同一个花色中的第几张*/
computer.pp[computer.m].number=temp; /*第几张,用来排序*/
m[temp].data2=2; /*判断牌是谁的,2为电脑*/
kk=1;
}
}
comlipai();
temp=random(computer.m); /*出牌,等待完善*/
zyy=zyy+9280+20;
showcbmp(temp);
zyy=zyy-9280;
/*****/
rgznme(temp);
panduan();
if(me.m==0)
if(second==1 && threes==0)
printf("you win!");
if(me.m==3)
if(second==1 && threes==1)
printf("you win!");
if(me.m==6)
if(second==1 && threes==2)
printf("you win!");
if(me.m==9)
if(second==1 && threes==3)
printf("you win!");
if(me.m==12)
if(second==1 && threes==4)
printf("you win!");
kkk=0;
kkkk=0;
while(kkk<=computer.m) /*把未选的牌放到零时变量*/
{
if(kkk!=temp)
{
comp.pp[kkkk].k=computer.pp[kkk].k;
comp.pp[kkkk].oneorfour=computer.pp[kkk].oneorfour;
comp.pp[kkkk].number=computer.pp[kkk].number;
kkkk++;
}
else
m[computer.pp[kkk].number].data1=1;
kkk++;
}
kkk=0;
computer.m=computer.m-1; /*把未选到的剩余牌放入电脑手中*/
while(kkk<=computer.m)
{
computer.pp[kkk].k=comp.pp[kkk].k;
computer.pp[kkk].oneorfour=comp.pp[kkk].oneorfour;
computer.pp[kkk].number=comp.pp[kkk].number;
kkk++;
}
fillRectangle(0,0,320,30,0);
ll=0;
zy=0;
while(ll<=computer.m)
{
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -