DimonSmart.MazeGenerator
2.0.0
Prefix Reserved
dotnet add package DimonSmart.MazeGenerator --version 2.0.0
NuGet\Install-Package DimonSmart.MazeGenerator -Version 2.0.0
<PackageReference Include="DimonSmart.MazeGenerator" Version="2.0.0" />
<PackageVersion Include="DimonSmart.MazeGenerator" Version="2.0.0" />
<PackageReference Include="DimonSmart.MazeGenerator" />
paket add DimonSmart.MazeGenerator --version 2.0.0
#r "nuget: DimonSmart.MazeGenerator, 2.0.0"
#:package DimonSmart.MazeGenerator@2.0.0
#addin nuget:?package=DimonSmart.MazeGenerator&version=2.0.0
#tool nuget:?package=DimonSmart.MazeGenerator&version=2.0.0
MazeGenerator
Demo online: https://dimonsmart.github.io/Demo/
MazeGenerator is a lightweight C# library for generating, visualizing, and solving mazes. The repo ships with a single CLI sample that walks through three small scenarios so you can verify the workflow without extra plumbing.
Highlights
- Deterministic generation – control maze density via
MazeBuildOptions(WallShortness,Emptiness). - Pathfinding out of the box –
MazeWaveGenerator+MazePathBuilderproduces the shortest path. - Extensible plotters – plug in your own
IMazePlotter,IWavePlotter, orIPathPlotterto render progress in any UI. - Broad runtime support – the library multi-targets
net6.0,net7.0,net8.0,net9.0, andnet10.0.
Quick start
Run the text-mode sample (it plays all three scenarios back-to-back):
git clone https://github.com/DimonSmart/MazeGenerator.git
cd MazeGenerator
dotnet run --project QuickStartDemo --framework net8.0
You will see:
- Example 1 – default 9×9 generation.
- Example 2 – generation with
MazeBuildOptionsand a customIMazePlotterimplementation. - Example 3 – wave propagation + reconstructed path (shows
S,E, and*).
The source lives in QuickStartDemo/Program.cs.
Use the library in your app
Install the package
dotnet add package DimonSmart.MazeGeneratorDefine a cell type (implements
ICell, has a public parameterless constructor):public sealed class TutorialCell : ICell { private bool _isWall; public bool IsWall() => _isWall; public void MakeWall() => _isWall = true; }Generate a maze, compute a wave, and reconstruct the path:
var maze = new Maze<TutorialCell>(31, 21); var options = new MazeBuildOptions(WallShortness: 0.15, Emptiness: 0.05); new MazeBuilder<TutorialCell>(maze, options).Build(); var start = new Point(1, 1); var end = new Point(maze.Width - 2, maze.Height - 2); var wave = new MazeWaveGenerator<TutorialCell>(maze).GenerateWave(start.X, start.Y, end.X, end.Y); var path = new MazePathBuilder(wave).BuildPath();Render however you like – iterate over
mazeto print ASCII (see the QuickStart demo) or handle plotter callbacks:var plotter = new MyConsolePlotter(); await new MazeBuilder<TutorialCell>(maze).BuildAsync(plotter); await new MazeWaveGenerator<TutorialCell>(maze, plotter).GenerateWaveAsync(start.X, start.Y, end.X, end.Y); await new MazePathBuilder(wave, plotter).BuildPathAsync();
MazeBuildOptions cheatsheet:
WallShortness– probability of interrupting long straight walls (higher value → twistier mazes).Emptiness– probability of skipping a wall entirely (higher value → more open space).
Included demo
- QuickStartDemo – prints three compact scenarios (defaults, custom plotter, pathfinding). Run
dotnet run --project QuickStartDemo --framework net10.0to validate the latest runtime.
Key types
Maze<TCell>– holds the grid and exposes boundary validation.MazeBuilder<TCell>– carves the maze; accepts optionalIMazePlottercallbacks and cancellation tokens.MazeWaveGenerator<TCell>– propagates a Lee-style wave until it hits the target or exhausts the grid.MazePathBuilder– walks the wave back to produce aMazePathwith orderedPathCellinstances.- Plotter interfaces (
IMazePlotter,IWavePlotter,IPathPlotter) – override sync or async methods depending on how you want to render progress.
Compatibility & testing
- Library multi-targets
net6.0; net7.0; net8.0; net9.0; net10.0. - QuickStartDemo targets
net6.0,net8.0, andnet10.0to ensure downstream apps compile cleanly across LTS and the latest SDK. DimonSmart.MazeGenerator.Tests(xUnit,net8.0) checks border generation plus wave/path reconstruction so regressions are caught automatically.dotnet build MazeGenerator.slnsucceeds on .NET SDK 10.0.101 (checked on 2025-12-10).
Contributing
Issues and pull requests are welcome. Please include a short description of the scenario you verified (QuickStart example number, custom UI, etc.) so regressions stay easy to triage.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net6.0 is compatible. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 is compatible. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 is compatible. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net10.0
- No dependencies.
-
net6.0
- No dependencies.
-
net7.0
- No dependencies.
-
net8.0
- No dependencies.
-
net9.0
- No dependencies.
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 2.0.0 | 492 | 12/10/2025 |
| 1.25627.1545 | 4,470 | 6/27/2025 |
| 1.25609.1440 | 936 | 6/9/2025 |
| 1.25218.855 | 796 | 2/18/2025 |
| 1.25217.1721 | 163 | 2/17/2025 |
| 1.25207.1243 | 191 | 2/7/2025 |
| 1.24817.745 | 461 | 8/17/2024 |
| 1.24812.924 | 211 | 8/12/2024 |
| 1.24808.2114 | 213 | 8/8/2024 |
| 1.24807.2038 | 176 | 8/7/2024 |
| 1.24807.1946 | 187 | 8/7/2024 |
| 1.24806.2143 | 153 | 8/6/2024 |
| 1.24806.2056 | 156 | 8/6/2024 |
| 1.24804.1641 | 137 | 8/4/2024 |
| 1.24801.1815 | 176 | 8/1/2024 |
| 1.24801.1531 | 155 | 8/1/2024 |
| 1.24801.1520 | 160 | 8/1/2024 |
| 1.24731.1325 | 131 | 7/31/2024 |
| 1.24731.1030 | 147 | 7/31/2024 |
| 1.24731.1007 | 141 | 7/31/2024 |
| 1.24731.939 | 140 | 7/31/2024 |
| 1.24731.929 | 118 | 7/31/2024 |