Story Time

Apropos of my KenKen puzzle solver, a user writes:

I love this solver, but isn’t there a site where we can test our partial solutions and get a “correct” or “incorrect” verdict? That way we can keep going or start over without seeing the entire solution.

Well, the answer is now: “Yes, there is!”. Let me give you a quick overview of how that happened.

The Problem

The basic problem with fulfilling this user’s request was that the solver’s UI was designed to lay out puzzles, not to solve them. That might not seem like a big deal, but it would have been a bigger project than I wanted to undertake to extend the solver’s UI to handle solutions input by the user.

The Solution

Fortunately, I had some code that was designed to handle solutions: the player that I had written for my puzzle site. This code naturally already included a validation tester, as well as a hint system. The trick would be to move a puzzle from the solver to the player.

Yay!

This was one of those times when things went (more or less) like they were supposed to. I re-coded the player to check its URL for an encoded puzzle/solution pair, and to present it to the user if present. I also upgraded the player’s validation function to provide more feedback on whether a solution was incomplete, incorrect, both, or neither.

I then added a “Make Puzzle” button to the solver that would, instead of just showing the user a solution, package the puzzle and solution into a URL to be sent to the player as a GET request. I chose to use GET requests since they yield URLs that are bookmarkable, e-mailable, etc., and since these requests don’t change any server state.

So, in summary: Enjoy!

Share and Enjoy:
  • Twitter
  • Facebook
  • Digg
  • Reddit
  • HackerNews
  • del.icio.us
  • Google Bookmarks
  • Slashdot
This entry was posted in Projects. Bookmark the permalink.

Comments are closed.