Recently heard that the data structure and algorithm practice teacher again out of the same topic as the previous year, can not help but think of the last time I finished homework when the point drops, regret at that time did not write the habit of blogging, some of the previous experience this year the past also gradually forgotten, suddenly have a summary of the idea, hoping to have a new harvest it.
Because at that time also did not pay attention to save, the software completed the process of some documents have been lost, fortunately, WinForm version of the source code is still in, Unity3d version of the program also survived, although due to time tension only completed the approximate framework, but the aesthetic degree is far from WinForm can compare, first on a few software diagram bar:
Generation algorithm
Software realizes the premium Manaus algorithm, recursive backtracking algorithm, recursive segmentation algorithm and depth traversal graph algorithm four kinds of algorithms to complete the maze generation, the first two algorithms generated by the maze is essentially a two-dimensional matrix network form of the spanning tree, which means that there is no loop, At the same time from the bottom left to every point in the maze and there is only one path, recursive segmentation method, although not a spanning tree algorithm but also belongs to the maze generation algorithm without loops, the depth traversal graph algorithm is derived from the knowledge on-line paper, which is the depth of the graph traversal algorithm, the resulting maze more random, more than one path, But I have to say that appearance is quite poor indeed.
Premium Manaus algorithm Maze (Prim)
Recursive segmentation algorithm ( Recursive Division)
Recursive backtracking (Recursive backtracker)
Depth traversal graph (deep traversal graph)
pathfinding algorithm
As for the pathfinding algorithm, the software realizes depth-first traversal, breadth-first traversal, and A-star three kinds of algorithms, the first two kinds of self-needless to say, A-star algorithm is a heuristic search algorithm, Moving will assess the expected cost of walking to the surrounding eight direction, the real-time selection of a smaller cost of movement direction, but because the maze is a square maze and start and end fixed to the top left and right, so in this project, the A-star algorithm does not play its due wit, efficiency and breadth first basically the same. The latter two algorithms can find the shortest path, and the depth first will not show. Green is the correct route in the figure, and blue is the route that passes during the pathfinding process. (PS: Set for depth breadth four-direction movement, A-star eight-direction movement)
depth-first traversal (DFS)
 
 
a-star
because of the particularity of the Labyrinth entrance exit location in the instance, the breadth first must go completely in the path-finding process, and it seems somewhat less witty
This article is a review, the following algorithm will be divided into a separate chapter.
[Algorithmic practice in the maze] summary of a data structure and algorithm practice work