goproblems.com sorter
goproblems.com is a wonderful community site containing thousands of… well… go problems. Problems are presented and solved using a Java applet. For me, the best thing about the site is that it is downloadable.
The downloaded problems can be navigated using the “previous” and “next” button. However, it iterates through problem id, which for me isn’t very useful.
My idea is to traverse the problems from the easiest to the hardest. My first solution was to copy-paste the contents of the “all problems” index into a spreadsheet and sort them there. Because the links in the speadsheet is clickable, I would navigate the problems from the spreadsheet.
My second solution was to use the sorted spreadsheet data to generate a set of htmls which allows me to traverse the problems without leaving the browser. Because OpenOffice.org Calc uses XML, parsing it was quite doable (I didn’t use System.XML, just some ad hoc parsing). The result was a frame based solution. The original goproblems.com page is contained in a frame and there is another frame for navigating backwards/forward. Bad usability because there were two sets of navigational buttons and the difference wasn’t obvious. Not to mention that frames are ugly.
Some days ago I downloaded a the latest goproblems.com snapshot (around 1000 new problems from my last one). I then finally forced myself to make a final solution. It was essentially a complete rewrite. I made the program read the difficulty directly from the html files, removing the need for manual sorting inside OOo Calc. I also made the program modify the URL of the already-existing navigational buttons, removing the need for frames.
So, here’s the result:

The program is here and the source code is here. It is made in C# so Mono or Microsoft .NET needs to be installed. To run it, just type:
gpsorter [input-directory] [output-directory]
or using Mono:
mono gpsorter.exe [input-directory] [output-directory]
Where [input-directory] is the directory of the unpacked and orginal goproblems.com.











June 6th, 2008 at 10:54 am
[...] This post has been moved to singularity.agronesia.net: “goproblems.com sorter”. Please visit the new [...]