2020 Day 11 Complete

This commit is contained in:
2020-12-11 08:11:30 -06:00
parent 581b0682d4
commit 772298895b
6 changed files with 634 additions and 0 deletions

View File

@@ -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{

View File

@@ -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
}