Thanks to the starbucks app of the week, I found a fun little puzzler in Dwelp. In fact, I had so much fun with it that I decided to go back and write a program to build and solve Dwelp puzzles. And, maybe I used it on one or two puzzles I was stuck on.
Sure, all of the solutions are on YouTube anyways, but it feels less like cheating this way. The app logic itself is reasonably straightforward; it's all browser based and is hosted at github.io.
No tricky algorithms or heuristics required here, it's just pure recursive brute force (though it at least succeeds fast and will quit after finding the first good solution). The low branching factor of Dwelp in general (since you can only move previously grouped tiles of each color), coupled with the built in move limit required to "master" a level, means you can run this for pretty dense boards even on mobile devices.
The app mostly explains itself, but for completeness:
- Click a circle to enable placement of that type on the grid. Empties and singles overwrite previous tiles.
- Enter a move limit using the number input.
- Solve will draw and list the solution in terms of the origin and destination squares in order. This can be hard to parse; my big remaining todo with this project is to make this a little more readable, perhaps with animation.
- Clear clears the solution, but leaves the puzzle in case you want to add to it or change the move limit.
- Reset is just like refreshing the page.