There are already many solutions to the “Santa Claus Problem” by John Trono1. It’s a “problem simple to understand and yet far from easy to solve”; the author’s original solution (based on semaphores) was only partly correct. The probably most known analysis of the problem was written by Mordechai Ben-Ari2, who also provided solutions in Ada95 and Java. This is the original problem description:

Santa Claus sleeps in his shop up at the North Pole, and can only be wakened by either all nine reindeer being back from their year long vacation on the beaches of some tropical island in the South Pacific, or by some elves who are having some difficulties making the toys. One elf’s problem is never serious enough to wake up Santa (otherwise, he may never get any sleep), so, the elves visit Santa in a group of three. When three elves are having their problems solved, any other elves wishing to visit Santa must wait for those elves to return. If Santa wakes up to find three elves waiting at his shop’s door, along with the last reindeer having come back from the tropics, Santa has decided that the elves can wait until after Christmas, because it is more important to get his sleigh ready as soon as possible. (It is assumed that the reindeer don’t want to leave the tropics, and therefore they stay there until the last possible moment. They might not even come back, but since Santa is footing the bill for their year in paradise… This could also explain the quickness in their delivering of presents, since the reindeer can’t wait to get back to where it is warm.) The penalty for the last reindeer to arrive is that it must get Santa while the others wait in a warming hut before being harnessed to the sleigh.

Read More ...

At work, we started using dmake in 1991 (or even earlier) for building the firmware for the Vending Machine Controller Euro'90. The firmware consisted mostly of PL/M and C code and the compilers suffered from the DOS limitation of 127 characters per command line. Dennis Vadura’s dmake 3.70 (hosted by the University of Waterloo and available as DOS version) featured the $(mktmp ) macro that let me create any needed temporary config and response files.

Read More ...

Even before I upgraded to OS X 10.4 (Tiger), I got the report that the Save File dialog in Realpolitik crashes. Now I have applied a quick’n’dirty fix for the next couple of days for all Tiger users and released Realpolitik 1.7.0 Alpha 2 earlier than planned.

Currently I’m revamping the dialogs known to Mac developers as Navigation Services. Already done in Alpha 2 is the Open File dialog:

RP 170a2 Open File Dialog

From the users perspective you have now a working type pop-up, where you can choose Realpolitik Files (.dpy files and files created by Realpolitik), Text Files or just any document.

Read More ...

The four days at the ACCU Conference in Oxford are over. Except Günter nobody seems to have blogged the C++ track.

Apart from the discussions and presentations what should go into the next C++ standard (called C++0x and scheduled for 2009), one of the big topics was concurrency and a new awareness that some new ideas are needed. Herb Sutter presented the points of his recent DDJ article. As an example for an exercise simple to understand and yet far from easy to solve he mentioned the Santa Claus Problem:

Read More ...

After much carbonizing by Ben Hines and some polishing by me a new Realpolitik Release is available on Sourceforge, the first release for OS X.

The release version Realpolitik 1.7.0 Alpha1 is not yet stable (hence Alpha 1), there are still some known (and probably many more unknown) errors like selection and redrawing problems with the orders window, but with some care (backup your .dpy files!) it should be usable.

Parallel to the Mac version a new Windows version is out. It’s called Alpha too, but should be as stable as the old releases. The only major change for the windows version is the switch from Mindvision Installer VISE to the NSIS installer. VISE was once free for shareware developers, but is not anymore. And NSIS looks at least as good as VISE, is open source and has CVS-friendly plain text configuration files.

Read More ...

Every year after christmas the El Niño Cup takes place. It is a tournament where the result is less important than exercising and having fun. There is a team day, where every team plays Volleyball, Basketball and Unihockey, and a single day, where the disciplines are Badminton, Table Tennis and Archery.

Last year I wrote a program to ease the drawing. It is a fairly complex problem:

  • Every participant must have six matches, two for every discipline, against members of its category (men, women, mixed…)
  • There should be not two matches against the same adversary (except if the category has less than 7 players)
  • Between two matches there should be a break of at least the duration of one match

This year I enhanced the program some more. The amount of tweaking the program output by hand is now almost zero. Just some games remained to be exchanged to satisfy the at-least-one-break condition.

Read More ...

Im Gegensatz zu PCs ist bei OS X Python bereits vorinstalliert. Leider fehlt jedoch ausgerechnet IDLE, so dass trotzdem noch etwas zu tun bleibt.

Installationsanleitung für IDLE (von PythonMac FAQ abgekupfert)

  • Tcl/Tk Aqua herunterladen und installieren
  • MacPython herunterladen und installieren (für OS X 10.3 sind das die MacPython Panther Addons)
  • Das Programm PackageManager im Ordner /Programme/MacPython-2.3 starten
  • Im PackageManager _tkinter installieren

“Neue” Division

Damit IDLE sich so benimmt wie im Buch beschrieben (vgl. Anhang D im Buch), muss noch eine Datei leicht verändert werden.

Read More ...

(Deutscher Text siehe separater Artikel)

K got the book Python für Kids. To enable him to use the book on OS X, I wanted to setup the Python environment on the Mac as on the PC: Install IDLE and, to hide the differences between integer and floating point math, configure to use the new division.

Installing IDLE on OS X 10.3 is easy with MacPython. IDLE comes as bundle, ready to be launched with the mouse from the Finder. But for using the new division without the need for from __future__ import division, IDLE must be started with options. How to embed these options in the IDLE.app bundle?

Read More ...

Peter Steiner

Software Developer and Opinionated Citizen

Switzerland