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