Tuesday 23 August 2011

Just a Quick Little Project

Last month was my girlfriend’s birthday, for which I bought her a dartboard—one of the classic ones made out of wood and sisal fibres. Let me tell you, the electric ones just are no match for them. I had one of them some years ago and was not happy at all. Half of the darts bounced off and often bent their plastic tips doing this. Sometimes they stuck but broke off at the tip. These tips had to be removed from the board with the help of pincers; and sometimes even this would not work and it remained in the board. So that would not do, and the classical board is indeed very much more convenient, in particular for laypeople like us. Not a single dart has bounced off this one so far.

I need not tell you the big disadvantage of the classical board, I guess. It is of course that you have to keep the score yourself. As we do not have a referee at our disposal (“one hundrrrrred and eeeiiiiiiighty”), and (despite the fact we are both are mathematicians, or maybe just because of it) not being inclined to much mental arithmetic, this turned out to be a real nuisance.

Now I have to confess a quirk of mine: Whenever I face I problem like that, I immediately conceive of some piece of software to do the job. It has become somewhat annoying lately, as for example I have trouble using artistic 3D software (like 3Ds, Maya, Blender, POV-Ray), because my inclination is to not construct a scene and render it, but rather to write scripts that build it automatically. You can see how that may be a hampering, at times outwardly idiotic approach.

Be that as it may, the idea of writing a little program to help us keep darts score seemed an enticing one, so, in short, I did.

There is no better language than Java if you want to get results quickly, possibly containing reasonably sophisticated graphics as well. Writing in Java has always felt to me like building things with Lego bricks—quick, reasonably versatile and completely safe.

The downside is that it is basically an interpreter language, which is a thing I dislike on general principles. I won’t go into more details here—if you are familiar with programming you know these things, and if not, it most likely would not be interesting. Anyway, I figured that writing this thing in C++ (without .NET or MFC, as I usually do), for example, would take too much time.

There is this TV series (or sitcom) called Big Bang Theory which I like a lot. In one episode of the second season the character Sheldon made a questionnaire containing a list of his best traits for his friends to grade. (If you think that makes no sense, you do not know the series!) The most whimsical item he cited was his alleged ability to write Java applets very well.

Now I have to confess a thing which might make me look very, very crazy and maybe pathetic as well. It is this: As this Sheldon is a physicist and a genius, it kind of incited my ambition to prove that I at least had that quality as well.

Emulating a fictitious character may seem weird and pathetic, but it is not entirely without honorable precedent—I guess I am stating this in self-defense. Bertrand Russell claimed that people made themselves unhappy by emulating prototypes they had no chance of attaining, and as an example claimed that even Alexander the Great had (probably) striven to emulate another one—Hercules, as Russell guessed. The guess was wrong, but it seems Alexander in fact tried to emulate Achilles, another probably fictitious (at least in the traditional form) figure.

So if Alexander was allowed to give himself to such crazy thoughts, why shouldn’t I as well? Well, quod licet Iovi, non licet bovi and all that, but still I use this notion to console myself.

So anyway, the thought of Sheldon goaded me on not to attack this problem, but try to do it as quickly as possible. Granted, I did not make it an applet but rather an application, but it did seem more fitting to the problem, and it could be easily made into an applet with little work. Anyway, I was really content with the time it took me; one evening to get a workable rough version of the software and another evening to polish it up. Most of the time was spent looking up details of specific Java standard classes I used.

After I was finished with this piece of software I though I might just as well put it into my blog for download. So if you have a non-electric dartboard and face the same difficulty as me feel free to use this program of mine. Just please keep in mind that it is a quick thing cobbled together in a couple of days. It could have a lot more options and gadgets. It is not the best that could be done, not even the best I could do, but I do not feel like devoting more time to it, so that’s all folks. If you find it useful for you, have fun! Below is a screenshot of the interface and a download link.

Darts software

download DartsCounter.jar

Run this pogram just like any other jar archive, most probably by just double clicking it. I found it needs a fairly recent version of Java installed, but that won’t be a problem, I expect.

No comments:

Post a Comment