Giter Site home page Giter Site logo

heart_maze's Introduction

找到爱心的边框

Image

image2

image2

生成迷宫的算法

广度优先遍历,先进先出,可用队列来解决。
深度优先遍历,先进后出,可用堆栈来解决。
stack和queue的区别就是

代码都是一样的,其实就是出栈的顺序不一样。stack是先进来的后出去,queue是先进来的先出去。因为顺序不一样,所以就产生了深度优先遍历和广度优先遍历。

迷宫生成的算法就是,结合广度优先和深度优先算法,随机进队列,随机出队列。

说明

“空” 代表的是Scene area,场景区【辅助区】

转换

队列也是一种特殊的线性表,是一种先进先出的线性表。允许插入的一端称为表尾,允许删除的一端称为表头
排在前面的先出,排在后面的后出。换句话,先进的先出,后进额后出。我们在队尾插入数据,队头删除数据。

cpp:

	void initQueue(SqQueue &Q)
	Q.data

c:
	
	void initQueue(SqQueue *Q)
	Q->data


//为了避免当只有一个元素时,队头与队尾重合,影响我们的操作。所以,我们引入了front、rear指针。

typedef struct {
Block *data;//存入的结构体数据
int front;//front指向第一个元素的位置
int rear;//rear指向最后一个元素的下一个位置。
}SqQueue;

参考文档

https://github.com/neolay/HeartMaze

heart_maze's People

Contributors

zouhuigang avatar

Watchers

James Cloos avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.