C语言课程设计实验报告- 联系客服

发布时间 : 星期六 文章C语言课程设计实验报告-更新完毕开始阅读97194b940129bd64783e0912a216147916117e50

5

(3)获胜界面 5.出现的问题及解决方法 (1)游戏开始时,棋子原来初始在棋盘中央,一旦中央落子后,初始棋子与已有棋子重叠,为了解决问题将初始棋子移动到棋盘左上方棋盘以外。 (2)棋子都为空心圆,在棋盘不好区分正在控制的棋子,改为已确定落子的棋子为实心圆,正在控制的棋子为空心圆。 附件A 沈阳工业大学实验报告

6

(适用计算机程序设计类)

专业班级: 计专1502 学号:248150203 姓名: 孙奇

实验程序:

本程序在Windows XP SP3操作系统及Turbo C 2.0开发环境下调试通过。 #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 SIZE 19

int box[SIZE][SIZE]; int step_x,step_y; int key; int flag=1;

void attentoin(); void draw_box();

void draw_cicle(int x,int y,int color); void draw_slice(int x,int y,int color); void change();

void judgewho(int x,int y); void judgekey();

int judgeresult(int x,int y);

void attention() { char ch; window(1,1,80,25); textbackground(LIGHTBLUE); textcolor(YELLOW); clrscr(); gotoxy(15,4);

7

printf(\ gotoxy(15,8); printf(\ gotoxy(15,12); printf(\ gotoxy(15,16); printf(\ gotoxy(15,20); printf(\ 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(\ 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++) box[x1][y1]=0; }

8