Skip to content

Commit 3c7b5ff

Browse files
committed
fix(day24): use correct detection
1 parent 4a65d51 commit 3c7b5ff

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

day24/bacterias.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ export const simulateBacteriasOnSurface = (world: World): number => {
6969
const seenBds = [] as number[]
7070
let bd = -1
7171
while (!seenBds.includes(bd)) {
72+
seenBds.push(bd)
7273
const u = updateLocation({
7374
surface: updated,
7475
width: world.width,
@@ -80,7 +81,6 @@ export const simulateBacteriasOnSurface = (world: World): number => {
8081
surface: updated,
8182
width: world.width,
8283
})
83-
seenBds.push(bd)
8484
}
8585
return bd
8686
}

day24/day24.solution.spec.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,12 @@ describe('Day 23: Part 1', () => {
55
expect(
66
simulateBacteriasOnSurface({
77
surface: toSurface(`
8-
.#..#
9-
.#.#.
10-
#..##
11-
.#.##
12-
##..#
13-
`),
8+
.#..#
9+
.#.#.
10+
#..##
11+
.#.##
12+
##..#
13+
`),
1414
width: 5,
1515
}),
1616
).toEqual(10282017)

0 commit comments

Comments
 (0)