procedural

package
v0.9.9 Latest Latest
Warning

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

Go to latest
Published: Jun 4, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateEphemeralMaze2D

func CreateEphemeralMaze2D(mazeRooms [][]*GridRoom) (allRoomIds []int, startRoomId int, endRoomId int)

Types

type GridMaze

type GridMaze struct {
	// contains filtered or unexported fields
}

GridMaze implements the Maze interface

func NewGridMaze

func NewGridMaze() *GridMaze

NewGridMaze creates a new grid maze generator

func (*GridMaze) Generate2D

func (m *GridMaze) Generate2D(xMax, yMax int, seed ...string) [][]*GridRoom

func (*GridMaze) GetCriticalPath

func (m *GridMaze) GetCriticalPath() []MazeRoom

func (*GridMaze) GetEnd

func (m *GridMaze) GetEnd() (int, int)

func (*GridMaze) GetStart

func (m *GridMaze) GetStart() (int, int)

type GridRoom

type GridRoom struct {
	// contains filtered or unexported fields
}

GridRoom implements the MazeRoom interface

func (*GridRoom) GetConnections

func (r *GridRoom) GetConnections() []MazeRoom

func (*GridRoom) GetDistanceFromStart

func (r *GridRoom) GetDistanceFromStart() int

func (*GridRoom) GetPosition

func (r *GridRoom) GetPosition() (int, int, int)

func (*GridRoom) GetStep

func (r *GridRoom) GetStep() int

func (*GridRoom) IsConnectedTo

func (r *GridRoom) IsConnectedTo(room MazeRoom) bool

func (*GridRoom) IsDeadEnd

func (r *GridRoom) IsDeadEnd() bool

func (*GridRoom) IsEnd

func (r *GridRoom) IsEnd() bool

func (*GridRoom) IsStart

func (r *GridRoom) IsStart() bool

type Maze

type Maze interface {
	// Generate creates a new maze with the specified dimensions
	// Optional seed string can be provided for deterministic generation
	// Returns a 2D slice where [x][y] contains a MazeRoom or nil
	Generate2D(xMax, yMax int, seed ...string) Maze2D

	// GetStart returns the starting room position
	GetStart() (int, int)

	// GetEnd returns the ending room position
	GetEnd() (int, int)

	// GetCriticalPath returns the rooms on the critical path from start to end
	GetCriticalPath() []MazeRoom
}

Maze represents a 2D maze generator

type Maze2D

type Maze2D [][]*GridRoom

[y][x]

type Maze3D

type Maze3D [][][]*GridRoom

[z][y][x]

type MazeRoom

type MazeRoom interface {
	// GetPosition returns the x, y, z coordinates of this room
	GetPosition() (int, int, int)

	// GetConnections returns all rooms this room connects to
	GetConnections() []MazeRoom

	// IsConnectedTo checks if this room is connected to another room
	IsConnectedTo(room MazeRoom) bool

	// GetStep returns the step number on the critical path (0 if not on critical path)
	GetStep() int

	// IsStart returns true if this is the start room
	IsStart() bool

	// IsEnd returns true if this is the end room
	IsEnd() bool

	// IsDeadEnd returns true if this room is a dead end (only one connection)
	IsDeadEnd() bool

	// GetDistanceFromStart returns the number of steps from the start room
	GetDistanceFromStart() int
}

MazeRoom represents a single room/space in the maze

Jump to

Keyboard shortcuts

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