robot

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 robot provides a Robot that can travel through a maze and record its steps

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Robot

type Robot struct {
	travel.Travel
	// contains filtered or unexported fields
}

Robot records its steps as it roams though a maze

func New

func New(t travel.Travel) Robot

New returns a new Robot

func (Robot) Finished

func (r Robot) Finished() bool

Finished returns true or false if the robot is done going through the maze

func (*Robot) Move

func (r *Robot) Move() error

Move moves the robot in its current direction. Returns an error if impossible to move.

func (Robot) Steps

func (r Robot) Steps() []Step

Steps returns a copy of the robot's steps

func (*Robot) TurnLeft

func (r *Robot) TurnLeft()

TurnLeft turns the Robot left

func (*Robot) TurnRight

func (r *Robot) TurnRight()

TurnRight turns the Robot right

type Step

type Step struct {
	C maze.Cell
	D maze.Direction
}

Step represents a movement in a maze, it has a target cell and direction

Jump to

Keyboard shortcuts

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