Skip to content

Commit b84eef0

Browse files
committed
refactor(2024/day/14/part/2): use @lib/mod
also fix test case
1 parent d5ed9b0 commit b84eef0

2 files changed

Lines changed: 3 additions & 5 deletions

File tree

2024/day/14/part/2/solve.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,5 +17,5 @@ p=7,3 v=-1,2
1717
p=2,4 v=2,-3
1818
p=9,5 v=-3,-3`;
1919

20-
assertEquals(solve(input, { width: 11, height: 7 }), 12);
20+
assertEquals(solve(input, { width: 11, height: 7 }), 1);
2121
});

2024/day/14/part/2/solve.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import mod from "@lib/mod.ts";
2+
13
const regExp = /^p=(?<px>\d+),(?<py>\d+) v=(?<vx>-?\d+),(?<vy>-?\d+)$/gm;
24

35
export default function solve(
@@ -17,7 +19,3 @@ export default function solve(
1719
return t;
1820
}
1921
}
20-
21-
function mod(a: number, b: number) {
22-
return ((a % b) + b) % b;
23-
}

0 commit comments

Comments
 (0)