maze

package
v0.0.0-...-81698c8 Latest Latest
Warning

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

Go to latest
Published: Dec 18, 2023 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Connector

type Connector string
const (
	ConnVertical   Connector = "|" // "|" connects north and south.
	ConnHorizontal Connector = "-" // "-" connects east and west.
	ConnL          Connector = "L" // "L" is a 90-degree bend connects north and east.
	ConnJ          Connector = "J" // "J" is a 90-degree bend connects north and west.
	Conn7          Connector = "7" // "7" is a 90-degree bend connects south and west.
	ConnF          Connector = "F" // "F" is a 90-degree bend connects south and east.
	ConnStart      Connector = "S" // "S" represents the start of the maze and can be any connector.
)

type Coord

type Coord struct {
	X int
	Y int
}

type Direction

type Direction int
const (
	North Direction = iota
	South
	East
	West
)

type Maze

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

func ParseMaze

func ParseMaze(r io.Reader) (Maze, error)

func (Maze) FarthestDistFromStart

func (m Maze) FarthestDistFromStart() (int, error)

func (Maze) FindStart

func (m Maze) FindStart() (Coord, error)

func (Maze) Move

func (m Maze) Move(loc Coord, dir Direction) (val string, next Coord, ok bool)

type Pipe

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

func NewPipe

func NewPipe(label string, x, y int) Pipe

Jump to

Keyboard shortcuts

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