请问高手 如何构建图像上的 迷宫 一下是我 初步做到的 代码,不知道该怎么写下去了....
#include <string>
#include "ccc_win.h" // for graphics classes and functions
const int MAZE_SIZE = 16;
using namespace std;
class MazeSquare
{
public:
bool leftWall, rightWall, bottomWall, topWall;
bool visited;
int steps;
MazeSquare() // constructor
{
Initialise();
}
void Initialise(void) // reinitialise a square for a new maze
{
leftWall = true; // create the maze square with all the walls
rightWall = true;
bottomWall = true;
topWall = true;
visited = false; // the robot has not visited the square yet
steps = 256; // greater than maximum possible number of steps
}
};
void CreateMaze(MazeSquare maze[MAZE_SIZE][MAZE_SIZE])
{
for (int i = 0; i < MAZE_SIZE; i++)
{
cwin <<
}
}
int ccc_win_main() // main function for a graphics program
{
MazeSquare maze[MAZE_SIZE][MAZE_SIZE]; // maze design
int x = 0, y = 0; // robot position
bool exit = false; // flag to control end of program
// initialise the random number generator
srand((unsigned int)(time(NULL)));
cwin.coord(-3,22,22,-4);
PenWidth pen3 = PenWidth(2);
PenColour blackPen = PenColour(0, 0, 0);
Point origin(0,0);
Point p1(0,16);
Point p2(16,0);
Point p3(16,16);
Circle smallCircle(origin,0.5);
// graphics object.
Line down_horizontal(origin,p2);
Line top_horizontal(p2,p3);
Line vertical_left(origin,p1);
Line vertical_right(p1,p3);
// draw the maze.
cwin << pen3 << blackPen << down_horizontal << top_horizontal << vertical_left << vertical_right;
Point p = cwin.get_mouse("Click a button or move the robot");
CreateMaze(maze);
return 0;
}