用c语言编写五子棋的心得,用C语言编写的五子棋游戏.doc

用C语言编写的五子棋游戏

Code

#include

#include

#include

#include

#include

#include

#include

#define R 10 /*The size of mouse*/

void init(void); /* BGI initialization */

int cover(int); /*draw lines , set color, output the text*/

void get_board(void);

/*using the loop and the line function to draw the chessboard*/

void word(int); /*input word,the color is come from the rand*/

void getmouse(int *,int *,int *);

/*get the location and the button of mouse,key=1 is the left button,key=2 is the right button*/

void visbilemouse(void);

/*Display the mouse*//*after typing ,gets the x, y and mouse button,then return */

void mouse(int *,int *,int *);

/*drawing a mouse is to put an empty rectangular in the memory , then draw the shape of the mouse in the empty rectangular*/

void change_word(int); /*show the black or the white*/

void help(void); /*get playing help*/

void prompt(int); /*the cancel or quit*/

void game_player(void); /*how to realize the game*/

int main()

{

int key;

init();/*BGI initialization*/

key=cover(0); /*the welcome interface*/

while(key) /*only it is 1.it will running the loop*/

{

get_board(); /*draw the chessboard*/

game_player(); /*control or play the games*/

}

closegraph();

return 0;

}

void init() /* BGI initialization */

{

int graphdriver = DETECT, graphmode = 0;

/* The same effect with gd =VGA and gm = VGAHI */

registerbgidriver(EGAVGA_driver);

/* After register the BGI driver needn't the support of running the BGI */

initgraph(&graphdriver, &graphmode, "");

return;

}

int cover(int choose)

{

int row,col,i;

char answer;

switch(choose)

{

case 0:

setfillstyle(SOLID_FILL,BLUE); /*fill in the color*/

bar(630,450,10,30);

for(row=30;row<=180;row+=30) /*draw cross lines*/

line(10,row,160,row);

for(col=10;col<=180;col+=30) /*draw vertical lines

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

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值