maettig.com

DOS math and life simulations

← Back to the index of my DOS archive

EGA clock (1994)

Analog fullscreen clock on a gray background This source code snippet is so trivial, it's a miracle I still have it. I don't think I had a specific use in mind when I created this analogue clock. It was a playground that helped me understand sine and cosine better, as well as what it means to have non-square pixels in many of the DOS-era graphics modes. The source is written in a way it adapts to most graphics modes including that weird 640 × 200 pixel mode no program I know ever used. But even the »standard« 320 × 200 pixel mode means my clock has to take a pixel aspect ratio of 1 : 1.2 into account to look like a circle and not like a squashed ellipsoid.

Download assorted source code snippets including this EGA clock (PowerBASIC)

Mathe (1998)

The file date of this pretty small piece, consisting of only 120 lines of code, says 1998. I was in school that year, adding a fourth year of training to my carreer as a land surveyor (which I stopped the same year in favor of computer science). The school decided to teach us "computing", which was a good thing, but it was obvious they had not much experience and no good idea how this training should actually look like. Later the year we switched to a CAD software I never heard of, and never used again. But we started with "basics", and that literally meant we had to code some trivial mathematical algorithms in QBasic. I had quite some fun solving the tasks in a fraction of the given time, arranging them in procedures (a concept BASIC calls SUB) and adding a main menu as well as more mathematical functions the teacher never asked for. For some reason I still find the piece nice and somehow impressive given that it is so small and barely does have any features. No mouse support, not even cursor keys. I had no access to any resources or books and had to write the additional feature the teacher did not gave us with what I found in the back of my head. That was all I needed to impress my co-students.

Download the »Mathe« source code (PowerBASIC)

Life simulations (1995)

My fascination with life simulations was, no wonder, probably started by Conways cellular automaton, followed by several attempts to come up with my own stable simulation. The coolest I created featured green plants and gray herbivore animals. I was not able to stabilize it, not even remotely, but found exactly this fascinating. Each time I run my simulation, life simply explodes and eats itself. But some green plants are pretty much guaranteed to survive, along with a few lonely animals, stuck in a green jungle forever.

Download all life simulations source codes (PowerBASIC) (1995)

I also played around with random movements and was fascinated how easy it is to let something move and behave like a living being.

Screensaver animation featuring a single, randomly moving flash ASCII screensaver featuring two bouncing snakes

Download assorted source code snippets including both life simulation (PowerBASIC) (1994)