As a Teenager - DOS and Turbo Pascal

Early DOS Software

My First Program

Everything has a first. I don't recall if perhaps I started this file as a "Hello, World" application, but by the time I was ready to move on from "MyFirst", this is what it looked like. February 13, 1997

Program MyFirst;
  A,B   : integer;
  ratio : real;
  Write('Enter two numbers: ');
  Ratio := A / B;
  Writeln('the ratio is',Ratio)

Source Code: MYFIRST.PAS DOS Executable: MYFIRST.EXE

Guessing Game

June 26, 1997

Guess the random number. This was my first excursion into writing programs beyond the textbook example. I don't recall whether I had seen a similar program, or someone described the concept to me, but I liked the idea and painstakingly wrote each line of code, until the program did what I wanted. It generates a random number, and asks the user to "guess," revealing at each turn whether the guess is too high or low.

This project helped me to understand and experiment with control structures, and I became familiar with conditions and loops. Also, in actually "playing" the game, I learned some principles of using the "cut and try" method which I made use of in future programs.

Source Code: GUESS.PAS DOS Executable: GUESS.EXE

Musical Notes

January 24, 1998

Equal-Tempered Scale and Solving for the Twelfth Root of Two

Fairly early on, I was interested in writing computer programs to play music. I discovered a function that would emit a "beep" at a given frequency through the PC Speaker, and I knew I could play music with this, if I could only find out what frequency to play for each note. I didn't have access to any tables or formulas, but my dad had explained to me that each octave doubled in frequency. Using this knowledge, I assumed (correctly) that there must be some even ratio by which every note is related to the half-step above or below it. I had no idea what this ratio was (At this point I hadn't studied a lot in higher roots or fractional exponentiation), but I knew I could find it somehow with a computer program. The following code is what I came up with, to find this magic ratio: (I now know this is the 12th root of 2.)

Procedure FindRatio;
  Counter : Integer;
  LRatio,Diference : Real;

  LRatio := 0;
  Ratio := 2;
  Hz := 2;
  for Counter := 1 to 12 do
    Hz := Hz * Ratio;
  If LRatio > Ratio then
    Diference := LRatio - Ratio
    Diference := Ratio - LRatio;
  LRatio := Ratio;
  If Hz  4 then
    Ratio := Ratio - (Diference / 2);
 until (Hz  3.999999999);

Nevermind the fact that I didn't know how to spell difference (spelling never was my strong point), I successfully found the 12th root of two, and continued on to produce a listing of frequencies in the scale (Listen). Since I started with C = 256, rather than A = 440, my whole table was off by almost a quarter step, but I have since tested the code with a more correct starting point, and the program produces an accurate tuning table (Listen).

Source Code: NOTES.PAS DOS Executable: NOTES.EXE Listen to the Scale

Source Code: TUNER.PAS DOS Executable: TUNER.EXE


Solving Pseudo-Gravitational Acceleration by Stepping


An attempt at simulating orbital mechanics.


Flashcard drills for homeschool.

I could solve complex problems in computer programming in my spare time, but I still struggled with the basics of arithmetic, and especially struggled in spelling and memorization. So (perhaps with some encouragement from my mom), I wrote a program that both I and my brothers used to great success to overcome the lax areas.