资源简介
visual studio 2013 win32工程实现扫雷游戏程序。

代码片段和文件信息
#include “stdafx.h“
#include “MineMap.h“
#include
CMineMap::CMineMap()
: nMime(0)
winf(FALSE)
rMine(0)
{
mx = 20; my = 13;
nMime = 50;
}
CMineMap::~CMineMap()
{
}
void CMineMap::Create()
{
Map = new int*[mx];
int i j;
for (i = 0; i < mx; i++)
{
Map[i] = new int[my];
}
for (i = 0; i < mx; i++)
for (j = 0; j < my; j++)
Map[i][j] = 100;
srand(time(NULL));
for (i = 0; i < nMime; i++)
{
int m = rand() % mx;
int n = rand() % my;
if (Map[m][n] != 99)
Map[m][n] = 99;
else
i--;
}
for (i = 0; i < mx; i++)
for (j = 0; j < my; j++)
{
if (Map[i][j] == 99)
{
int m n;
for (m = -1; m < 2; m++)
for (n = -1; n < 2; n++)
{
if ((i + m >= mx) || (j + n >= my) || (i + m<0) || (j + n<0) || (Map[i + m][j + n] == 99))
continue;
Map[i + m][j + n]++;
}
}
}
winf = 1;
rMine = nMime;
first = 1;
timer = 0;
}
void CMineMap::LClinck(int m int n CRect*rc)
{
if (m >= mx || n >= my || m < 0 || n < 0 || Map[m][n] <= 90)
return;
if (m * 20 + 20>rc->right)
rc->right = m * 20 + 20;
if (m * 20 < rc->left)
rc->left = m * 20;
if ((n + 2) * 20 + 20 > rc->bottom)
rc->bottom = (n + 2) * 20 + 20;
if ((n + 2) * 20 < rc->top)
rc->top = (n + 2) * 20;
if (Map[m][n] >= 101 && Map[m][n] <= 108)
{
Map[m][n] -= 100;
first = 0;
return;
}
if (Map[m][n] == 100)
{
Map[m][n] -= 100;
LClinck(m - 1 n rc);
LClinck(m + 1 n rc);
LClinck(m n - 1 rc);
LClinck(m n + 1 rc);
LClinck(m - 1 n - 1 rc);
LClinck(m + 1 n - 1 rc);
LClinck(m - 1 n + 1 rc);
LClinck(m + 1 n + 1 rc);
}
if (Map[m][n] == 99)
{
if (first)
{
rMine--;
int a b t = 0;
for (a = -1; a < 2; a++)
for (b = -1; b < 2; b++)
{
if ((a + m < mx) && (b + n < my) && (a + m >= 0) && (b + n >= 0) && (a || b))
{
if (Map[a + m][b + n] > 99)
Map[a + m][b + n]--;
if (Map[a + m][b + n] == 99)
t++;
}
}
first = 0;
Map[m][n] = 100 + t;
LClinck(m n rc);
return;
}
int i j;
for (i = 0; i < mx; i++)
for (j = 0; j < my; j++)
{
if (Map[i][j] == 99)
Map[i][j] = -1;
if (Map[i][j]>49 && Map[i][j] < 60)
Map[i][j] = -2;
}
rc->bottom = (my + 2) * 20;
rc->right = mx * 20;
rc->left = 0;
rc->top = 0;
winf = 0;
}
}
void CMineMap::Onrbtdown(int m int n)
{
if (m >= mx || m < 0 || n >= my || n < 0)
return;
if (Map[m][n]>90)
{
Map[m][n] -= 50;
rMine--;
return;
}
if (Map[m][n] > 40 && Map[m][n] < 60)
{
rMine++;
Map[m][n] += 50;
}
}
void CMineMap::Onlbtdbc(int m int n CRect*rc)
{
if (m >= mx || m < 0 || n >= my || n < 0)
return;
if (Map[m][n] == ctnflag(m n))
{
LClinck(m - 1 n rc);
LClinck(m + 1 n rc);
LClinck(m n - 1 rc);
LClinck(m n + 1 rc);
LClinck(m - 1 n - 1 rc);
LClinck(m + 1 n - 1 rc);
LClinck(m - 1 n +
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
目录 0 2014-06-26 22:57 扫雷 - 副本\
目录 0 2014-06-26 22:52 扫雷 - 副本\扫雷\
目录 0 2014-06-26 22:57 扫雷 - 副本\扫雷\Debug\
文件 13013 2014-06-26 22:57 扫雷 - 副本\扫雷\Debug\MineMap.obj
文件 149115 2014-06-26 22:57 扫雷 - 副本\扫雷\Debug\stdafx.obj
文件 551936 2014-06-26 22:57 扫雷 - 副本\扫雷\Debug\vc120.idb
文件 520192 2014-06-26 22:57 扫雷 - 副本\扫雷\Debug\vc120.pdb
文件 1128 2014-01-27 11:11 扫雷 - 副本\扫雷\Debug\扫雷.Build.CppClean.log
文件 2297 2014-06-26 22:57 扫雷 - 副本\扫雷\Debug\扫雷.log
文件 38455 2014-06-26 22:57 扫雷 - 副本\扫雷\Debug\扫雷.obj
文件 6160384 2014-06-26 22:57 扫雷 - 副本\扫雷\Debug\扫雷.pch
文件 78776 2014-06-26 22:57 扫雷 - 副本\扫雷\Debug\扫雷.res
目录 0 2014-06-26 22:57 扫雷 - 副本\扫雷\Debug\扫雷.tlog\
文件 28846 2014-06-26 22:57 扫雷 - 副本\扫雷\Debug\扫雷.tlog\CL.read.1.tlog
文件 3134 2014-06-26 22:57 扫雷 - 副本\扫雷\Debug\扫雷.tlog\CL.write.1.tlog
文件 3962 2014-06-26 22:57 扫雷 - 副本\扫雷\Debug\扫雷.tlog\cl.command.1.tlog
文件 2924 2014-06-26 22:57 扫雷 - 副本\扫雷\Debug\扫雷.tlog\li
文件 6064 2014-06-26 22:57 扫雷 - 副本\扫雷\Debug\扫雷.tlog\li
文件 1352 2014-06-26 22:57 扫雷 - 副本\扫雷\Debug\扫雷.tlog\li
文件 850 2014-06-26 22:57 扫雷 - 副本\扫雷\Debug\扫雷.tlog\rc.command.1.tlog
文件 5724 2014-06-26 22:57 扫雷 - 副本\扫雷\Debug\扫雷.tlog\rc.read.1.tlog
文件 366 2014-06-26 22:57 扫雷 - 副本\扫雷\Debug\扫雷.tlog\rc.write.1.tlog
文件 181 2014-06-26 22:57 扫雷 - 副本\扫雷\Debug\扫雷.tlog\扫雷.lastbuildstate
文件 3618 2014-01-25 22:55 扫雷 - 副本\扫雷\MineMap.cpp
文件 372 2014-01-25 22:20 扫雷 - 副本\扫雷\MineMap.h
文件 2244 2014-01-25 13:23 扫雷 - 副本\扫雷\ReadMe.txt
文件 1270 2013-07-22 01:18 扫雷 - 副本\扫雷\bitmap1.bmp
文件 3126 2014-01-26 15:53 扫雷 - 副本\扫雷\resource.h
文件 2998 2014-02-09 19:53 扫雷 - 副本\扫雷\small.ico
文件 210 2014-01-25 13:23 扫雷 - 副本\扫雷\stdafx.cpp
文件 464 2014-01-25 18:15 扫雷 - 副本\扫雷\stdafx.h
............此处省略16个文件信息
- 上一篇:微波技术与天线 课后答案
- 下一篇:基于RFID的智能档案管理系统的设计与实现
相关资源
- zlib 最新 1.2.8 win32 win64 编译好的dll
- linux扫雷游戏代码
- 扫雷(MVC架构)
- Win32 API大全.chm
- eetop.cn_eetop.cn_hfss15_win32crack
- VS2010、VS2012、VS2013代码自动注释插件
- nginx-rtmp-win32-master.rar
- 通过x264录制RGB屏幕视频vs2013工程,
- sunxi-tools-win32-support_f1c100s_32M(32M fl
- ipscan-win32
- ffplay_win32
- FFmpeg-3.1 windows vs2013编译动态库静态库
- cmake-3.7.0-win32-x86.zip官方绿色包
- 使用ffmpeg将多张图片生成H264裸流并获
- ffmpeg-vs2013
- ffmpeg-3.2-win32-shared.zip
- windows32位系统的ffmpeg
- ffmpeg-2.5.2-win32-shared
- OpenCC-1.0.5-Win32
- Notepad++的Json格式化插件win32和x64两版
- Eclipse64位4.3开普勒版eclipse-standard-ke
- award_bios_editor1.2_win32.zip
- Eclipse64位4.3.2开普勒版eclipse-jee-keple
- ninja(windows 32/64位)
- ffmpeg-4.0.2最新版 windows vs2013编译动态
- ffmpeg-4.2.1-win32-dev.zip
- .Net Reflector 8.2.0.42破解版 支持vs2013
- OpenCV3.3+contrib-master,VS2013编译后的l
- Eclipse64位4.3开普勒版eclipse-jee-kepler-
- Eclipse32位4.3开普勒版eclipse-standard-ke
评论
共有 条评论