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

如何編程五子棋盤

發布時間: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);

閱讀全文

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

熱點內容
華為pad攝像頭在哪個文件夾 瀏覽:147
手機版編程貓如何復制角色 瀏覽:599
動漫圖片的文件格式 瀏覽:560
黑衣緊身美女跳小蘋果 瀏覽:670
無法收縮資料庫 瀏覽:216
java中獲取二維數組的長度 瀏覽:510
手機裡面的數據線怎麼接 瀏覽:491
微信轉帳是紅包嗎 瀏覽:748
如何學會函數編程 瀏覽:985
js賦值高度 瀏覽:940
錄像機登錄密碼 瀏覽:94
中斷程序格式 瀏覽:543
微信電話本批量刪除聯系人 瀏覽:439
hp5200固件升級文件 瀏覽:176
除了問卷星還有哪裡收集數據 瀏覽:387
如何編程五子棋盤 瀏覽:747
微信相冊空間 瀏覽:839
蘋果怎麼刷回935 瀏覽:437
linux的模板文件在哪個文件夾 瀏覽:923
企業網路規劃拓撲圖 瀏覽:927

友情鏈接