Skip to content

Commit bbdf832

Browse files
committed
Data map to char
1 parent 0d8959b commit bbdf832

File tree

1 file changed

+3
-3
lines changed
  • src/main/java/com/sbaars/adventofcode/year22/days

1 file changed

+3
-3
lines changed

src/main/java/com/sbaars/adventofcode/year22/days/Day9.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ public static void main(String[] args) {
2727
// d.submitPart2();
2828
}
2929

30-
public record Move(String dir, long n){}
30+
public record Move(char dir, long n){}
3131

3232
@Override
3333
public Object part1() {
@@ -40,14 +40,14 @@ public Object part2() {
4040
}
4141

4242
private int simulateRope(int size) {
43-
List<Move> moves = dayStream().map(s -> readString(s, "%s %n", Move.class)).toList();
43+
List<Move> moves = dayStream().map(s -> readString(s, "%c %n", Move.class)).toList();
4444
Point head = new Point();
4545
List<Point> tail = new java.util.ArrayList<>(IntStream.range(0, size).mapToObj(i -> new Point()).toList());
4646
HashSet<Point> visited = new HashSet<>();
4747
visited.add(head);
4848

4949
for(Move m : moves) {
50-
Direction dir = Direction.getByDirCode(m.dir.charAt(0));
50+
Direction dir = Direction.getByDirCode(m.dir);
5151
for(int i = 0; i<m.n; i++) {
5252
head = dir.move(head);
5353
for(int j = 0; j<tail.size(); j++) {

0 commit comments

Comments
 (0)