规则:
1.鼠标左击选择(nXn)5X5,7X7,9X9方阵,分别含(m)5个,9个,15个地雷
2.鼠标左击灰色小方格,若为雷,显示红色,游戏失败,若非雷,显示绿色并显示方格附近八个方格中的非地雷方格,在方格中标注每个方格附近八个方格的地雷总数。鼠标右击灰色小方格,方格则被标记为地雷,显示红色,左侧地雷总数提示区,地雷数-1,若出现错误标记,则将等用户的地雷标记第m+1个时,自动展开全盘且游戏失败。
3.凡是已经展开或被红色标记的小方格再次点击无效
4.胜利:当所有地雷被右击选出,且无多选,错选,游戏获胜,记录最佳成绩,调整胜率(胜率=游戏获胜次数/总次数)。否则,判定游戏失败
5.每轮游戏结束展开所有方格,被错误标记为地雷的方格带"X"符号,正确标记地雷的方格带"V"符号,没被标记但含地雷的方格展开为红色,其余方格皆展开为绿色且标注周围八个方格地雷总数
6.鼠标左击
“>Exit”,退出游戏,
“>Back”,返回上一界面,
“>Agin”,直接开始新一轮的该难度的游戏
7.游戏初始成绩和胜率皆为0
8.避免初次踩中雷功能(点击初次即踩中雷,方格会自动重新生成,耗时略长)
鼠标左键点击Play,进入游戏
以5X5难度为例(此难度含5个地雷),鼠标左键点击进入
鼠标左键点击"Exit"选择退出游戏
7X7,9X9难度情况(分别含9个,15个地雷)
背景音乐——>【点击获得】提取码:8fx2
(将音乐的MP3文件放入与.sln同个文件夹即可)
#include<stdio.h>
#include<graphics.h>
#include<conio.h>
#include<string>
#include<cstring>
#include<time.h>
#include<stdlib.h>
#pragma comment(lib,"Winmm.lib")
using namespace std;
int sum[3] = {
5,9,15 }, arr1[10][10] = {
0 }, arr2[10][10] = {
0 };
double times[3] = {
0 }, time_win[3] = {
0 }, PR_win[3] = {
0 }, record[3] = {
0 };
int Start(void)
{
int choice = 0, i = 0;
TCHAR s[] = _T("Minesweeper测"), s1[] = _T("> Play"), s2[] = _T("> Exit");
initgraph(924, 724);
setbkcolor(WHITE);
settextstyle(70, 50, _T("Consolas"));
settextcolor(BLACK);
setbkmode(TRANSPARENT);
cleardevice();
outtextxy(152, 184, s);
settextstyle(40, 20, _T("Consolas"));
outtextxy(392, 384, s1);
outtextxy(392, 452, s2);
while (1)
{
MOUSEMSG M = GetMouseMsg();
if (M.x >= 392 && M.x <= 512 && M.y >= 384 && M.y <= 424)
{
i = 1;
settextcolor(RED);
outtextxy(392, 384, s1);
if (M.mkLButton)
{
choice = 1;
break;
}
}
else if (M.x >= 392 && M.x <= 512 && M.y >= 452 && M.y <= 492)
{
i = 1;
settextcolor(RED);
outtextxy(392, 452, s2);
if (M.mkLButton)
{
choice = 2;
break;
}
}
else if(i)
{
settextcolor(BLACK);
outtextxy(392, 384, s1);
outtextxy(392, 452, s2);
i = 0;
}
}
return choice;
}
int Level(void)
{
cleardevice();
mciSendString(L"open .\\start.mp3 alias start", NULL, 0, NULL);
mciSendString(L"play start repeat", NULL, 0, NULL);
int n = 0, i = 0;
TCHAR s1[] = _T("5X5"), s2[] = _T("7X7"), s3[] = _T("9X9"), s4[] = _T("< Back");
setfillcolor(GREEN);
setlinecolor(GREEN);
settextcolor(WHITE);
settextstyle(60, 60, _T("Consolas"));
setbkmode(TRANSPARENT);
fillrectangle(167, 62, 347, 262);
outtextxy(172, 132, s1);
fillrectangle(372, 62, 552, 262);
outtextxy(377, 132, s2);
fillrectangle(577, 62, 757, 262);
outtextxy(582, 132, s3);
settextcolor(BLACK);
settextstyle(40, 20, _T("Consolas"));
outtextxy(100, 524, s4);
while (1)
{
MOUSEMSG M = GetMouseMsg();
if (M.x >= 167 && M.x <= 347 && M.y >= 62 && M.y <= 262)
{
i = 1;
settextcolor(WHITE);
settextstyle(70, 70, _T("Consolas"));
fillrectangle(157, 52, 357, 272);
outtextxy(162, 122, s1);
if (M.mkLButton)
{
n = 5;
break;
}
}
else if (M.x >= 372 && M.x <= 552 && M.y >= 62 && M.y <= 262)
{
i = 1;
settextcolor(WHITE);
settextstyle(70, 70, _T("Consolas"));
fillrectangle(362, 52, 562, 272);
outtextxy(367, 122, s2);
if (M.mkLButton)
{
n = 7;
break;
}
}
else if (M.x >= 577 && M.x