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
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="DimonSmart.MazeGenerator" Version="2.0.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="DimonSmart.MazeGenerator" Version="2.0.0" />
                    
Directory.Packages.props
<PackageReference Include="DimonSmart.MazeGenerator" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add DimonSmart.MazeGenerator --version 2.0.0
                    
#r "nuget: DimonSmart.MazeGenerator, 2.0.0"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package DimonSmart.MazeGenerator@2.0.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=DimonSmart.MazeGenerator&version=2.0.0
                    
Install as a Cake Addin
#tool nuget:?package=DimonSmart.MazeGenerator&version=2.0.0
                    
Install as a Cake Tool

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 boxMazeWaveGenerator + MazePathBuilder produces the shortest path.
  • Extensible plotters – plug in your own IMazePlotter, IWavePlotter, or IPathPlotter to render progress in any UI.
  • Broad runtime support – the library multi-targets net6.0, net7.0, net8.0, net9.0, and net10.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 MazeBuildOptions and a custom IMazePlotter implementation.
  • Example 3 – wave propagation + reconstructed path (shows S, E, and *).

The source lives in QuickStartDemo/Program.cs.

Use the library in your app

  1. Install the package

     dotnet add package DimonSmart.MazeGenerator
    
  2. Define 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;
     }
    
  3. 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();
    
  4. Render however you like – iterate over maze to 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.0 to validate the latest runtime.

Key types

  • Maze<TCell> – holds the grid and exposes boundary validation.
  • MazeBuilder<TCell> – carves the maze; accepts optional IMazePlotter callbacks 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 a MazePath with ordered PathCell instances.
  • 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, and net10.0 to 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.sln succeeds 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 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • 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