// Diagonal returns 4 adjacent diagonal (inter-cardinal) positions, filtered by
// keep function.
Diagonal returns 4 adjacent diagonal (inter-cardinal) positions, filtered by
keep function.
// Diagonal returns 4 adjacent diagonal ( inter - cardinal ) positions filtered by // keep function .
func (nb *Neighbors) Diagonal(p gruid.Point, keep func(gruid.Point) bool) []gruid.Point {
	nb.ps = nb.ps[:0]
	for y := -1; y <= 1; y += 2 {
		for x := -1; x <= 1; x += 2 {
			q := p.Shift(x, y)
			if keep(q) {
				nb.ps = append(nb.ps, q)
			}
		}
	}
	return nb.ps
}
func ( nb * Neighbors ) Diagonal ( p gruid . Point , keep func ( gruid . Point ) bool ) [ ] gruid . Point { nb . ps = nb . ps [ : 0 ] for y := - 1 ; y <= 1 ; y += 2 { for x := - 1 ; x <= 1 ; x += 2 { q := p . Shift ( x , y ) if keep ( q ) { nb . ps = append ( nb . ps , q ) } } } return nb . ps }
Diagonal returns 4 adjacent diagonal (inter-cardinal) positions, filtered by
keep function.
Diagonal returns 4 adjacent diagonal ( inter - cardinal ) positions filtered by keep function .