utils

package
v0.0.0-...-dc3ba52 Latest Latest
Warning

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

Go to latest
Published: Dec 17, 2023 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	North     = iota
	NorthEast = iota
	East      = iota
	SouthEast = iota
	South     = iota
	SouthWest = iota
	West      = iota
	NorthWest = iota
)

Variables

This section is empty.

Functions

func AbsInt

func AbsInt(n int) int

func Combinations

func Combinations(characters []rune, length int) [][]rune

func FromCoordinates

func FromCoordinates(x int, y int, columnLength int) int

func GreatestCommonDivisor

func GreatestCommonDivisor(a, b int) int

courtesy of https://go.dev/play/p/SmzvkDjYlb

func GridToString

func GridToString(grid []rune, columnLength int) string

func IntPow

func IntPow(a, b int) int

func IsUpper

func IsUpper(s string) bool

func LeastCommonMultiple

func LeastCommonMultiple(a, b int, integers ...int) int

courtesy of https://go.dev/play/p/SmzvkDjYlb

func ManhattanDistance

func ManhattanDistance(x int, y int) int

func MaxInt

func MaxInt(a int, b int) int

func MinInt

func MinInt(a int, b int) int

func Neighbour

func Neighbour(x int, y int, direction int, rowLength int, columnLength int) int

func RotateRelativePoint

func RotateRelativePoint(x2 int, y2 int, angle int) (int, int)

func ToByteSlice

func ToByteSlice(input string, separator byte) [][]byte

func ToCoordinates

func ToCoordinates(offset int, columnLength int) (x int, y int)

func ToIntegerSlice

func ToIntegerSlice(input string, separator string) ([]int, error)

func ToOptimisticIntSlice

func ToOptimisticIntSlice(input string, allowNegative bool) []int

func ToRuneSlice

func ToRuneSlice(input string, separator string) [][]rune

func ToStringSlice

func ToStringSlice(input string, separator string) []string

Types

This section is empty.

Jump to

Keyboard shortcuts

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