This uses some C ++ knowledge, because it requires some knowledge of dynamically creating arrays and classes.
I used to have a headache when I encountered a similar problem, and I am not willing to write it. But now I feel that I only need to spend time,
It is not that difficult to write. Although it is perfect to write at one time, it is impossible to make no mistakes, but it can also feel happy in the Process of debugging errors.
Considering the time saving, I randomly generated a map, and the matrix size can be input. 1 is accessible, and 0 is inaccessible.
The code is not perfect for what I want. For example, currently, only one route can be searched, and there is no idea for multiple routes.
The main idea of code is to press the stack and exit the stack.
<iostream><stdlib.h><time.h> orientationNum 4 MazeMapLineNumber = Node **~= pBottom = ->pNext = (pTop == = ->Pos =->pNext ==(!== p-> cout<<<<=(p->pNext !=<<<<p->Pos.xcoordinate<<<<p->Pos.ycoordinate<<= p-><<<<p->Pos.xcoordinate<<<<p->Pos.ycoordinate<< pTop->(!~(pos.ycoordinate< || pos.ycoordinate>=||pos.xcoordinate< || pos.xcoordinate>= (pos1.xcoordinate == pos2.xcoordinate &&== pos2.ycoordinate) PassMaze( ***MazeWay = = i = IsFind = ->((!MazeWay->IsNull())&&(! CurPos = MazeWay->= (i=;i<orientationNum;i++( == NewPos.xcoordinate == CurPos.ycoordinate+( == NewPos.xcoordinate = CurPos.xcoordinate+=( == NewPos.xcoordinate == CurPos.ycoordinate-( == NewPos.xcoordinate = CurPos.xcoordinate-=(!isOutOfborder(NewPos) &&= == -> MazeWay->(MazeWay-><<<< MazeWay-> i=,j=<<>> **pMap = * (i=;i<MazeMapLineNumber;i++= (i=;i<MazeMapLineNumber;i++ (j=;j<MazeMapLineNumber;j++= rand()%<<pMap[i][j]<< <<<<>><<>><<>><<>>