c语言计时棋类程序,C语言程序设计小棋类游戏

匿名用户

1级

2012-05-12 回答

/*加载头文件*/

#include

#include

#include

#include

#include

/*编译预处理,定义按键码*/

#define LEFT 0x4b00

#define RIGHT 0x4d00

#define DOWN 0x5000

#define UP 0x4800

/*若想在游戏中途退出, 可按 Esc 键*/

#define ESC 0x011b

/*SPACE键表示落子*/

#define SPACE 0x3920

/*设置偏移量*/

#define OFFSET 20

#define OFFSET_x 4

#define OFFSET_y 3

/*定义数组大小*/

#define N 19

/*定义全局变量*/

int status[N][N]; /*定义的数组,保存状态*/

int step_x,step_y;/*行走的坐标*/

int key ; /*获取按下的键盘的键*/

int flag; /*玩家标志*/

/*自定义函数原型*/

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("1.You can use the up,down,left and right key to move the chessman,");

gotoxy(12,8);

printf(" and you can press Space key to enter after you move it !");

gotoxy(12,10);

printf("2.You can use Esc key to exit the game too !");

gotoxy(12,12);

追问:

要能运行的代码

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值