2022 Day 17 part 1 Complete
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user