2018 Day 22 Complete

This commit is contained in:
2019-11-07 11:53:26 -06:00
parent 7a00e2f9cc
commit 7c9742fb73
4 changed files with 225 additions and 123 deletions

19
2018/day22/coord.go Normal file
View File

@@ -0,0 +1,19 @@
package main
type coord struct {
x, y int
}
func (c coord) neighbors() []coord {
n := []coord{
{c.x + 1, c.y},
{c.x, c.y + 1},
}
if c.x > 0 {
n = append(n, coord{c.x - 1, c.y})
}
if c.y > 0 {
n = append(n, coord{c.x, c.y - 1})
}
return n
}