Documentation
¶
Index ¶
- Constants
- Variables
- func CountDigits(num int) int
- func Gcd[T Number](a, b T) T
- func GenerateHash(values ...interface{}) uint64
- func InitTypeGrid[T any](val T, height, width int) [][]T
- func Lcm[T Number](a, b T) T
- func LcmRange[T Number](vals ...T) T
- func Max[T AnyNum](a, b T) T
- func ToInt(s string) int
- func ToInt64(s string) int64
- func Transpose[T any](matrix [][]T) [][]T
- type AnyNum
- type Number
- type Position
- func (p Position) Add(other Position) Position
- func (p Position) Distance(other Position) float64
- func (p Position) EvaluateFor(grid [][]int) int
- func (p Position) InBounds(size int) bool
- func (p Position) OutOfBounds(size int) bool
- func (p *Position) PAdd(o Position)
- func (p *Position) PMinus(o Position)
Constants ¶
View Source
const ( N = iota E S W NE SE SW NW )
Variables ¶
View Source
var ALL_MOVES = []Position{
{X: -1, Y: 0},
{X: 0, Y: 1},
{X: 1, Y: 0},
{X: 0, Y: -1},
{X: -1, Y: 1},
{X: 1, Y: 1},
{X: 1, Y: -1},
{X: -1, Y: -1},
}
View Source
var HORIZONTAL_MOVES = []Position{
{X: -1, Y: 0},
{X: 0, Y: 1},
{X: 1, Y: 0},
{X: 0, Y: -1},
}
Functions ¶
func CountDigits ¶
func GenerateHash ¶
func GenerateHash(values ...interface{}) uint64
func InitTypeGrid ¶
Types ¶
type Position ¶
func GetNeighbors ¶
func NewPosition ¶
func (Position) EvaluateFor ¶
func (Position) OutOfBounds ¶
Click to show internal directories.
Click to hide internal directories.