2022 Day 17 part 1 Complete

This commit is contained in:
2022-12-20 15:04:26 -06:00
parent 4abc58d07d
commit c4d5dae456
10 changed files with 1297 additions and 0 deletions

View File

@@ -134,3 +134,40 @@ func (c Coordinate) Adjacent(c2 Coordinate) bool {
c2.Equals(c.West()) ||
c2.Equals(c.NW())
}
func GetHighestY(list ...Coordinate) int {
top := math.MinInt
for i := range list {
if list[i].Y > top {
top = list[i].Y
}
}
return top
}
func GetLowestY(list ...Coordinate) int {
bot := math.MaxInt
for i := range list {
if list[i].Y < bot {
bot = list[i].Y
}
}
return bot
}
func GetLowestX(list ...Coordinate) int {
bot := math.MaxInt
for i := range list {
if list[i].X < bot {
bot = list[i].X
}
}
return bot
}
func GetHighestX(list ...Coordinate) int {
top := math.MinInt
for i := range list {
if list[i].X > top {
top = list[i].X
}
}
return top
}