2020 Day 11 Complete
This commit is contained in:
@@ -26,6 +26,18 @@ func (c *Coordinate) South() Coordinate {
|
||||
func (c *Coordinate) West() Coordinate {
|
||||
return Coordinate{X: c.X - 1, Y: c.Y}
|
||||
}
|
||||
func (c *Coordinate) NW() Coordinate {
|
||||
return Coordinate{X: c.X - 1, Y: c.Y - 1}
|
||||
}
|
||||
func (c *Coordinate) NE() Coordinate {
|
||||
return Coordinate{X: c.X + 1, Y: c.Y - 1}
|
||||
}
|
||||
func (c *Coordinate) SW() Coordinate {
|
||||
return Coordinate{X: c.X - 1, Y: c.Y + 1}
|
||||
}
|
||||
func (c *Coordinate) SE() Coordinate {
|
||||
return Coordinate{X: c.X + 1, Y: c.Y + 1}
|
||||
}
|
||||
|
||||
func (c *Coordinate) GetNorthCoord() *Coordinate {
|
||||
return &Coordinate{
|
||||
|
@@ -230,3 +230,12 @@ func IntSlicesAreEqual(s1 []int, s2 []int) bool {
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
func StringSliceContains(h []string, n string) bool {
|
||||
for _, v := range h {
|
||||
if v == n {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
Reference in New Issue
Block a user