plateau

package
v0.0.0-...-627063f Latest Latest
Warning

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

Go to latest
Published: Nov 23, 2020 License: GPL-3.0 Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Surface

type Surface struct {
	LowerBoundX int
	LowerBoundY int
	UpperBoundX int
	UpperBoundY int
}

Surface is a representation of a plateau upon which objects can traverse.

func New

func New(upperBoundX, upperBoundY int) (*Surface, error)

New creates a new Surface with a given upper-right boundary, represented via x and y coordinates, with a lower-left boundary of 0,0. This function will error if any of the upper-right boundaries are less than the lower-left ones.

func (*Surface) IsOutOfBounds

func (s *Surface) IsOutOfBounds(x, y int) bool

IsOutOfBounds checks if a coordinate is out of bounds within a given surface.

func (*Surface) String

func (s *Surface) String() string

String outputs a simple representation of a given surface.

type UpperBoundsError

type UpperBoundsError struct {
	Coordinate string
	Value      int
	LowerBound int
}

UpperBoundsError is an error that is returned whenever the plateau surface's upper boundaries are less than the lower boundaries defined within the plateau package; see plateau.lowerBoundX and plateau.lowerBoundY

func (*UpperBoundsError) Error

func (o *UpperBoundsError) Error() string

Error returns a message containing which coordinate has been found to be invalid as an upper bound.

Jump to

Keyboard shortcuts

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