I wanted to try out some canvas element functionality, given that I have a feeling it will steal a lot of Flash’s thunder. I whipped up a bubble-breaker game (the mechanic should be very familiar to you) in a few hours. Enjoy the demo! I may do a quick write up at a later point.
I’ve only tested it in Firefox 3.6. I do not know whether it will work in other browsers.
I have updated the Google Code repository with updates to integrate GraphViz. It expects the PEAR GraphViz package to be installed.Â To install it, issue command:
# You must install the beta package.
sudo pear install Image_GraphViz-beta
If you’d rather not mess with PEAR, download the package, extract the class Image_GraphViz, and alter two two lines of code that depend on the PEAR::System package. It should be trivial to change these. They are both basically calls like this:
// create a temporary file with the prefix "graph_"
$file = System::mktemp('graph_');
One possible replacement:
// will use default tmp dir
$file = tempnam('', 'graph_');
This is the output of an Org Chart when the HTML display is selected.
This is the output of an Org Chart when the GraphViz display is selected.
I was working on the Drupal OrgChart module tonight, specifically the rendering of the chart image via GraphViz, and I got stuck for at least an hour on a trifle! I planned to use the PEAR library for GraphViz (Image_GraphViz) and I wrote a function using the class it provides. I run the procedure and get weird errors about not being able to find files and such. After debugging for awhile, I find out that there is a property binPath that is not present. I had expected this to point to my install of GraphViz, which I knew to be especially important because it was in a weird macports directory.
It turns out that I had not installed the version I needed! I didn’t realize the version I wanted was beta, and to download a beta package, you need to explicitly state so in the PEAR command.
sudo pear install Image_GraphViz-beta
sudo pear install Image_GraphViz
After downloading the most recent package, it turned out my code worked almost perfectly. What a waste of a night!
The past few days, I also worked on a few other modifications. I removed the requirement for a “subordinate_id” field. Also, I made the profile field names options in the administrative settings page.
I spent a few hours cooking up an entry for this Tron Bot AI Competition. The starter packages they provided made it really easy to enter. I created an entry in python. The competition page is: http://csclub.uwaterloo.ca/contest/
The strategy for my bot:
I tried to implement painter’s flood fill per Wikipedia. This worked okay and I got to around ~300.
Then I implemented A*. The strategy was to get within 5 squares of the enemy, and then flood fill. My reasoning was that if I had a better fill algorithm, I would win at that point.
Next, I tried to implement minimax with alpha-beta pruning. It’s not tested, but it should be fairly close. All I am missing is a utility function (well, that is probably the most impt piece!). For the utility function, I wanted to bisect the playing field by finding the perpendicular bisector between the players, then flood-filling to determine the number of blank spaces in each player’s respective region. I have the bisection algorithm done, but got bored once I started implementing the flood fill.
Some coworkers and I have been working on Stikker, a cli interface for the Stikked FOSS php pastebin. I haven’t used it for awhile, but we recently set it up at work to facilitate code sharing. Unfortunately, it hasn’t been updated recently and there are some things which are broken which I’ll need to address. One of the great things about OSS is that fixing things yourself is possible!