99fdb9371a
I think I'm slowly reaching my limit Solution for part two (which would also work for part 1) made me realise that I should probably (re-)read those math books and learn the basics again
17 lines
258 B
Go
17 lines
258 B
Go
package util
|
|
|
|
type Vec2 struct {
|
|
X, Y int64
|
|
}
|
|
|
|
func (v Vec2) Mult(by int64) Vec2 {
|
|
return Vec2{v.X * by, v.Y * by}
|
|
}
|
|
|
|
func (v Vec2) Add(a Vec2) Vec2 {
|
|
return Vec2{v.X + a.X, v.Y + a.Y}
|
|
}
|
|
|
|
func (v Vec2) Eq(a Vec2) bool {
|
|
return v.X == a.X && v.Y == a.Y
|
|
}
|