![在这里插入图片描述](https://img-blog.csdnimg.cn/20200227200854661.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3dlaXhpbl80NDIxMTk4MA==,size_16,color_FFFFFF,t_70)
【实现代码】
#include <cmath>
#include <time.h>
#include <easyx.h>
#include <conio.h>
using namespace std;
#define Size 500
#define SquareSize 50
#define BackGroundColor LIGHTGRAY
const int N = Size / SquareSize;
const int Num = N * N / 5;
int num = Num, all = N * N - Num;
int Map[N + 10][N + 10];
bool vis[N + 10][N + 10];
bool vis_lm[N + 10][N + 10];
int dx[] = {
0, 0, 1, -1, 1, -1, 1, -1 };
int dy[] = {
1, -1, 0, 0, 1, -1, -1, 1 };
void Init() {
initgraph(Size, Size);
setbkcolor(BackGroundColor);
settextcolor(YELLOW);
settextstyle(25, 0, _T("宋体"));
cleardevice();
}
void BuildGameMap() {
srand((unsigned int