We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 748488c commit 18377e2Copy full SHA for 18377e2
src/main/java/org/togetherjava/aoc/core/math/matrix/MatrixPosition.java
@@ -3,11 +3,16 @@
3
import org.togetherjava.aoc.core.math.Direction;
4
5
public record MatrixPosition(int row, int col) {
6
+
7
public MatrixPosition move(int rows, int cols) {
8
return new MatrixPosition(row + rows, col + cols);
9
}
10
11
public MatrixPosition move(Direction direction) {
12
return new MatrixPosition(row - direction.getY(), col + direction.getX());
13
14
15
+ public MatrixPosition move(Direction direction, int magnitude) {
16
+ return new MatrixPosition(row - (direction.getY() * magnitude), col + (direction.getX() * magnitude));
17
+ }
18
0 commit comments