board

package
v0.0.0-...-39567c2 Latest Latest
Warning

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

Go to latest
Published: Dec 3, 2023 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Board

type Board[T fmt.Stringer] [][]T

func (Board[T]) AllCoords

func (b Board[T]) AllCoords() []Coord

func (Board[T]) Get

func (b Board[T]) Get(r, c int) T

func (Board[T]) GetCoord

func (b Board[T]) GetCoord(co Coord) T

func (Board[T]) Height

func (b Board[T]) Height() int

func (Board[T]) InBounds

func (b Board[T]) InBounds(co Coord) bool

func (Board[T]) Neighborhood9

func (b Board[T]) Neighborhood9(co Coord) []Coord

func (Board[T]) Neighbors4

func (b Board[T]) Neighbors4(co Coord) []Coord

func (Board[T]) Neighbors8

func (b Board[T]) Neighbors8(co Coord) []Coord

func (*Board[T]) Set

func (b *Board[T]) Set(r, c int, val T)

func (*Board[T]) SetCoord

func (b *Board[T]) SetCoord(co Coord, val T)

func (Board[T]) String

func (b Board[T]) String() string

String renders the board in string.

This implementation assumes that the String() function for the type returns values of the same width, and there is no need for any delimiter (designed for the one-digit boards from 2021 day 9 and 11).

func (Board[T]) Width

func (b Board[T]) Width() int

type Coord

type Coord struct {
	// contains filtered or unexported fields
}

func MakeCoord

func MakeCoord(r, c int) Coord

func (Coord) Apply

func (c Coord) Apply(diff [2]int) Coord

func (Coord) C

func (c Coord) C() int

func (Coord) R

func (c Coord) R() int

Jump to

Keyboard shortcuts

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