Application of Data Structure stack-maze

Source: Internet
Author: User

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]<< <<<<>><<>><<>><<>> 

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.