maze

package
Version: v0.0.0-...-d6647d3 Latest Latest
Warning

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

Go to latest
Published: Mar 7, 2020 License: MIT Imports: 3 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Cell

type Cell struct {
	Next []direction.Direction `json:"next"`
}

func (Cell) Has

func (c Cell) Has(d direction.Direction) bool

type Chooser

type Chooser interface {
	Choose(int) int
}

Chooser interface is the interface that the cell picking algorithm should implement

func Backtrack

func Backtrack() Chooser

Backtrack returns a backtrack algorithm implementation

type Maze

type Maze struct {
	Width    int         `json:"width"`
	Height   int         `json:"height"`
	Grid     grid        `json:"grid"`
	Entrance point.Point `json:"entrance"`
	Exit     point.Point `json:"exit"`
}

Maze internal structure

type Middleware

type Middleware func(Service) Service

Middleware wraps the Service and performs actions before the implementation is called

type Randomizer

type Randomizer interface {
	Int() int
	Intn(int) int
	Perm(int) []int
}

Randomizer abstracts the rand.Rand functions needed, for easier testing

type Service

type Service interface {
	Generate(width, height int, seed int64, algorithm Chooser) Maze
}

Service interface exposes the generator service

func New

func New(middleware ...Middleware) Service

New returns a Service implementation

Jump to

Keyboard shortcuts

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