// All returns 8 adjacent positions, including diagonal ones, filtered by keep
// function.
All returns 8 adjacent positions, including diagonal ones, filtered by keep
function.
// All returns 8 adjacent positions including diagonal ones filtered by keep // function .
func (nb *Neighbors) All(p gruid.Point, keep func(gruid.Point) bool) []gruid.Point {
	nb.ps = nb.ps[:0]
	for y := -1; y <= 1; y++ {
		for x := -1; x <= 1; x++ {
			if x == 0 && y == 0 {
				continue
			}
			q := p.Shift(x, y)
			if keep(q) {
				nb.ps = append(nb.ps, q)
			}
		}
	}
	return nb.ps
}
func ( nb * Neighbors ) All ( p gruid . Point , keep func ( gruid . Point ) bool ) [ ] gruid . Point { nb . ps = nb . ps [ : 0 ] for y := - 1 ; y <= 1 ; y ++ { for x := - 1 ; x <= 1 ; x ++ { if x == 0 && y == 0 { continue } q := p . Shift ( x , y ) if keep ( q ) { nb . ps = append ( nb . ps , q ) } } } return nb . ps }
All returns 8 adjacent positions, including diagonal ones, filtered by keep
function.
All returns 8 adjacent positions including diagonal ones filtered by keep function .