File tree Expand file tree Collapse file tree 1 file changed +3
-3
lines changed
src/main/java/com/sbaars/adventofcode/year22/days Expand file tree Collapse file tree 1 file changed +3
-3
lines changed Original file line number Diff line number Diff line change @@ -27,7 +27,7 @@ public static void main(String[] args) {
27
27
// d.submitPart2();
28
28
}
29
29
30
- public record Move (String dir , long n ){}
30
+ public record Move (char dir , long n ){}
31
31
32
32
@ Override
33
33
public Object part1 () {
@@ -40,14 +40,14 @@ public Object part2() {
40
40
}
41
41
42
42
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 ();
44
44
Point head = new Point ();
45
45
List <Point > tail = new java .util .ArrayList <>(IntStream .range (0 , size ).mapToObj (i -> new Point ()).toList ());
46
46
HashSet <Point > visited = new HashSet <>();
47
47
visited .add (head );
48
48
49
49
for (Move m : moves ) {
50
- Direction dir = Direction .getByDirCode (m .dir . charAt ( 0 ) );
50
+ Direction dir = Direction .getByDirCode (m .dir );
51
51
for (int i = 0 ; i <m .n ; i ++) {
52
52
head = dir .move (head );
53
53
for (int j = 0 ; j <tail .size (); j ++) {
You can’t perform that action at this time.
0 commit comments