mazes

package
v0.0.0-...-bf7ab43 Latest Latest
Warning

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

Go to latest
Published: Nov 14, 2021 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BinaryTree

func BinaryTree(grid *Grid)

func DefaultContentsOfCell

func DefaultContentsOfCell(cell *Cell) string

func Sidewinder

func Sidewinder(grid *Grid)

Types

type Cell

type Cell struct {
	North *Cell
	South *Cell
	East  *Cell
	West  *Cell

	Column int
	Row    int
	// contains filtered or unexported fields
}

func NewCell

func NewCell(row, column int) *Cell

func (*Cell) Distances

func (c *Cell) Distances() *Distances

func (*Cell) IsLinked

func (c *Cell) IsLinked(cell *Cell) bool
func (c *Cell) Link(cell *Cell)

func (*Cell) LinkBidirectional

func (c *Cell) LinkBidirectional(cell *Cell)
func (c *Cell) Links() []*Cell

func (*Cell) Neighbours

func (c *Cell) Neighbours() []*Cell
func (c *Cell) Unlink(cell *Cell)

func (*Cell) UnlinkBidirectional

func (c *Cell) UnlinkBidirectional(cell *Cell)

type ContentsOfCell

type ContentsOfCell func(cell *Cell) string

type Distances

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

func NewDistances

func NewDistances(root *Cell) *Distances

func (*Distances) GetCells

func (d *Distances) GetCells() []*Cell

func (*Distances) GetDistance

func (d *Distances) GetDistance(cell *Cell) (int, bool)

func (*Distances) SetDistance

func (d *Distances) SetDistance(cell *Cell, distance int)

type Grid

type Grid struct {
	Random         *rand.Rand
	ContentsOfCell ContentsOfCell
	Grid           [][]*Cell
	Rows           int
	Columns        int
}

func NewGrid

func NewGrid(rows, columns int) *Grid

func (*Grid) Cell

func (g *Grid) Cell(row, column int) *Cell

func (*Grid) RandomCell

func (g *Grid) RandomCell() *Cell

func (*Grid) Size

func (g *Grid) Size() int

func (*Grid) String

func (g *Grid) String() string

func (*Grid) ToPNG

func (g *Grid) ToPNG(w io.Writer)

Jump to

Keyboard shortcuts

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