aoc2024/day-04/internal/one/neighbours.go

15 lines
396 B
Go
Raw Normal View History

2024-12-05 01:31:44 +00:00
package one
func neighbours(p point) [8]point {
return [8]point{
{y: p.y - 1, x: p.x, direction: N},
{y: p.y - 1, x: p.x + 1, direction: NE},
{y: p.y, x: p.x + 1, direction: E},
{y: p.y + 1, x: p.x + 1, direction: SE},
{y: p.y + 1, x: p.x, direction: S},
{y: p.y + 1, x: p.x - 1, direction: SW},
{y: p.y, x: p.x - 1, direction: W},
{y: p.y - 1, x: p.x - 1, direction: NW},
2024-12-05 01:31:44 +00:00
}
}