It's finished! Yay! We had our demo on Friday. Unfortunately, our stuff didn't work as well in the demo as it had the night before (famous last words). Our final project was "follow the leader," which was apparently very popular this term. The idea is basically to put all the trains in a loop on the track, and have them be evenly spaced out. So the difficult problems are merging new trains into the loop, and maintaining constant velocity.
The latter may not sound very difficult, but believe me, it is. The trains have speed settings, like speed 5 or speed 10. But that means nothing in terms of actual physical speed in cm/s. One train might go at 15cm/s at speed 5, another might only go at 10cm/s. So you have to be constantly updating the speed estimates for the trains and dynamically changing their speeds to keep them all going at roughly the same speed.
Anyway, we managed to get 8.5/10 on the project even though it didn't work as well as it should have, so I'm not too upset. It's odd though; the whole term, all these months of hard work, culminates in a 20 minute demo. The prof seemed distinctly uninterested; I can't blame him, either. Our demo was at 4:20 pm and he'd been seeing demos since 9 am. It's just odd to have all this stuff that you've been devoting your life to for months suddenly be turned into a number and become irrelevant. That's school for you, I guess.
And although I did learn a lot of stuff, most of it didn't really have to do with real-time programming. I became much better at low-level programming, learned about x86 architecture, designed some graph algorithms, and generally, I think, just became a bit of a better programmer. But the actual real-time component of the project was pretty small.
Anyway, with that, I leave you with one last screenshot. This is our track simulator, with 3 trains in the loop, and a 4th one merging in at the bottom. The red boxes are trains, and the circles are their "slots" in the loop. The program constantly computes the distance between trains and their slots, updates speed estimates, and adjusts train speeds. It also updates the slot targets when new trains are added, and computes merge targets for new trains based on their locations.
Feeling a bit poor these days, due to it being near the end of term and my having spent a bunch of money on things for next term, like my flight, my visa, and a month's rent. Needless to say, Christmas will be going on plastic :) But I'll become rich as soon I get my first paycheque at Google, so I should be able to squeeze through without too much trouble.
Will probably be coming to Montréal next weekend with mrwise. Hopefully I'll get to see a few of you NITIots. I'll post the details of when we're coming and all that when I have them.