maze

package module
v1.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 24, 2025 License: MIT Imports: 6 Imported by: 0

README

maze

maze is maze generator package for Go language. The maze walls are of the grid cell type. ([][]T // 0: path, 1: wall)

rect is a subpackage for generating maze walls of type []image.Rectangle

import "github.com/setanarut/maze/rect"

Documentation

Overview

maze is Maze generation package for Go

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func WritePNG

func WritePNG[T constraints.Integer](grid [][]T, filename string) error

Types

type Maze

type Maze[T constraints.Integer] struct {
	Grid          [][]T      // 0: path, 1: wall
	Visited       [][]bool   // visited cells for DFS
	Rnd           *rand.Rand // random number generator
	CellSize      int        // path width in pixels
	WallThickness int        // wall thickness in pixels
	Cols          int        // number of maze cells (width)
	Rows          int        // number of maze cells (height)
}

func NewMaze

func NewMaze[T constraints.Integer](w, h, cellSize, wallThickness int) *Maze[T]

func (*Maze[T]) Generate

func (m *Maze[T]) Generate(seed1 uint64, seed2 uint64)

func (*Maze[T]) Size added in v1.1.0

func (m *Maze[T]) Size() image.Point

Size returns the size of the maze in pixels.

The size is calculated as the number of cells multiplied by the cell size, plus the wall thickness to account for the walls around the maze.

Directories

Path Synopsis
examples
demo command
rectdemo command
rect is a subpackage for generating labyrinth walls of type []image.Rectangle
rect is a subpackage for generating labyrinth walls of type []image.Rectangle

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL