Documentation ¶
Index ¶
- Constants
- Variables
- func SetFPS(rate int)
- type Map
- func (m Map) Clone() Map
- func (m Map) Equal(m2 Map) bool
- func (m Map) Filter(matches ...interface{}) Map
- func (m Map) FilterOut(matches ...interface{}) Map
- func (m Map) Find(matches ...interface{}) []Vector
- func (m Map) FindBottomFirstColumn() Vector
- func (m Map) FindBottomLeft() Vector
- func (m Map) FindBottomRight() Vector
- func (m Map) FindPattern(pattern Map, matchValue bool) []Vector
- func (m Map) FindTopLeft() Vector
- func (m Map) FindTopRight() Vector
- func (m Map) Height() int
- func (m Map) InvertY() Map
- func (m Map) Merge(m2 Map) Map
- func (m Map) Render()
- func (m Map) RotateLeft() Map
- func (m Map) RotateRight() Map
- func (m Map) SetPositive() Map
- func (m Map) SortByDist(from Vector) []Vector
- func (m Map) SortValuesByDist(from Vector) []interface{}
- func (m Map) String() string
- func (m Map) ToSlice() []Vector
- func (m Map) Translate(move Vector) Map
- func (m Map) Width() int
- type P
- func (p *P) Clone() *P
- func (p *P) LongestPos(emptyPoints Map) (maxPos Vector, maxDist int)
- func (p *P) Move(steps int)
- func (p *P) MoveDown(steps int)
- func (p *P) MoveLeft(steps int)
- func (p *P) MoveRight(steps int)
- func (p *P) MoveUp(steps int)
- func (p *P) PathEstimatedCost(to astar.Pather) float64
- func (p *P) PathNeighborCost(to astar.Pather) float64
- func (p *P) PathNeighbors() []astar.Pather
- func (p *P) ShortestPathToPos(pos Vector, emptyPoints Map) (path []*P, distance float64, found bool)
- func (p *P) TurnLeft()
- func (p *P) TurnRight()
- type Vector
- func (v Vector) AngleFrom(from Vector) float64
- func (v Vector) C() complex128
- func (v Vector) DistFrom(from Vector) int
- func (v Vector) DistFromOrigin() int
- func (v Vector) EuclideanDistFrom(from Vector) float64
- func (v Vector) EuclideanDistFromOrigin() float64
- func (v Vector) Rotate(angle float64) Vector
- func (v Vector) RotateDegree(degrees int) Vector
- func (v Vector) ScalarMult(i int) Vector
- func (v Vector) X() int
- func (v Vector) Y() int
Constants ¶
Variables ¶
var ( DirectionNames = map[Vector]string{ UP: "up", LEFT: "left", DOWN: "down", RIGHT: "right", } FourDirections = []Vector{DOWN, RIGHT, LEFT, UP} AllDirections = []Vector{DOWN, RIGHT, LEFT, UP, UPRIGHT, UPLEFT, DOWNRIGHT, DOWNLEFT} )
var ( RenderingEnabled = false RenderingMap = make(map[interface{}]color.Color) )
Functions ¶
Types ¶
type Map ¶
type Map map[Vector]interface{}
func NewMapFromInput ¶
NewMapFromInput set every character from the input string into a Map object based on its coordinate. Every vector in the map is positive, which means that the bottom left of the input will be at the origin of the Map.
func (Map) FindBottomFirstColumn ¶
FindBottomFirstColumn returns a point that is the most bottom left point of the map. This point exists in the actual map.
func (Map) FindBottomLeft ¶
FindBottomLeft returns a point that represent the bottom left corner of a squared map only composed of the match values. This point might not exist on the actual map.
func (Map) FindBottomRight ¶
FindBottomRight returns a point that represent the bottom right corner of a squared map only composed of the match values. This point might not exist on the actual map.
func (Map) FindPattern ¶
FindPattern looks for a pattern in a map and return a list of pattern start points.
func (Map) FindTopLeft ¶
FindTopLeft returns a point that represent the top left corner of a squared map only composed of the match values. This point might not exist on the actual map.
func (Map) FindTopRight ¶
FindTopRight returns a point that represent the top right corner of a squared map only composed of the match values. This point might not exist on the actual map.
func (Map) RotateLeft ¶
func (Map) RotateRight ¶
func (Map) SetPositive ¶
func (Map) SortByDist ¶
SortByDist will sort the sliced map by distance from the given position (lowest to max). If two points have the same distance the order will be based on radian angle (lowest to max).
func (Map) SortValuesByDist ¶
type P ¶
func (*P) PathEstimatedCost ¶
PathEstimatedCost uses Manhattan distance to estimate orthogonal distance
func (*P) PathNeighborCost ¶
PathNeighborCost returns the cost of the tube leading to Truck.
func (*P) PathNeighbors ¶
func (p *P) PathNeighbors() []astar.Pather
func (*P) ShortestPathToPos ¶
type Vector ¶
type Vector complex128
func (Vector) C ¶
func (v Vector) C() complex128