Nostalgia: Turbo Pascal 5.5

I recently noticed that Borland made the famous Turbo Pascal 5.5 available for free download. I couldn’t resist to give it a quick run:

During my college years at University of Bucharest this was the development IDE that everyone used it. I liked it because it was extremely fast and easy to use. Especially on the antique computers in our lab. I vaguely remeber that we had some 80286 4 MHz with just a 1 MB of memory. Now even my cell phone has more than that!

Every couple of months, we used to have regular programming contests when we had to solve five problems in around 2-3 hours total. Which means that you had to come up with a fully working program in around 20 minutes. If you got any bugs, you got another “virtual” 20 minutes added to your score. At the end, you would win if you had the maximum number of correctly solved problems in the least amount of time. To my shame, I never won the first place.

Some problems were trivial, some were quite interesting. You also had a number of challenges from the environment. First, you were limited in 640K of memory usage of course (and Turbo Pascal had even more limitations on its generated memory layout), so you had to be creative when designing your data structures. Otherwise you would run out of memory. Second, the program had to complete the execution on all data sets in less than one minute. And some of these data sets were quite large…

Here are a few interesting problems that I still remember:
1) Given N (x_i y_i) points in a plane that have a certain assigned color, either red or blue, find a line that divides the plane such that one part contains only red points, and the other one only green points.
2) The result of the latest elections in a country is kept in a single file in a succession of pairs (X, Y) where X is the ID of the citizen that voted citizen Y for president. There is no initial list of candidates. Write a program that establishes the president. BTW, the input file had a significant size, and you had to find the solution in one or two passes.

Comments (8)

  1. Nicholas Allen says:

    5.5 was the first object-oriented version of Pascal, but the real gem of the series was 6.0. That was the version that dramatically overhauled the editor, compiler, and tools, and got the kinks out of the included OO library.

  2. Adi Oltean says:

    Yes, I also used TP6 a lot. Turbo Vision was a work of art… this was my firstcontact with an object oriented, message based windowing system. It was pretty nice to work with…

  3. Mr Blobby says:

    Regarding puzzle 1: It seems impossible given that the points are red and blue but you are asked to partition them into red and green 🙂

  4. matt says:

    Ahhh… good times, good times.

  5. Adi Oltean says:

    >> Regarding puzzle 1: It seems impossible given that the points are red and blue but you are asked to partition them into red and green 🙂

    You are quite right. Red and Green dots only 🙂

  6. You would be surprised to know that Turbo Pascal is still beeing teached today at the Romanian Universities and highschools. 🙁

    Anyway…ahhh…the good ol’ days of the 286.

  7. Adi Oltean says:

    I’m not surprised. Actually, I would incline to think that Pascal is pretty good as the "first" programming language, especially for highschool level.

    C# might be a good alternative too, especially for teaching algorithms, since it is so easy to use predefined data structures like lists, dynamically allocated arrays, etc. When teaching algorithms written in C#, you focus on the subject, not on the programming language limitations.

    Although I know some people that would say that using C# (or Java) as the firs tprogramming language creates some sort of permanent brain damage. Switching to C++ will be harder because you will always forget to cleanup allocated memory when you don’t need it anymore. Or you won’t know how to do the simplest things, like creating a double-linked list. Well, what can I say. The truth is that the ArrayList class is so addictive…

  8. Ovidiu says:

    Having dealt with computer science students as a teaching assistant, I think they should spend at least half a semester to build some foundations (like learning what an algorithm is and some basic programming principles), then using a light programming language like Pascal for basic algorithms and data structures and only after that they should move to C++. Later on they could easily move to managed environments like .NET or Java.

    This was the path I followed thanks to my highschool teachers and so far it worked fine for me. Having seen people coming from a managed world (like .NET, JVM or the pseudo-managed, yet complexity-hiding VB6) write C++ code, I think it’s the best approach.

    Oh, and professors or teaching assistants who teach dubious features of C and C++ to their students and showcase them as "powerful features" should be locked in a dungeon and the key should be thrown away. I’ve seen cases in which students index arrays starting from 1, hardcode constants or write horrible one liners but never heard of asserts or traces and can’t deal with the basic features of the language.