Documentation
¶
Overview ¶
Package grid defines basic types and utility functions on those types
Index ¶
Constants ¶
View Source
const ( // Grids larger than 14x14 are known to have no solutions MaxGridSize = 14 // The largest squared distance between points on a maximum sized grid MaxSeparation = (MaxGridSize - 1) * (MaxGridSize - 1) * 2 )
Variables ¶
This section is empty.
Functions ¶
func CheckValidSolution ¶
func CheckValidSolution(g Grid, p Placements) error
Checks that a proposed solution to the problem is valid
func IsInBounds ¶
IsInBounds returns whether a Point is contained within a given Grid
func Separation ¶
Separation is the squared distance between 2 grid points
Types ¶
type Grid ¶
type Grid struct {
Size uint8
}
Grid represents an NxN square grid
func (Grid) Iter ¶
func (g Grid) Iter() PointIterator
type Point ¶
Point is the coordinate of a stone on a grid
func AdvanceStone ¶
AdvanceStone returns the next point in an ordered left to right, top to bottom traversal of the grid. The returned point is *not* guaranteed to be on the grid.
type PointIterator ¶
type PointIterator interface { // Next returns the next Point and whether or not it was valid Next() (Point, bool) }
PointIterator allows iteration over a collection of points
Click to show internal directories.
Click to hide internal directories.