#1: Mark Boehmer (mboehmer) on Sep 29, 2006
Jan I was wondering what language you program in to solve these puzzles. I would think it would need some sort of PERL script so that it can follow a "pattern" in the numbers, but I'm not too familiar with PERL. If it is Java, C/C++/C#, or something else...is the code available?#2: Jan Wolter (jan) on Sep 29, 2006
There's two-and-a-half languages being used here:#3: Jan Wolter (jan) on Sep 29, 2006
SQL isn't really a full-blown programming language, but some pages, like the "Find Puzzles" page are really just a thin Perl wrapper around a lot of SQL.
- Perl: Programs that run on the server.
- SQL: Server database access/update language.
For more detail on how the puzzle solver works, check the FAQ. Regular expressions (whose syntax almost counts as a fourth language) are the key to both the solver and the error checker (the thing that lights up red balls when you make a mistake).
Is the code available? Hmmm...
Building it up into a full solver that could solve any puzzle that can be solved would take only a little more work. It already pushs a record of every mark it makes on the "undo" stack. You'd need to add the ability to make random guess when the line solver no longer gives you anything, and we need to mark that as a guess when we push it on the stack. If we hit an error, we backtrack to the last guess by popping things off the undo stack. Once we've undone our guess, we make a different one, and proceed again. Not hard to do at all. Probably wouldn't add more than a couple dozen lines of code.
But this solver would occasionally run for a very long time. Solving paint-by-number puzzles has been proven to be an NP-complete problem. That means that while you can make solvers that work pretty quickly a lot of the time, there will always be cases where they won't be quick.
Anyway, I don't see any real use in releasing copies of what little code isn't released already.
There are paint-by-number puzzle solving programs available from a number of different people on the net.
Thanks Jan#5: Jan Wolter (jan) on Jun 19, 2008
I'm reviewing various old forum threads, and thought this needed an update.#6: Jan Wolter (jan) on May 31, 2013
There are now also substantial parts of the site written in the C programming language, namely the checker (aka pbnsolve) used to check if puzzles have unique solution and the backend of the chat program. These are applications where I needed the code to be fast and efficient so as not to put excess load on the server. C programs are significantly faster than Perl programs, if written carefully.
More updates to an old item:
Source code for the solver I wrote to check puzzles here is available at http://webpbn.com/pbnsolve.html . The rest of the code for this site is not publicly available and isn't going to be.
Goto next topic
You must register and log in to be able to participate in this discussion.