.
This commit is contained in:
@@ -21,13 +21,13 @@ class SnailfishNumber {
|
||||
return true
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (this.right instanceof SnailfishNumber) {
|
||||
if (this.right.explode(depth + 1)) {
|
||||
return true
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (!(this.left instanceof SnailfishNumber) && !(this.right instanceof SnailfishNumber) && depth >= 4) {
|
||||
let lastNode = this
|
||||
let node = this.parent
|
||||
@@ -142,3 +142,7 @@ function day18(input, part2) {
|
||||
return pairs.map((e) => e[0].add(e[1]).magnitude()).max()
|
||||
}
|
||||
}
|
||||
|
||||
if (typeof window == "undefined") {
|
||||
module.exports = day18
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user