为了正常的体验网站,请在浏览器设置里面开启Javascript功能!

圈叉棋

2017-09-26 15页 doc 42KB 7阅读

用户头像

is_686908

暂无简介

举报
圈叉棋圈叉棋 #include #include #include #define up 0x4800 #define down 0x5000 #define left 0x4b00 #define right 0x4d00 #define esc 0x011b #define space 0x3920 int ding[19][19]; void outbiao(int x,int y) { setcolor(WHITE); line(x-45,y-10,x-45,y-45); line(x-45,y-...
圈叉棋
圈叉棋 #include #include #include #define up 0x4800 #define down 0x5000 #define left 0x4b00 #define right 0x4d00 #define esc 0x011b #define space 0x3920 int ding[19][19]; void outbiao(int x,int y) { setcolor(WHITE); line(x-45,y-10,x-45,y-45); line(x-45,y-45,x-10,y-45); line(x+45,y-10,x+45,y-45); line(x+45,y-45,x+10,y-45); line(x-45,y+10,x-45,y+45); line(x-45,y+45,x-10,y+45); line(x+45,y+10,x+45,y+45); line(x+45,y+45,x+10,y+45); } void clsbiao(int x,int y) { setcolor(BLACK); line(x-45,y-10,x-45,y-45); line(x-45,y-45,x-10,y-45); line(x+45,y-10,x+45,y-45); line(x+45,y-45,x+10,y-45); line(x-45,y+10,x-45,y+45); line(x-45,y+45,x-10,y+45); line(x+45,y+10,x+45,y+45); line(x+45,y+45,x+10,y+45); } int dingxy(int x,int y) { if (ding[(x-50)/100-1][(y-50)/100-1]==0) return 1; else return 0; } int yeah(int x,int y,int vs) { int n1=1,n2=1,n3=1,n4=1,i,l=1,r=1,t=1,d=1,lt=1,rd=1,rt=1,ld=1; for(i=1;i<=2;i++){ if (l==1 && ding[x-i][y]==vs) n1++;else l=0; if (r==1 && ding[x+i][y]==vs) n1++;else r=0; if (t==1 && ding[x][y-i]==vs) n2++;else t=0; if (d==1 && ding[x][y+i]==vs) n2++;else d=0; if (lt==1 && ding[x-i][y-i]==vs) n3++;else lt=0; if (rd==1 && ding[x+i][y+i]==vs) n3++;else rd=0; if (rt==1 && ding[x+i][y-i]==vs) n4++;else rt=0; if (ld==1 && ding[x-i][y+i]==vs) n4++;else ld=0; } if (n1>=3||n2>=3||n3>=3||n4>=3) return 1;else return 0; } void cursor(int x,int y) /* ?,Ê?×Ö?â?êº?Êý */ { int x1,x2,y1,y2; x1=x-25; x2=x+25; y1=y-25; y2=y+25; setcolor(15); line(x1,y1,x2,y2); line(x1,y2,x2,y1); } main() { int drive,mode,x,y,i,j,key,x1,x2,y1,y2,player; player=1; drive=DETECT; initgraph(&drive,&mode,"c:\\tc"); setbkcolor(0); cleardevice( ); setcolor(14); setlinestyle(4,0x1001,3); rectangle(100,100,400,400); line(100,200,400,200); line(100,300,400,300); line(200,100,200,400); line(300,100,300,400); circle(570,480,95); setcolor(12); setlinestyle(2,0,3); circle(650,380,60); circle(100,100,30); setcolor(11); moveto(440,50); outtext("Player key:"); moveto(440,300); outtext(" PUT INTO : "); setlinestyle(2,0,3); circle(440,335,12); setlinestyle(2,0,3); circle(570,480,110); setlinestyle(2,0,3); circle(100,100,20); setcolor(2); setlinestyle(2,0,3); circle(50,230,13); setcolor(5); setlinestyle(2,0,3); circle(600,0,60); circle(59,240,8); setcolor(6); setlinestyle(2,0,3); circle(450,350,20); circle(85,425,40); setcolor(10); setlinestyle(2,0,3); circle(85,425,25); setcolor(7); setlinestyle(2,0,3); circle(120,445,18); setcolor(4); setlinestyle(2,0,3); circle(450,372,6); settextstyle(1,0,4); moveto(475,100); outtext(" UP -- up"); moveto(475,150); outtext(" DOWN -- down"); moveto(475,200); outtext(" LEFT -- left"); moveto(475,250); outtext("RIGHT -- right"); moveto(475,330); outtext(" space"); setlinestyle(0,0,1); x=50;y=50; outbiao(x,y); while(1){ key=bioskey(0); if (key==up){ if (y>200){ clsbiao(x,y); y-=100; outbiao(x,y); } } if (key==down){ if(y<300){ clsbiao(x,y); y+=100; outbiao(x,y); } } if (key==left){ if (x>200){ clsbiao(x,y); x-=100; outbiao(x,y); } } if (key==right){ if (x<300){ clsbiao(x,y); x+=100; outbiao(x,y); } } if (key==space){ if (dingxy(x,y)!=0){ i=(x-50)/100-1; j=(y-50)/100-1; if (player==1) { setcolor(15); setlinestyle(0,0,3); circle(x,y,35); setlinestyle(0,0,1); ding[i][j]=1; if (yeah(i,j,1)==1) { moveto(200,200); settextstyle(0,0,4); setcolor(9); outtext("O WIN !!!"); break; } player=2; } else { setlinestyle(0,0,3); cursor(x,y); setlinestyle(0,0,1); ding[i][j]=2; if (yeah(i,j,2)==1) { moveto(200,200); settextstyle(0,0,4); setcolor(9); outtext("X WIN !!!"); break; } player=1; } } } if (key==esc) break; } moveto(130,300); settextstyle(0,0,2); setcolor(4); outtext("Press any key to Quit..."); getch(); closegraph(); } ???????????????????????152???????????????????????????????????????? ???????????? ?????????????????????????????????????????????????????????????????? ???????????????????????????????????????????????? ?????????????????????????????????????????????????????????????????? ??????????????? ?????????????????????????????????????????????????????????????????? ???????????????????????? ?????????????????????????????????????????????????????????????????? ????????????????????????????????????????????????????????????????????????????????????? ??????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????? ?????????????????????????????????????????????????????????????????????????? ??????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????? ????????????????????????????????????????????????????????????????????????????????? ?????????????????????????????????????????????????? ??????1000??? ??????????????????????????? ?????????????????????????????????????????????????????????????????????????????????????? ????????????????????????????????????????????????????????????????????????????????????????????? ??????????????????????????????????????????????????????????? ???????????????????????????????????????????????????????????????????????????????????????????????????????????????????? ????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????? ???????????????????????????????????????????——????????????????????? ??????? ????????????????????????????????????????????????????????? ?????????????????????????????????????????????????????????????????????????????????? ???????????????????????????????????????????????????????????????????????????????? ???????????????????????????????????????????????????????? ??????1000??? ?????????????????????????????????????????????????????????????????????????? ???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????? ?????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????? ????????????????????????????????????????????????????????????????????????????? ????????????????????????????????????????????????????????????????????????????????? ??????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????? ?????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????? ?????????????????????????????????????????????????????????????????????????????????? ??????1000??? ??????????????????????????????.?????????????????????????????????????????????????????????????????????????????????????????????????????? ???????????????????????????????????????? ??????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????——?????????????????? ????????.?????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????? ??????.??????????????????????????????????????????? ?.????????????????????????????????????????????????????????......??????????????,??????????,????.??????????????,????????????. ??????????????????????????????????????????????????????,??????????.????????????????,???????????????????????????????????????????????????????????,????,?????.????????????.?????????????,????????????????“???????????????????????????????????????????”?“??????????”?????????????????????????????????????????????????????????????????????,??????????????????,????????????????,???????????????.???????????????????????????????????????????????????????????????? ?????????????——????????????????????????????????????????????????????????????——?????????????????????????? ????????????????????????????????????????????????????????????????????????????????????????“???????????????????????”????????????????——????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????? ??????1000??? ?????????????????????????????????????????????????????????????? ????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????? ?????????????????????????????????????????????????????????????????????????????"???????????"????????????????????????????????????????????????????????????????????????:"???????????""?????????--?????????!""???????????????????????????--?????????????????????????????????????????????--???????????!" ????????????????????????????????????????????--??????????????????????????????????????????????????????????????????????????????????????????????? ?????????????????????????????????????????????????????????????????????????????????????????????-?????????????????????=??+?????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????? ??????1000??? ??????????????????????????????????????????????????????????????????????????????????????????? ?????????????????????????????????????????????????????? ??????????????????????????????????????????“??????????????????????????????????”?????????????????????????????????????????????????? ????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????? ????????????????????????????????????????——???????????????????? ?????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????“???????????????????????——????????????????????????????”?????????????????????? ????????????????????????????????????18????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????“????????????????????????????……???????????????????????????????????????????????——?????????”?????????????????????????????????????????????????????? ???????????????????????????????????????????? ????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????? ???????????????????????????????????????????? ????????????????????????????????19?????????????????????? ????????????????????????????????????????????????????????????????? ?????????????????????????????????????????????????????? ????????????????????? ?????????????????????????????????????——??????????????????????? ?? ——?? ??????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????? ???????????????????????????????????????????????????????????????????????????????????????????——?????????????????????????????????????????????????????????????reader8.cn??????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????? ??????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????? ??????????????????????????????????????????????????????????????????????????????????????????? ??????????????????????????????????????????????????? ???????????????????????????????????????????????????????????????????3COME????????????????????????????????????????????? ?????????????????????????????????????????????????????????????????????????????????????????? ??????????????????????????????????????????——?????????
/
本文档为【圈叉棋】,请使用软件OFFICE或WPS软件打开。作品中的文字与图均可以修改和编辑, 图片更改请在作品中右键图片并更换,文字修改请直接点击文字进行修改,也可以新增和删除文档中的内容。
[版权声明] 本站所有资料为用户分享产生,若发现您的权利被侵害,请联系客服邮件isharekefu@iask.cn,我们尽快处理。 本作品所展示的图片、画像、字体、音乐的版权可能需版权方额外授权,请谨慎使用。 网站提供的党政主题相关内容(国旗、国徽、党徽..)目的在于配合国家政策宣传,仅限个人学习分享使用,禁止用于任何广告和商用目的。

历史搜索

    清空历史搜索