Feb 6, 2018 08:10 PM
(This post was last modified: Feb 10, 2018 11:02 AM by Barret.)
![[Image: xIRp0xJ.gif]](https://i.imgur.com/xIRp0xJ.gif)
![[Image: H0Bgtg0.gif]](https://i.imgur.com/H0Bgtg0.gif)
![[Image: BoTgV26.png]](https://i.imgur.com/BoTgV26.png)
![[Image: YiyeHLO.png]](https://i.imgur.com/YiyeHLO.png)
In the past i made a maze generator that wasn't quit the result i always wanted but since i'm doing a lot of path finding projects i started to make
another maze generator from the ground up that supports a node framework that makes life easy for path finding code to adapt and implement.
This version performs quit a bit faster and has nodes that have a somewhat richer functions set attached to them.
Setting up
Code
Dim maze = New Maze.Generator(NodesX, NodesY, Bounds)Making new mazes
Code
Maze.Randomize()Functions
- All Nodes have their own pencils (color, size, style)
- All Nodes have an 'Access' field that can be set (Start, End, Solid, Open, etc)
- All nodes have fields that can identify them by row, column, index
From each node you can test if the next node is accessible, ie no walls.
Code
Public Function IsAccessible(target As Node) As BooleanYou can also test if a position is within a certain node
Code
Public Function IsInside(point As Point) As BooleanFetch a neighbour node from either index or direction (north, south, etc)
Code
Public Function GetNeighbourAt(direction As Direction) As Node
Public Function GetNeighbourAt(index As Integer) As NodeFetch all neighbours
Code
Public Function GetNeighbours() As Node()Test if the node has a neighbour on given parameter
Code
Public Function HasNeighbourAt(direction As Direction) As Boolean
Public Function HasNeighbourAt(index As Integer) As BooleanGet the pixel distance between two nodes
Code
Public Function GetDistance(target As Node) As DoubleGet the center of a node
Code
Public ReadOnly Property Center As PointSmall example
Code
Dim start As Node = Me.Maze.Nodes(0, 0)
If (start.HasNeighbourAt(Direction.East)) Then
If (start.IsAccessible(start.GetNeighbourAt(Direction.East))) Then
'//...we can move east
End If
End IfUpdate: Added a build-in solver, example is included inside the source files
Github: https://github.com/TheBarret/Maze-Generator-Framework
have fun!
- B



![[Image: dRmLrlo.png]](https://i.imgur.com/dRmLrlo.png)