Day 3-6 2019
This commit is contained in:
@@ -0,0 +1,13 @@
|
||||
package be.vandewalleh.aoc.geometry;
|
||||
|
||||
public record Point2D(int x, int y) {
|
||||
public static Point2D origin = new Point2D(0, 0);
|
||||
|
||||
public int manhattanDistance() {
|
||||
return Math.abs(x) + Math.abs(y);
|
||||
}
|
||||
|
||||
public Point2D translate(Point2D other) {
|
||||
return new Point2D(this.x + other.x, this.y + other.y);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user