travel

package
v0.0.0-...-60c38a5 Latest Latest
Warning

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

Go to latest
Published: Jun 27, 2023 License: MIT Imports: 2 Imported by: 0

Documentation

Overview

Package travel provides travel for package maze

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Travel

type Travel struct {
	Dir    maze.Direction
	Coords maze.Coords
	Maze   maze.Maze
}

Travel represents a being that can travel through a maze

func New

func New(m maze.Maze) Travel

New returns a valid gopher that is ready to roam through a maze

func (Travel) CanGoDown

func (t Travel) CanGoDown() bool

CanGoDown returns false if there's a wall between the current cell and the cell below it or if the cell's coordinates are invalid

func (Travel) CanGoRight

func (t Travel) CanGoRight() bool

CanGoRight returns false if there's a wall between the current cell and the cell to the right or if the cell's coordinates are invalid

func (*Travel) Move

func (t *Travel) Move() error

Move tries to move the gopher to the cell in the direction that the gopher is facing and returns an error if there's no passage

func (*Travel) TurnRight

func (t *Travel) TurnRight()

TurnRight turns clock-wise

Jump to

Keyboard shortcuts

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