文档介绍:他京左地化工替院
Beijing Institute of Petrocherricai Technology
计算机程序设计基础(C语言)课程设计
题目:简易五子棋软件设计
院(系、部): 信§工程位
姓 名:
班 级:
是否为5个
Step3退出函数
开始
break
课程设计用纸
北京石油化工学院 BEIJING INSTITUTE OF PETROCHEMICAL TECHNOLOGY
函数done ( )
Stepl:根据不同key值进行不同操作
Step2:判断下一步是否超边界
Step3:在空白的地方落棋子
七程序测试
#include<>
#include<>
#include<>
#include<>
#include<>
#include<>
/*编译预处理,定义按键码*/
#define LEFT 0x4b00 /* 左移—方向键 left*/
#define RIGHT 0x4d00 /* 右移—方向键 right*/
#define DOWN 0x5000 /* 下移--方向键 down*/
#define UP 0x4800 /* 上移--方向键 up*/
#define ENTER 0x1c0d /*ENTER键表示落子 */
/*若想在游戏中途退出,可按Esc键*/
#define ESC 0x011b
/*设置偏移量*/
#define OFFSET 20
#define OFFSET_x 4
#define OFFSET_y 3
/*定义数组大小*/
#define N 16
/*定义全局变量*/
int status[N][N]; /*定义的数组,保存状态*/
int step_x,step_y; /* 行走的坐标 */
int key ; /*获取按下的键盘的键*/
int flag; /*玩家标志*/
/*自定义函数原型*/
void music();
void WinMusic();
void DrawBoard();
void DrawCircle(int x,int y,int color);
void Alternation();
void JudgePlayer(int x,int y);
void Done();
int ResultCheck(int x,int y);
void WelcomeInfo();
void ShowMessage();
/*定义函数*/
/*显示欢迎信息函数*/
void WelcomeInfo()
{
char ch ;
/*移动光标到指定位置*/
gotoxy(12,4);
/*显示欢迎信息*/
printf("Welcome you to gobang word!");
gotoxy(12,6);
printf(" can use the up,down,left and right key to move the
chessman,");
gotoxy(12,8);
printf(" and you can press ENTEFkey to enter after you moveit !");
课程设计用纸
北京石油化工学院 BEIJING INSTITUTE OF PETROCHEMICAL TECHNOLOGY
gotoxy(12,10);
printf(" can use Esc key to exit the game too !");
gotoxy(12,12);
printf(" not move the pieces out of the chessboard !");
gotoxy(12,14);
printf("Game Producer: ********Student Number:****** school:BIPT");
gotoxy(12,16);
printf("DO you want to continue