It's actually been some time since I began using my own SVN repository for the XBBCode module (described in more detail in earlier posts). It's far more convenient than the combination of Dreamweaver and vim I have been using before.
Also, I have made it publically available, so if you have an SVN client (which you undoubtedly do if you have Linux), you can now get the current version by checking out the repository at this URL:
I have enabled (moderated) comments for anonymous users. The last time this was enabled (nearly a year ago), I was inundated by spam. This time, I trust Drupal to weed out improper comments and I'll use the IP ban table to get rid of these creeps.
If the spammers make me lock down my blog so tightly that nobody can comment, not even legitimate readers, they've already won. It's a bit like Dubya's "war on terrah".
Well, except nobody's ever been killed by a spam filter.
I wrote of my first scenario two days ago, and of my success in combining the Pear syntax highlighter with my XBBcode module to integrate it in Drupal today.
So this shouldn't come as a surprise, really.
AvernumScript is one hell of a scripting language, and not really in the positive sense: Arbitrary spellings and abbreviations of functions are awful to remember, and the tight limitations (only integer and string types, only while and if-else flow control) aren't good to design for.
With the help of the PEAR Text_Highlighter package, I just extended XBBCode with an interface that used this library. The module is called Highlighter. It scans a directory for generated class files (Text_Highlighter generates PHP classes for specific code types from XML descriptions), includes them, and then provides XBBCode tags for each. I can now use PHP:
Yesterday evening, I put the finishing touches on my first Blades of Avernum scenario. If you do not know what that is, you should read the Wikipedia page, go to the homepage, try the game, begin to love it, buy it, and play a few scenarios before continuing to read this article.
Today, I was saved by the knowledge of yet another neat little algorithm. Well, not 'saved' as such; I could have done the job with something less efficient and elegant, but it certainly didn't hurt.
For a programming exercise, I needed to find the GCD of two numbers.
This is a little algorithm snippet that has come in handy for me three times in the past month since I came up with it, so I thought I should share it.
A lot of algorithms deal with matrices, or two-dimensional arrays. Looping through each cell in an array, either to find something or update them all, has been done for ages (and the commonly used loop indices are 'i' and 'j', folks, not 'x' and 'y'. Please.)
So I implemented Conway's Game of Life in Java. On a torus, a body whose edges are mapped onto each other to give it an infinite area easily navigated using modulo arithmetics.
It took 140 lines, but that's not spectacular - being the solution to an excercise I wrote on paper earlier today, it's written more for elegance and readability than number of lines, and has plenty of comments.