Documentation ¶
Index ¶
- func AbsFloat(x float64) float64
- func AbsInt(x int) int
- func Atof(s string) float64
- func Atoi(s string) int
- func Check(err error)
- func MaxFloat(x, y float64) float64
- func MaxInt(x, y int) int
- func MinFloat(x, y float64) float64
- func MinInt(x, y int) int
- func SignFloat(x float64) float64
- func SignInt(x int) int
- type Grid
- type Vector2D
- func (v Vector2D) Add(other Vector2D) Vector2D
- func (v Vector2D) DistanceSquared(o Vector2D) int
- func (v Vector2D) IsUnset() bool
- func (v Vector2D) Length() int
- func (v Vector2D) LengthSquared() int
- func (v Vector2D) ManhattanDistance(o Vector2D) int
- func (v Vector2D) ManhattanLength() int
- func (v Vector2D) Mul(factor int) Vector2D
- func (v Vector2D) Sub(other Vector2D) Vector2D
- func (v Vector2D) X() int
- func (v Vector2D) Y() int
- type Vector3D
- func (v Vector3D) Add(other Vector3D) Vector3D
- func (v Vector3D) DistanceSquared(o Vector3D) int
- func (v Vector3D) Length() int
- func (v Vector3D) LengthSquared() int
- func (v Vector3D) ManhattanDistance(o Vector3D) int
- func (v Vector3D) ManhattanLength() int
- func (v Vector3D) Mul(factor int) Vector3D
- func (v Vector3D) Sub(other Vector3D) Vector3D
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Grid ¶
type Grid struct { Width int Height int Formats map[rune]func(string, ...interface{}) string // contains filtered or unexported fields }
func NewGrid ¶
NewGrid makes a new grid from a multiline grid string. e.g.: /------\ | o x| \------/
func (Grid) CountChars ¶
CountChars counts the amount of cells that contain a given rune in the grid.
type Vector2D ¶
type Vector2D struct {
// contains filtered or unexported fields
}
Vector2D represents a 2D set of ints.
func (Vector2D) DistanceSquared ¶
DistanceSquared calculates the difference between the squared length of this vector and another.
func (Vector2D) LengthSquared ¶
LengthSquared calculates the square of the length of the vector.
func (Vector2D) ManhattanDistance ¶
ManhattanDistance calculates the Manhattan distance between the vector and another vector.
func (Vector2D) ManhattanLength ¶
ManhattanLength calculates the Manhattan length of the vector.
type Vector3D ¶
type Vector3D struct {
// contains filtered or unexported fields
}
Vector2D represents a 2D set of ints.
func (Vector3D) DistanceSquared ¶
DistanceSquared calculates the difference between the squared length of this vector and another.
func (Vector3D) LengthSquared ¶
LengthSquared calculates the square of the length of the vector.
func (Vector3D) ManhattanDistance ¶
ManhattanDistance calculates the Manhattan distance between the vector and another vector.
func (Vector3D) ManhattanLength ¶
ManhattanLength calculates the Manhattan length of the vector.