導航:首頁 > 編程知識 > 如何編程五子棋盤

如何編程五子棋盤

發布時間:2025-08-21 15:07:41

❶ c語言編的五子棋源代碼

程序前半部分
/*載入頭文件*/
#include<stdio.h>
#include<stdlib.h>
#include<graphics.h>
#include<bios.h>
#include<conio.h>
/*編譯預處理,定義按鍵碼*/
#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);

閱讀全文

與如何編程五子棋盤相關的資料

熱點內容
網路中常用的傳輸介質 瀏覽:518
文件如何使用 瀏覽:322
同步推密碼找回 瀏覽:865
樂高怎麼才能用電腦編程序 瀏覽:65
本機qq文件為什麼找不到 瀏覽:264
安卓qq空間免升級 瀏覽:490
linux如何刪除模塊驅動程序 瀏覽:193
at89c51c程序 瀏覽:329
怎麼創建word大綱文件 瀏覽:622
裊裊朗誦文件生成器 瀏覽:626
1054件文件是多少gb 瀏覽:371
高州禁養區內能養豬多少頭的文件 瀏覽:927
win8ico文件 瀏覽:949
仁和數控怎麼編程 瀏覽:381
項目文件夾圖片 瀏覽:87
怎麼在東芝電視安裝app 瀏覽:954
plc顯示數字怎麼編程 瀏覽:439
如何辨別假網站 瀏覽:711
寬頻用別人的賬號密碼 瀏覽:556
新app如何佔有市場 瀏覽:42

友情鏈接