![在这里插入图片描述](https://i-blog.csdnimg.cn/blog_migrate/512bd8d4b14a4435635b21f3a03b867c.png)
【实现代码】
#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)time(