c語言掃雷程式
主要建立兩個棋盤,乙個用於布置雷,乙個用於顯示雷
棋盤1用於排雷,棋盤2用於布置雷,此時設定80個雷用於測試,遊戲開始選擇隱藏23行布置雷**,就可以隱藏棋盤2,此時由於測試選擇不隱藏根據顯示座標輸入5 7,即可測試程式是否正常
輸入對應座標除錯程式,顯示排雷成功
測試程式
#define _crt_secure_no_warnings 1
#include
#include
"game.h"
void
menu()
void
game()
void
test()
//...
}while
(input);}
intmain()
遊戲函式
#define _crt_secure_no_warnings 1
#include
"game.h"
void
initboard
(char arr[rows]
[cols]
,int rows,
int cols,
char set)}}
void
displayboard
(char arr[rows]
[cols]
,int row,
int col)
printf
("\n");
for(i =
1; i <= row; i++
)printf
("\n");
}}void
setmine
(char mine[rows]
[cols]
,int row,
int col)}}
intgetminecount
(char mine[rows]
[cols]
,int x,
int y)
void
findmine
(char mine[rows]
[cols]
,char show[rows]
[cols]
,int row,
int col)
else
}else}if
(win == row*col - easy_count)
}
標頭檔案
#include
#include
#include
#define row 9
#define col 9
#define rows row+2
#define cols col+2
#define easy_count 80
//初始化棋盤
void
initboard
(char arr[rows]
[cols]
,int rows,
int cols,
char set)
;//列印棋盤
void
displayboard
(char arr[rows]
[cols]
,int row,
int col)
;//設定雷
void
setmine
(char mine[rows]
[cols]
,int row,
int col)
;//排查雷
void
findmine
(char mine[rows]
[cols]
,char show[rows]
[cols]
,int row,
int col)
;
C 實現掃雷程式開發
c 程式開發實現掃雷遊戲,供大家參考,具體內容如下 掃雷的類的定義 pragma once class game 地圖 int map 40 40 地圖的大小size size int size 10 容錯 int fault tolerant 10 困難程度 int difficulty 1 初始...
VC 掃雷程式
今年最後一天上班,閒的無聊,研究了下掃雷,瞬間把我手動記錄181秒提高到1秒 winmine.h inte ce for the cwinmine class.if defined afx winmine h a4a77ae4 c744 4838 b6f9 bb4b52188135 included...
C語言掃雷控制台程式
c語言寫的,花了一天時間,一次只能翻一張,就這樣吧 include include include include include include typedef struct saolei sl typedef struct xy xy sl p xy xy 設定顏色 void set color...