Skip to content

Commit 72e5270

Browse files
committed
copy edits
1 parent 0b51fe2 commit 72e5270

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

posts/solving-nyt-pips-puzzle.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,7 @@ Are there any checks we can perform to kill branches sooner?
223223

224224
<div className="pips" id="hard" canvas="false" with-optimizations="false"></div>
225225

226-
The first optimization I found was rather silly and simple and had a huge impact. If you recall the `solver()` function code from above, for each domino I check both orientations. For example, `5|6` can also be placed like `6|5`. However, I didn't have a check for when the sides of the domino are the same! So the solver would do a lot of duplicate work for dominos like `3|3`.
226+
The first optimization I found was quite silly and simple and had a huge impact. If you recall the `solver()` function code from above, for each domino I check both orientations. For example, `5|6` can also be placed like `6|5`. However, I didn't have a check for when the sides of the domino are the same! So the solver would do a lot of duplicate work for dominos like `3|3`.
227227

228228
The fix was simple: check for matching sides before searching the branch for the flipped orientation.
229229

@@ -314,6 +314,8 @@ Move ordering is a really great lever when you have a DFS/backtracking solver th
314314

315315
It felt odd that I wasn't able to get move ordering working since I've been able to apply it in my [chess](https://healeycodes.com/building-my-own-chess-engine), [sokoban](https://healeycodes.com/building-and-solving-sokoban), and [queuedle solvers](https://healeycodes.com/solving-queuedle)! I must be missing something about tile-like puzzles like Pips.
316316

317+
I ran out of time to add further optimizations but my intuition is that I've only scratched the surface here. I also haven't spent any time making the solver code run faster (e.g. things like [bitboards](https://healeycodes.com/visualizing-chess-bitboards)).
318+
317319
## UI
318320

319321
I've inlined two kinds of component in this post. The Pips board aims to be a faithful-ish clone of the Pips UI on the NYT website. It's more cramped (you could also say, badly designed) and sterile but I've grown to like it.

0 commit comments

Comments
 (0)