aoc2024/day-21/internal/pad/neighbours.go

17 lines
258 B
Go
Raw Permalink Normal View History

2024-12-25 14:45:38 +00:00
package pad
func neighbours(c coords, r rune) coords {
switch r {
case '^':
return coords{c.x, c.y - 1}
case '>':
return coords{c.x + 1, c.y}
case 'v':
return coords{c.x, c.y + 1}
case '<':
return coords{c.x - 1, c.y}
default:
return c
}
}