




全文预览已结束
下载本文档
版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
#include #include #include #include #include #define LEFT 0x4b00 #define RIGHT 0x4d00 #define DOWN 0x5000 #define UP 0x4800 #define ESC 0x011b #define SPACE 0x3920 #define BILI 20 #define JZ 4 #define JS 3 #define N 19 int boxNN; int step_x,step_y ; int key ; int flag=1 ; void draw_box(); void draw_cicle(int x,int y,int color); void change(); void judgewho(int x,int y); void judgekey(); int judgeresult(int x,int y); void attentoin(); void attention() char ch ; window(1,1,80,25); textbackground(LIGHTBLUE); textcolor(YELLOW); clrscr(); gotoxy(15,2); printf(游戏操作规则:); gotoxy(15,4); printf(Play Rules:); gotoxy(15,6); printf(1、按左右上下方向键移动棋子); gotoxy(15,8); printf(1. Press Left,Right,Up,Down Key to move Piece); gotoxy(15,10); printf(2、按空格确定落棋子); gotoxy(15,12); printf(2. Press Space to place the Piece); gotoxy(15,14); printf(3、禁止在棋盘外按空格); gotoxy(15,16); printf(3. DO NOT press Space outside of the chessboard); gotoxy(15,18); printf(你是否接受上述的游戏规则(Y/N)); gotoxy(15,20); printf(Do you accept the above Playing Rules? Y/N:); while(1) gotoxy(60,20); ch=getche(); if(ch=Y|ch=y) break ; else if(ch=N|ch=n) window(1,1,80,25); textbackground(BLACK); textcolor(LIGHTGRAY); clrscr(); exit(0); gotoxy(51,12); printf( ); void draw_box() int x1,x2,y1,y2 ; setbkcolor(LIGHTBLUE); setcolor(YELLOW); gotoxy(7,2); printf(Left, Right, Up, Down KEY to move, Space to put, ESC-quit.); for(x1=1,y1=1,y2=18;x1=18;x1+) line(x1+JZ)*BILI,(y1+JS)*BILI,(x1+JZ)*BILI,(y2+JS)*BILI); for(x1=1,y1=1,x2=18;y1=18;y1+) line(x1+JZ)*BILI,(y1+JS)*BILI,(x2+JZ)*BILI,(y1+JS)*BILI); for(x1=1;x1=18;x1+) for(y1=1;y1=18;y1+) boxx1y1=0 ; void draw_circle(int x,int y,int color) setcolor(color); setlinestyle(SOLID_LINE,0,1); x=(x+JZ)*BILI ; y=(y+JS)*BILI ; circle(x,y,8); void judgekey() int i ; int j ; switch(key) case LEFT : if(step_x-1=1;i-) if(boxij=0) draw_circle(step_x,step_y,LIGHTBLUE); break ; if(i18) break ; else for(i=step_x+1,j=step_y;i18)break ; step_x=i ; judgewho(step_x,step_y); break ; case DOWN : if(step_y+1)18) break ; else for(i=step_x,j=step_y+1;j18)break ; step_y=j ; judgewho(step_x,step_y); break ; case UP : if(step_y-1)=1;j-) if(boxij=0) draw_circle(step_x,step_y,LIGHTBLUE); break ; if(j=1&step_x=1&step_y=1;j-) if(boxjk=flag) n1+; else break ; /*水平向右数*/ for(j=x,k=y;j=5) return(1); break ; /*垂直向上数*/ n1=0 ; n2=0 ; for(j=x,k=y;k=1;k-) if(boxjk=flag) n1+; else break ; /*垂直向下数*/ for(j=x,k=y;k=5) return(1); break ; /*向左上方数*/ n1=0 ; n2=0 ; for(j=x,k=y;j=1,k=1;j-,k-) if(boxjk=flag) n1+; else break ; /*向右下方数*/ for(j=x,k=y;j=18,k=5) return(1); break ; /*向右上方数*/ n1=0 ; n2=0 ; for(j=x,k=y;j=1;j+,k-) if(boxjk=flag)n1+; else break ; /*向左下方数*/ for(j=x,k=y;j=1,k=5) return(1); break ; return(0); break ; void main() int gdriver=VGA,gmode=VGAHI; clrscr(); attention(); initgraph(&gdriver,&gmode,c:tc); /* setwritemode(XOR_PUT);*/ flag=1 ; draw_box(); do step_x=0 ; step_y=0 ; /*draw_circle(step_x,step
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 【正版授权】 IEC 61196-1-128:2025 EN Coaxial communication cables - Part 1-128: Electrical test methods - Polarization directivity of radiating cable
- 【正版授权】 IEC 63182-7:2025 EN Magnetic powder cores - Guidelines on dimensions and the limits of surface irregularities - Part 7: EER-cores
- 辽宁省名校联盟2025年高三9月份联合考试 生物试卷(含答案解析)
- 人教版八年级英语上册Unit8达标测试卷(含答案)
- 热力学定律与能量守恒定律-2023年高考物理一轮重难点复习
- 重型门窗知识培训总结报告课件
- 老年人穿衣搭配课件
- 釉面瓷砖知识培训
- 统编版五年级道德与法治上册全册教案(表格式)
- CN120209222A 基于改性书写单体的光致聚合物体系、光栅器件及其制备方法
- GB/T 18348-2022商品条码条码符号印制质量的检验
- 第七届全国“学宪法、讲宪法”知识竞赛试题及答案
- GB/T 10325-2012定形耐火制品验收抽样检验规则
- 平行平板的多光束干涉
- 《大众传播学研究方法导论(第二版)》课件第二章 研究基础
- 萃智创新方法理论考试题库(含答案)
- 小学生视力检测登记表
- 植物生物技术绪论
- 时空大数据课件
- 机器视觉课件
- 客舱广播词的基本知识
评论
0/150
提交评论