![]() |
|
[.NET] Maze Generator Revamped [Backtrack Maze Algorithm & A* Pathfinding] - Printable Version +- Hack Forums (https://hackforums.net) +-- Forum: Tech (https://hackforums.net/forumdisplay.php?fid=444) +--- Forum: Coding (https://hackforums.net/forumdisplay.php?fid=151) +---- Forum: Software Development (https://hackforums.net/forumdisplay.php?fid=118) +---- Thread: [.NET] Maze Generator Revamped [Backtrack Maze Algorithm & A* Pathfinding] (/showthread.php?tid=5796050) |
Maze Generator Revamped [Backtrack Maze Algorithm & A* Pathfinding] - Barret - Feb 6, 2018 ![]() ![]() ![]() ![]() 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
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 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 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)Update: Added a build-in solver, example is included inside the source files Github: https://github.com/TheBarret/Maze-Generator-Framework have fun! - B RE: Maze Generator Revamped - sh@rp - Feb 7, 2018 Hey thank you mate I will generate few one and print them for my children. You are my idol bro ✌ RE: Maze Generator Revamped - 0xDEAD10CC - Feb 8, 2018 This is pretty cool, I remember seeing someone else post a maze generating algorithm here a long while back but I can't remember who it was. :) Why did you use a scrollbar for the tracker though? https://msdn.microsoft.com/en-us/library/system.windows.forms.trackbar%28v=vs.110%29.aspx?f=255&MSPPError=-2147217396 RE: Maze Generator Revamped - HFDone - Feb 8, 2018 (Feb 8, 2018 12:22 AM)0xDEAD10CC Wrote: This is pretty cool, I remember seeing someone else post a maze generating algorithm here a long while back but I can't remember who it was. :) op https://hackforums.net/showthread.php?tid=5546640 RE: Maze Generator Revamped - 0xDEAD10CC - Feb 8, 2018 (Feb 8, 2018 03:14 AM)HFDone Wrote: op https://hackforums.net/showthread.php?tid=5546640 No I mean back in probably 2011. I've been on this forum a long time. RE: Maze Generator Revamped [With Solver] - Barret - Feb 8, 2018 Updated the project with an A* solver build-in. ![]()
RE: Maze Generator Revamped [Backtrack Maze Algorithm & A* Pathfinding] - VmX5 - Feb 10, 2018 Woah this looks pretty cool too! Love how it shows the solution instantly when it generates the maze. |