<body><script type="text/javascript"> function setAttributeOnload(object, attribute, val) { if(window.addEventListener) { window.addEventListener('load', function(){ object[attribute] = val; }, false); } else { window.attachEvent('onload', function(){ object[attribute] = val; }); } } </script> <div id="navbar-iframe-container"></div> <script type="text/javascript" src="https://apis.google.com/js/platform.js"></script> <script type="text/javascript"> gapi.load("gapi.iframes:gapi.iframes.style.bubble", function() { if (gapi.iframes && gapi.iframes.getContext) { gapi.iframes.getContext().openChild({ url: 'https://www.blogger.com/navbar.g?targetBlogID\x3d13405220\x26blogName\x3dPavan+Podila\x27s+Blog\x26publishMode\x3dPUBLISH_MODE_BLOGSPOT\x26navbarType\x3dBLUE\x26layoutType\x3dCLASSIC\x26searchRoot\x3dhttps://pavanpodila.blogspot.com/search\x26blogLocale\x3den_US\x26v\x3d2\x26homepageUrl\x3dhttp://pavanpodila.blogspot.com/\x26vt\x3d-3240902251102105728', where: document.getElementById("navbar-iframe-container"), id: "navbar-iframe" }); } }); </script>

Saturday, February 25, 2006

Polarium cleanups + a cool new feature

Yesterday night I spent a lot of time playing some of the puzzles from Polarium Puzzle archive. The way I was going about playing them was to copy the puzzle code, paste it into a file, save it, and then load it up in the app. After playing about 5 puzzles I realized the inconvenience in doing that again and again. I had to come up with a better way of doing that and reduce the number of steps required to play a puzzle.

After a few minutes of thinking about this, I came up with the idea of using the Clipboard directly. I would right-click two times on the Polarium title text:


to invoke the level-load operation. At this point, I would check if the Clipboard has any text, and if it did I would call the PolariParser to load the level. Note that this works only for the NintendoDS format. I think I am going to totally remove the support for the B/W/G format, since nobody seems to be using that.

This required me to make some changes to the Parser. Previously all the input used to come from a file. This had to be changed so that I could load directly from text. With all that in place, things are much more comfortable:
  1. Copy the puzzle code from the archive
  2. Right-click 2 times on the Polarium title
  3. Get the grey-cells working on the puzzle!
Besides this I have also cleaned up the code with some refactorings. This should make it more readable.

Download Source and Binaries (v2.1)