rename part3 to part2 so that it actually makes sense

This commit is contained in:
Rowan 2024-12-14 15:47:45 -06:00
parent 72b3ecfcbe
commit 9233539ece

View file

@ -79,7 +79,9 @@ const checksum = iter => {
.reduce(add)
}
const expand3 = x => x.split('').map(toInt).map((x, i) => ([x, i % 2, i % 2 ? -1 : i / 2]))
const expand2 = x => x.split('')
.map(toInt)
.map((x, i) => ([x, i % 2, i % 2 ? -1 : i / 2]))
const defrag2 = blocks => {
const len = blocks.length - 1
@ -120,5 +122,5 @@ const checksum2 = blocks => {
}
const part1 = pipe(expand, enfrag, checksum)
const part3 = pipe(expand3, defrag2, checksum2)
const part2 = pipe(expand2, defrag2, checksum2)