Monthly Archives: December 2003

Blepharosphincterectomy

I wrote a little program to calculate the number of anagrams of each word in the UNIX dictionary (it’s just like the regular dictionary, but it doesn’t have definitions). After two and a half hours of computational strain (Θ(n2) with n=200,000 is not cheap), the results arrived. Coming in first place is the word “pseudolamellibranchiate,” with 28,368 anagrams! Holy shit! That’s 20% of the dictionary! Pick a word at random, and there’s a one in five chance that it’s an anagram of that word!

The silver goes to “blepharosphincterectomy,” with 20,960, and the bronze to “spondylotherapeutics,” with 20,311. The shortest word with over 1,000 anagrams is “zymotechnical,” which just goes to show that letter quantity is as important as quality.

So there’s a bunch of words for you guys to look up. Also, I’ll give $25 to the first person to list all the acronyms of pseudolamellibranchiate without use of a computer. Er, just kidding. :-)

I’m inclined to design an algorithm that would run in a tighter asymptotic complexity, as a challenge. But I really ought get to my physics, and to writing those Perl synopses.

MSKLC

I just remapped my keyboard. I figure, I do so much programming, I should start making it a bit more efficient (and harder to adapt to others’ programming environments to boot). All I did this time was switch the dash and underscore keystrokes. In the programming languages I use, underscores tend to appear a lot more often than dashes, so this makes sense. It will take a little getting used to, but I’m sure I’ll like it once it grinds itself in.

The program I used to do this was
Microsoft Keyboard Layout Creator. I like it. Plus, it requires that you’re not allowed to sell your keyboard layouts — that they must be free. Go them.

Square Root of a Function

So I came across the
Quantum::Usrn Perl module, and it got me to thinking about square roots of other functions. I’m sure there’s some way, as there is with integrating, to find these, but so far I’ve had to use different methods for each one, along with quite a bit of mathematical intuition.

For instance, sqrt(λx.-x) is λx.ix, and in general, sqrt(λx.ax) is λx.sqrt(a)x. Also, quite obviously, sqrt(λx.x+a) is λx.x+a/2. I found sqrt(λx.ax+b), and it is significantly more complicated, but an interesting property is that it is in the form αx+β, and α is sqrt(a), which leads me to believe that there is some way of methodically finding these, at least for polynomials.

I have a hunch that the solution of sqrt(f) lies somehow in the scalar eigenvalues of f (that is, x where f(x) = x).

This is all fun stuff. I don’t know what practical use it has, but I’m sure the dynamical systems folks have done something with it at some point.

Game Programming is Too Hard!

Game Programming is Too Hard! Puck Fighter is a little game where you move balls around, they crash into each other, and you swing ropes around. And it’s like 1,200 lines of code!

What does Perl say again? “The Easy things should be Easy, and the Hard things should be Possible.” This thing is Easy as all hell, and it’s as Hard as Possible! Perhaps my Programming Purpose in life is to make game programming easy. This entry shall serve as an initial brainstorm for how to do just that.

What’s hard about game programming?

First off, there’s too much setup involved. I wanted to try a little physics experiment tonight, but then I just stopped because it’s too much of a pain to write the code getting the OpenGL window up and the timing set up.

Namaste and I were talking about getting the sticky thing on the end of the rope to move freely around a body (get your mind out of the gutter! :-), rather than sticking to one place. This turned out to be much harder than you’d think. An idea came up to attach a thin layer around the puck that would rotate freely. The rope would then attach to this. Implementing this caused endless complications.

What’s easy about text processing?

Perl has text processing down to a sci– down to an art. It’s not just easy to parse stuff with Perl, it’s even fun to write. Not like the grudging detail-work of game programming at all.

So what makes it fun? I’m pretty sure it’s not just Perl; I can envisage writing a game in Perl (I might one of these days), and it would sure be nicer than writing in C++, but it wouldn’t be like writing a parser. Well, here’s one thing that makes it fun: CPAN! I use Parse::RecDescent to do my parsing. That’s working at the domain level: working with the context-free grammar directly. And making a simple change is as simple as the change itself.

Perl has built-in support for regular expressions. Want to match a pattern? Just type /some.*pattern/ or whatever. That’s also what makes it fun for text processing.

So How can we make Game Programming Fun like Perl?

Flash does a pretty good job. If only ActionScript didn’t suck so bad, and if Flash weren’t so buggy, and if Flash weren’t so slow…. In Flash you work closer to domain-level concepts, like buttons, movie clips, images. All self contained and designed with the language, unlike C++ which was designed for everything, which means it wasn’t designed for anything.

So is it possible to make a C++ game toolkit to make this fun? I don’t think so. I just don’t think C++ has that kind of flexibility. I think we need a new language. Whether that manifests itself as a new programming language or as a sophistocated Perl module, it’s a new way of thinking about game programming. And I don’t think it can easily be a Perl module, because I want an integrated graphical designer, or something. Something to help you visualize all the visual interactions your game is modeling.

More research, more thought, and more experience is in order here. I am very open to any input anyone has on the subject. I’m getting excited about it though, which is a good thing.

Amanda

Well, I got Amanda… sortof. I have to remember that life always throws a curve-ball, no matter what I think I’m prepared for. I asked her out, and her reply was, in its greatest essence, “yes, but.”

So I think I’ll follow through, take her out somewhere, and see where it goes. Judging by her enthusiasm (er, lack thereof) I’m not going to be expecting too much.

But she’s a cutie, so I’m giving it a shot, of course :-).