util

package
v0.0.0-...-a84f5f7 Latest Latest
Warning

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

Go to latest
Published: Dec 26, 2022 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DIR_UP    = "U"
	DIR_DOWN  = "D"
	DIR_LEFT  = "L"
	DIR_RIGHT = "R"
	DIR_STAY  = ""
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Position

type Position struct {
	Name             string
	X                int
	Y                int
	VisitedPositions []VisitedPosition
}

func NewPosition

func NewPosition(name string, x, y int) *Position

func (*Position) IsAdjacent

func (p *Position) IsAdjacent(target *Position) bool

func (*Position) Move

func (p *Position) Move(step Step, print bool)

func (*Position) MoveNextTo

func (p *Position) MoveNextTo(target *Position)

func (*Position) RecordVisit

func (p *Position) RecordVisit()

type Step

type Step struct {
	Direction string
	Units     int
}

type VisitedPosition

type VisitedPosition struct {
	X int
	Y int
}

Jump to

Keyboard shortcuts

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