1.象棋
int a[114][514],b,c,d,g;
int cc=0;
int check(){
p.moveTo(-420,-280);
string ob;
int num;
cin>>ob>>num;
if(ob=="cg")cc=num;
}
int abs(int v){
if(v<0)v=v-v-v;
return v;
}
int f(int v){
return 0+(v>=8&&v<=14)*1;
}
string st(int k){
if(k==1 )return "将";
if(k==2 )return "仕";
if(k==3 )return "象";
if(k==4 )return "馬";
if(k==5 )return "車";
if(k==6 )return "砲";
if(k==7 )return "卒";
if(k==8 )return "帅";
if(k==9 )return "士";
if(k==10)return "相";
if(k==11)return "马";
if(k==12)return "车";
if(k==13)return "炮";
if(k==14)return "兵";
}
int can(int q,int w,int e,int r){
if(cc==1)return 1;
int k=a[q][w];string tr=st(a[q][w]);
if(f(k)!=g)return 0;
if((f(a[q][w])==f(a[e][r]))&&(a[e][r]!=0))return 0;
if(tr=="車"||tr=="车"){
if(q==e){
if(w>r)
for(int i=w-1;i>r;i--)if(a[q][i]!=0)return 0;
if(w<r)
for(int i=w+1;i<r;i++)if(a[q][i]!=0)return 0;
}
else if(w==r){
if(q>e)
for(int i=q-1;i>e;i--)if(a[i][w]!=0)return 0;
if(q<e)
for(int i=q+1;i<e;i++)if(a[i][w]!=0)return 0;
}
else if(q!=e&&w!=r)return 0;
}
if(tr=="馬"||tr=="马"){
if(a[q-1][w]==0){
if(q-2==e&&w+1==r)return 1;
if(q-2==e&&w-1==r)return 1;
}
if(a[q+1][w]==0){
if(q+2==e&&w+1==r)return 1;
if(q+2==e&&w-1==r)return 1;
}
if(a[q][w-1]==0){
if(q+1==e&&w-2==r)return 1;
if(q-1==e&&w-2==r)return 1;
}
if(a[q][w+1]==0){
if(q-1==e&&w+2==r)return 1;
if(q+1==e&&w+2==r)return 1;
}
return 0;
}
if(tr=="象"||tr=="相"){
if(f(k)==0){
if(q+2==e&&w+2==r&&a[q+1][w+1]==0)return 0+(r<=5);
if(q+2==e&&w-2==r&&a[q+1][w-1]==0)return 0+(r<=5);
if(q-2==e&&w+2==r&&a[q-1][w+1]==0)return 0+(r<=5);
if(q-2==e&&w-2==r&&a[q-1][w-1]==0)return 0+(r<=5);
}
if(f(k)==1){
if(q+2==e&&w+2==r&&a[q+1][w+1]==0)return 0+(r>=6);
if(q+2==e&&w-2==r&&a[q+1][w-1]==0)return 0+(r>=6);
if(q-2==e&&w+2==r&&a[q-1][w+1]==0)return 0+(r>=6);
if(q-2==e&&w-2==r&&a[q-1][w-1]==0)return 0+(r>=6);
}
return 0;
}
if(tr=="仕"||tr=="士"){
if(!(e>=4&&e<=6))return 0;
if(f(k)==0){
return 0+(abs(q-e)==1&&abs(w-r)==1&&r<=3);
}
if(f(k)==1){
return 0+(abs(q-e)==1&&abs(w-r)==1&&r>=8);
}
return 0;
}
if(tr=="将"){
if(st(a[e][r])=="帅"&&q==e&&a[e][r]!=0){
for(int i=w+1;i<=r-1;i++)
if(a[q][i]!=0)return 0;
return 1;
}
return 0+(4<=e&&e<=6&&1<=r&&r<=3&&(abs(q-e)+abs(w-r)==1));
}
if(tr=="帅"){
if(st(a[e][r])=="将"&&q==e&&a[e][r]!=0){
w=w+r;r=w-r;w=w-r;
for(int i=w+1;i<=r-1;i++)
if(a[q][i]!=0)return 0;
return 1;
}
return 0+(4<=e&&e<=6&&8<=r&&r<=10&&(abs(q-e)+abs(w-r)==1));
}
if(tr=="炮"||tr=="砲"){
int u=0;
if(q==e){
if(w>r)
for(int i=w-1;i>=r;i--)u+=(0+(a[q][i]!=0));
if(w<r)
for(int i=w+1;i<=r;i++)u+=(0+(a[q][i]!=0));
if(a[e][r]==0)return 0+(u==0);
else return 0+(u-1==1);
}
else if(w==r){
if(q>e)
for(int i=q-1;i>=e;i--)u+=(0+(a[i][w]!=0));
if(q<e)
for(int i=q+1;i<=e;i++)u+=(0+(a[i][w]!=0));
if(a[e][r]==0)return 0+(u==0);
else return 0+(u-1==1);
}
else if(q!=e&&w!=r)return 0;
}
if(tr=="兵"||tr=="卒"){
if(f(k)==0){
if(w<=5)
return 0+(q==e&&w+1==r);
else
return 0+((q==e&&w+1==r)||(q-1==e&&w==r)||(q+1==e&&w==r));
}
if(f(k)==1){
if(w>=6)
return 0+(q==e&&w-1==r);
else
return 0+((q==e&&w-1==r)||(q-1==e&&w==r)||(q+1==e&&w==r));
}
}
return 1;
}
int win(){
int x=0,y=0;
for(int i=1;i<=9;i++){
for(int j=1;j<=10;j++){
if(a[i][j]==1)x=1;
if(a[i][j]==8)y=1;
}
}
p.moveTo(0,0);
if(x==0){
p.rr(800,800,15).text("红方胜利",1,114);
wait(1);
return 1;
}
if(y==0){
p.rr(800,800,15).text("黑方胜利",0,114);
wait(1);
return 1;
}
return 0;
}
int draw(){
p.moveTo(0,0).rt(90).rr(800,800,15).c(2).size(4.4);
for(int i=0;i<9;i++)p.moveTo(-315,280-i*70).fd(630);
p.rt(90);
for(int i=0;i<10;i++)p.moveTo(-315+i*70,280).fd(560);
p.moveTo(0,0).rr(66,556,15).rt(180);
p.textSize(30);
p.moveTo(0,200).text("楚",2);
p.moveTo(0,100).text("河",2);
p.moveTo(0,-100).text("汉",2);
p.moveTo(0,-200).text("界",2);
p.moveTo(-315,70).lineTo(-175,-70);
p.moveTo(-175,70).lineTo(-315,-70);
p.moveTo(315,70).lineTo(175,-70);
p.moveTo(175,70).lineTo(315,-70);
for(int i=1;i<=9;i++){
for(int j=1;j<=10;j++){
p.moveTo(-315+(j-1)*70,280-(i-1)*70);
if(b==1){
if((can(c,d,i,j))){
p.ee(32.5,32.5,3);
}
}
if(a[i][j]!=0){
p.c(f(a[i][j]));
p.oo(23,15).o(23);
p.text(st(a[i][j]));
}
}
}
if(b==1){
p.moveTo(-315+(d-1)*70,280-(c-1)*70).size(5).o(30,10);
}
p.moveTo(0,350).rr(120,70,2).rr(114,64,g);
if(g==1)
p.moveTo(220,-330).text("move",0,35);
win();
p.moveTo(0,-360).o(30,11).textSize(22.5).text("again",11);
p.moveTo(-280,360).text("GoC Chinese Chess",0);
p.moveTo(280,360).text("Made With Skun",0);
p.moveTo(-350,-350).size(6).c(0).r(90,27,11).size(3).text("check");
}
int cm(int cx,int cy){
for(int i=1;i<=9;i++){
for(int j=1;j<=10;j++){
if(can(cx,cy,i,j))
return 1;
}
}
return 0;
}
int moss(){
p.moveTo(-220,-330).rr(100,50,15).text("thinking",0,35);
int v,fx,fy,t=0;
while(1){
v=rand(1,16);
for(int i=1;i<=9;i++){
for(int j=1;j<=10;j++){
if(a[i][j]==v){fx=i;fy=j;t=1;}
}
}
if(t==1&&cm(fx,fy))break;
}
p.moveTo(-315+(fy-1)*70,280-(fx-1)*70).size(5).o(30,10);
if(t==0)return 0;
while(1){
int mx=rand(1,9),my=rand(1,10);
if(can(fx,fy,mx,my)){
cout<<a[fx][fy]<<' '<<"move from("<<fx<<','<<fy<<")to("<<mx<<','<<my<<")\n";
a[mx][my]=a[fx][fy];
a[fx][fy]=0;
g=1-g;
p.rr(200,40,15);
return 0;
}
wait(0);
}
}
int pc(){
draw();
while(1){
waitMouse();
if(mouseIn(-350,-350,30))check();
if(mouseIn(0,-360,30)){
p.moveTo(0,-360).size(3).o(32,1);
while(mouseDown())wait(0);
return 0;
}
int x=getMDX(),y=getMDY(),t=0;
for(int i=1;i<=9;i++){
for(int j=1;j<=10;j++){
if(mouseIn(-315+(j-1)*70,280-(i-1)*70,30))
{x=i;y=j;t=1;break;}
}
if(t==1)break;
}
if(!(x==getMDX()&&y==getMDY())){
if(b==0&&a[x][y]==0)continue;
if(c==x&&d==y&&b==1)b=0;
else b++;
if(b==2){
b=0;
if(can(c,d,x,y)==1){
if(a[x][y]!=0)cout<<a[x][y]<<" die\n";
a[x][y]=a[c][d];a[c][d]=0;
g=1-g;draw();
cout<<a[x][y]<<' ';
}
else cout<<a[c][d]<<" can't ";
cout<<"move from("<<c<<','<<d<<")to("<<x<<','<<y<<")\n";
}
c=x;d=y;
}
if(win()==1)return 0;
if(g==0)moss();
draw();
}
return 0;
}
int pp(){
draw();
while(1){
waitMouse();
if(mouseIn(-350,-350,30))check();
if(mouseIn(0,-360,30)){
p.moveTo(0,-360).size(3).o(32,1);
while(mouseDown())wait(0.01);
return 0;
}
int x=getMDX(),y=getMDY(),t=0;
for(int i=1;i<=9;i++){
for(int j=1;j<=10;j++){
if(mouseIn(-315+(j-1)*70,280-(i-1)*70,30))
{x=i;y=j;t=1;break;}
}
if(t==1)break;
}
if(!(x==getMDX()&&y==getMDY())){
if(b==0&&a[x][y]==0)continue;
if(c==x&&d==y&&b==1)b=0;
else b++;
if(b==2){
b=0;
if(can(c,d,x,y)==1){
if(a[x][y]!=0)cout<<a[x][y]<<" die\n";
a[x][y]=a[c][d];a[c][d]=0;
g=1-g;draw();
cout<<a[x][y]<<' ';
}
else cout<<a[c][d]<<" can't ";
cout<<"move from("<<c<<','<<d<<")to("<<x<<','<<y<<")\n";
}
c=x;d=y;
}
if(win()==1)return 0;
draw();
if(g==0)
p.moveTo(-220,-330).text("move",0,35);
}
return 0;
}
int si(){
b=0;g=1;cc=0;
for(int i=1;i<=9;i++){
for(int j=1;j<=11;j++){
a[i][j]=0;
}
}
for(int i=0;i<5;i++)a[5-i][1]=a[5+i][1]=i+1;
a[2][3]=6;a[8][3]=6;
for(int i=1;i<=9;i+=2)a[i][4]=7;
for(int i=0;i<5;i++)a[5-i][10]=a[5+i][10]=i+1+7;
a[2][8]=13;a[8][8]=13;
for(int i=1;i<=9;i+=2)a[i][7]=14;
cout<<"chess initialization\n";p.c(2);
p.rr(8000,8000,15);
p.moveTo(0,180).text("GoC Chinese Chess",0,87);
p.moveTo(0,90).text("GCCC Made With Skun",0,51);
p.size(6);
p.moveTo(-200,-200).o(125).text("player",0,85);
p.moveTo( 200,-200).o(125).text("computer",0,58);
p.moveTo(350,-380).text("v2.0",0,24);
while(1){
waitMouse();
if(mouseIn(-200,-200,130)){
p.moveTo(-200,-200).size(5).o(128,1);
while(mouseDown())wait(0.01);
pp();
return 0;
}
if(mouseIn( 200,-200,130)){
p.moveTo( 200,-200).size(5).o(128,1);
while(mouseDown())wait(0.01);
pc();
return 0;
}
wait(0);
}
}
int main(){
p.speed(10).size(4).hide();
while(1){
si();
}
return 0;
}
2.吃鸡
int v(int l,int j){p.rr(30,30,3).text("ik",0).fd(45).r(j,20,0).rt(90);p.bk(l/2.0-j/2.0).rr(l,20,1).bk(l/2.0-50).fd(50).lt(90);}
int v1(int l1,int j){p.rr(100,50,1).text("目标",0).fd(45).r(j,20,0).lt(90).fd(j/2.0);p.rt(180).fd(l1/2.0).rr(l1,20,1).lt(90);}
int main(){
int jy=0,kpd,jc,gpd,gpd2,gpd3,xyd,xy1,xy2,kb,pd,password,xy=6,xp=10,pg=11,tg=5,tig,qwe,asd=0,xl=100,xl1=50,wa=3;
pen.button(100," ",15,0,0,-100,-100,15,15);
pen.button(1001," ",15,0,0,-300,300,15,15);
int h,l=100,l1=200,x=0,y=0,x1=100,y1=100,g,b,g1,b1,m,j1,kk,sd,k,_,__,_1=100,n_,L,__l,q=0;
p.speed(20).hide().up().button(1,"开始游戏",02,40,0,0,150,5);
for(int i=0;i<100;){
qwe=0;
asd=0;
if(buttonMP(100))
{
cinTitle("VIP?");
cin>>password; if(password==15923) {wa=0;xy+=50;xp+=10;pg+=20;tg+=10;xl+=1000;xl1+=500;}else if(password==123456){tg=15;xy=1;xp=5;pg=3;} else {xy=1;xp=5;pg=3;tg=2;}
}
if(buttonMP(1001))
{
cinTitle("是否解锁(1/0)?");
cin>>jc;
if(jc==1) {gpd=1;gpd2=1;gpd3=1;jy=1000;}
}
if(mouseIn(0,150,30)==1 || mouseIn(0,300,30)==1)
{cursor("pointer ");}
else
cursor("default");
wait(0.1);
p.cls().button(1,"开始游戏(j)",02,40,0,0,150,5);
p.moveTo(-300,100);
p.text("经验:"+d2s(jy));
p.button(2,"简介(l)",02,40,0,0,300,5);
p.button(12341,"典韦",02,40,0,-50,-300,5);
p.button(12342,"kk",02,40,0,-200,-300,5);
p.button(12343,"百里",02,40,0,100,-300,5);
p.moveTo(0,0).fd(50).text("第"+d2s(i+1)+"关");
p.moveTo(0,0).text("拒绝盗版游戏,接受正版游戏");
p.moveTo(-300,300).text("加经验");
b=0,l=(i/5*50)+_1;
if(l>=300) l=300;
kk=l,j1=l,l1=i*50+100;
if(l1>=500) l1=1000000;
int j=l1;
x=0,y=0,x1=400,y1=400,sd=0,k=getKey(),h=0;xy1=200,xy2=200,xyd=0;
if(kb>=1 && kpd==1)
{ xy1-=(50*jc);
xy2-=(50*jc);
xy-=(20*jc);
pg-=(20*jc);
xp-=(20*jc);
}
kpd=0;
jc=0;
p.button(129,"商店",0,50,0,-300,200,5,3);
if((buttonMP(129)|| k=='B'))
{
for(;;)
{
if(i>=5)
{
p.cls();
p.moveTo(-200,200).text("吸血刀(0经验)");
p.button(125,"buy",0,50,0,-200,100,5,3);
if(buttonMP(125) && jy>=20)
{
xy+=100000;
jy=jy-20;
}
p.button(125,"确定",0,50,0,0,-100,5,3);
if(buttonMP(125))break;
}
else
{
p.cls().text("请打到第5关解锁");
wait(1);
break;
}
wait(0.001);
}
}
if(buttonMP(12341) && xy<=200 )
{
if(i>10)
{ gpd=1;}
if(gpd==1 )
{
if(jy>=30)
{
xy+=5;kb++;pd=0;jy=jy-30;}
else
{
p.cls().moveTo(0,0).text("经验不够");
wait(1);
}
}
else
{
p.cls().text("请打到第20关解锁");
wait(1);
}
}
if(buttonMP(12342) )
{
if(i>20)
{gpd2=1;}
if(gpd2==1)
{
if(jy>=15)
{
xp=xp+5;
pg+=5;jy=jy-15;}
else
{
p.cls().moveTo(0,0).text("经验不够");
wait(1);
}
}
else
{
p.cls().text("请打到第10关解锁");
wait(1);
}
}
if(buttonMP(12343))
{
if(i>40)
{gpd3=1;}
if(gpd3==1)
{
if(jy>50)
{
xl1+=20;
xl=xl+20;pd++;kb=0;}
else
{
p.cls().moveTo(0,0).text("经验不够");
wait(1);
}
}
else
{
p.cls().text("请打到第40关解锁");
wait(1);
}
}
p.moveTo(-200,-100).text("吸血:"+d2s(xy)).moveTo(0,-100).text("强普:"+d2s(xp));
p.moveTo(200,-100).text("普攻:"+d2s(pg)).moveTo(-200,-200).text("血量:"+d2s(l));
p.moveTo(0,-200).text("蓄力最高:"+d2s(xl)).moveTo(200,-200).text("蓄力最低:"+d2s(xl1));
p.moveTo(300,200).text("目标血量:"+d2s(l1));
if(pd>=1)
p.moveTo(100,-350).text("闪:"+d2s(pd));
if(kb>=1)
p.moveTo(-50,-350).text("狂暴(狂暴后弱化):"+d2s(kb));
if(buttonMP(2)||k=='L'){
p.cls().moveTo(0,200).text("W前,D后,A左,S下,Q闪,G同归于尽,空格重来").moveTo(0,100).text("↑大前,↓大下,←大左,→大右,F键回血,V健瞬移,M蓄力").moveTo(0,300).text("1暂停,5退退退,2变为潜行模式,3解除潜行模式").moveTo(0,-100).text("先按E,没血按F,最后按X");
p.button(3,"确定",0,40,0,0,0,5);
for(;;){
int MM=getKey();
if(buttonMP(3)||MM=='L') break;
wait(0.00000000001);
}
}
if(buttonMP(1)||k=='J'){
if(__l==0){
__l++;
p.cls();
p.r(150,50);
p.speed(9);
p.moveTo(-75,0);
p.bk(25);
p.hide();
pen.button(15,"跳过(T)",0,50,0,0,200,5,3);
for(int i=1;i<=75;i++)
{
if(mouseIn(0,200,30)==1 )
{cursor("pointer ");}
else
cursor("default");
tig=getKey();
p.down();
if(buttonMP(15) || tig=='T') break;
p.c(3).fd(50).bk(50).rt(90).fd(1).rt(-90);
p.moveTo(0,-100);
if(i%3==0)
{pen.clsRec( 600, 120 );p.text("游戏加载中.",13,100).moveTo(-75+i,-25);}
if(i%3==1)
{pen.clsRec( 600, 120 );p.text("游戏加载中..",13,100).moveTo(-75+i,-25);}
if(i%3==2)
{pen.clsRec( 600, 120 );p.text("游戏加载中...",13,100).moveTo(-75+i,-25);}
}
if(i==50)
{
p.cls().moveTo(0,0).text("BOSS!",1,200);
}
p.up();
p.cls();
p.c(2);
p.speed(10);
p.cls().moveTo(-200,0),v(l,j1);
p.moveTo(200,0),v1(l1,j);
p.moveTo(-200,0).down().lineTo(200,0).up().oo(10,1);
p.moveTo(0,0).moveTo(-300,300);
}
for(;;){
wait(0.02);
p.cls();
p.moveTo(x1,y1);
v1(l1,j);
p.moveTo(x,y);
v(l,j1);
k=getKey();
if(k==65){x-=20;}
if(k==68){x+=20;}
if(k==87){y+=20;}
if(k==83){y-=20;}
if(k=='4'){
p.moveTo(0,300).text("你怎么这么慢");
l1=l1-5;
wait(0.5);
}
if(k=='F'&&b<4&&l<j1&&h!=1 && xyd==0) {
l=j1;
b++;
}
if(k=='5'){
if(x<0) x1=x1+200;
if(x>=0) x1=x1-200;
p.moveTo(0,300).text("退退退");
wait(0.2);
}
if(k=='Q')
{
if(pd>=1)
{if(x1<0 && x>=-400) x=x+rand(-100,200);
if(x1>=0&& x<=400) x=x-rand(-100,200);
if(y1<0 && y>=-400) y=y+rand(-100,200);
if(y1>=0&& y<=400) y=y-rand(-100,200);
if(x==x1 && y==y1) {
x=x1+rand(-100,200);y=y1+rand(-100,200);}
wait(0.2);}
if(kb>=1)
{
xy1+=50;
xy2+=50;
xy+=20;
pg+=20;
xp+=20;
l=1;
xyd=1;
kpd=1;
jc++;
}
}
if(k==37){
x=x-xy1;
}
if(k==38){
y=y+xy2;
}
if(k==40){
y=y-xy2;
}
if(k==39){
x=x+xy1;
}
if(k=='X' && qwe==0)
{
qwe++;
p.speed(8).moveTo(x,y).down().size(20).c(4).lineTo(x1,y1).size(5).c(2).oo(10,1).up();
p.fd(5).rt(90).fd(50);
m=rand(xl1,xl);
p.text("-"+d2s(m),2);
wait(wa);
x=x1;
y=y1;
l=l/2;
l1=l1-m;
p.speed(10).moveTo(x,y).cls();
m=0;
}
if(k=='H'&&l<kk&&h!=1){
p.speed(8).c(1).moveTo(x,y).down().lineTo(x1,y1).oo(10,1).up();
p.fd(5).rt(90).fd(50);
m=rand(1,xy);
if(m==6) p.text("无视",1);
else {p.text("-"+d2s(m),1);l1=l1-m;l=l+m;}
if(l>kk) l=kk;
p.speed(10).moveTo(x,y).cls().c(2);
}
if(k=='E' && l>10){
p.speed(8).c(1).moveTo(x,y).down().lineTo(x1,y1).oo(10,1).up();
p.fd(5).rt(90).fd(50);
m=l/2;
if(l1==m) p.text("无视",1);
else {p.text("-"+d2s(m),1);l1=l1-m;l=l-m;}
if(l>kk) l=kk;
p.speed(10).moveTo(x,y).cls().c(2);
}
if(k=='V'&&sd<4&&h!=1){
cinTitle("输入坐标");
cin>>x>>y;
sd++;
}
if(k=='J') break;
if(k=='G'&&h!=1){
p.speed(8).moveTo(x,y).down().lineTo(x1,y1).oo(10,1).up();
p.fd(5).rt(90).fd(50);
m=rand(1,pg);
if(m==11) p.text("无视",1);
else {p.text("-"+d2s(m),1);l1=l1-m;}
p.speed(10).moveTo(x,y).cls();
}
if(k=='U'){
p.speed(8).moveTo(x,y).down().size(20).c(4).lineTo(x1,y1).size(5).c(2).oo(10,1).up();
p.fd(5).rt(90).fd(50);
m=rand(1,xp);
if(m==11) p.text("无视",1);
else {p.text("-"+d2s(m),1);l1=l1-m;}
p.speed(10).moveTo(x,y).cls();
}
if(k=='0'&&_<5){
_++;
break;
}
if(k==186&&L==0) break;
if(x<-400) x=390;
if(x>400) x=-390;
if(y>400) y=-390;
if(y<-400) y=390;
if(x1>x&&h!=1) x1=x1-10;
if(x1<x&&h!=1) x1=x1+10;
if(y1>y&&h!=1) y1=y1-10;
if(y1<y&&h!=1) y1=y1+10;
if(x1==x&&y1==y&&h!=1) l=l-i-1;
if(l<=0){
p.cls().moveTo(0,0).text("你输了!",0,200);
wait(1);
p.cls();
break;
}
if(l1<=0){
p.cls().moveTo(0,0).text("你赢了!",0,200);
jy+=10;
p.moveTo(0,-200).text("经验+10",1,200);
wait(1);
p.cls();
i++;
break;
}
if(k=='1'){
p.moveTo(-300,300).text("暂停……");
for(;;){
k=getKey();
if(k=='1') break;
wait(0.00000000000000001);
}
}
if(k=='2'){
h=1;
}
if(k=='3') h=0;
}
}
if(k=='0'&&_<=tg){
i++;
p.cls().text("您已跳关");
wait(0.5);
_++;
}
wait(0.01);
}
return 0;
}