The Archeology of Computer Programming

TL;DR You can skip any time to the 20-second movie at the bottom of the post. Spoiler alert: the video will eventually reveal the solution to the puzzle.

Happy New Year! I just returned from a quick family trip to Seattle, and you would think that this post would be about my visit to the Living Computer Museum with my cousin Eric, and programming adventures now 50+ years ago in the RESISTORS. But it’s not, as worthy as those topics are.

Actually it all started when I read a post by Ben Orlin on his Math With Bad Drawings site about Evelyn Lamb‘s Page-a-Day Math Calendar, recently published by the AMS. One thing led to another, and my son Ben was kind enough to give me a copy for Christmas.

So I peeked ahead a bit, and on January 10 there is a “cryptarithmetic puzzle,” in which letters stand for single digits in an arithmetic problem, and you have to figure out which choice of digits will make the arithmetic problem correct. Her fun example, which she credits to Manan Shah, is this:

Manan Shah’s puzzle, from Evelyn Lamb’s calendar

(Get it? 1/10 is a member of a small club of dates that can be written using only zeroes and ones.)

Well, this one sent me back into my programming archives. When Ben (my son, not Ben Orlin) was 10 or so, he came to me and asked if I would sign his math homework. He explained that in his class, if a student worked the homework for an hour and a half without being able to complete it, they could get their parents to sign it. This was the first and only time that this happened, and it turns out that it was a cryptarithmetic problem. I probably spent an hour on it myself without any progress.

I hadn’t programmed in a long time, and writing a program to solve this seemed like a potential way to get Ben interested in programming. At the suggestion of my friend David Coletta, I started learning Java, partly because you could embed code in web pages pretty easily. I eventually wrote a Java applet and posted it; as of today it has had almost 2600 hits according to the little hit-counter I found somewhere and embedded in the page. (These are undoubtedly not “unique hits.”)

This was around 2003, and it has gradually gotten increasingly decrepit. It worked fine in Internet Explorer, but when Chrome came along the text field for entering the formula became a slit. It still worked, if you didn’t care about actually seeing the formula you’d typed in. Then browsers stopped supporting the plugin that let you run Java applets, but you could still run it under Internet Explorer if you dusted that off. Today when I tried, even that didn’t work.

But I wondered if there was some way to resurrect it. I thought briefly about rewriting it in Javascript, but it’s actually a fairly large program, and not worth that much time. It turned out to be fairly easy to solve the text-slit problem, which was encouraging, fortunately or unfortunately. There is a not-yet-dead technology called Java Web Start, but apparently it will be dead soon and I had trouble cranking it up. It took me most of a day to accept the truth that “Running Java in the browser is dead.”

Just when it seemed that all was lost, I ran across a website (repl.it) that lets you write and post example code in many different languages. It supports not just Java, but Swing, the horrible graphics library that was in use at the time. So now it is up and running. If you try it, be patient, it takes quite a while after you hit the “Run” button to actually start up.

I almost said, “happily up and running,” but really does not quite make it to “happily.” The repl.it support for Swing still has some kinks to work out… like, the shift key doesn’t work. So you can’t type “zeroes+ones=binary” into the formula slot. Fortunately, it is a pretty good program, and you can type “zeroes=binary-ones” and get the answer. I slowed it up so that you can watch the digits flip, and that part looks better when it is running locally, but oh well. Also, the applet looked quite shrunken until I realized you could get it to be a reasonable size by dragging the dividers to resize the panes.

To do this, I wound up putting the source code on GitHub. There is now a decent amount of explanation in the README file, including instructions for the simplest way to run it locally, which is in VS Code. [Edit Jan 22, 2020: this actually got me started on dusting out my old garage of programming projects; you can click to see the cleaned-up results.]

It turns out that Ben didn’t get interested in programming until a few years later, but since then it’s been an on-and-off hobby of mine. It turns out there were a few other projects whose technologies are obsolete, although I did migrate the Minesweeper game to Javascript, minus some of the more interesting features. When I complained about Swing, David Coletta suggested I learn Flex, and there were a couple small Flex projects in various states of incompletion. Alas, poor Flash player.

Although these technologies are not exactly shiny and new, I don’t think that there is any technical reason why they couldn’t still be made to work. These programs are obsolete as a result of commercial decisions by the colossi of Apple, Oracle, Google, etc. Not that it makes any difference in my case, but clearly many companies have had to devote huge amounts of time to finding alternate solutions when some of these options are no longer possible.

Edit Jan 8, 2020: no news from repl.it about bug fixes (not very surprising consider that they seem to support about 40 computer languages). I did some experimenting with Webswing, which seems to be very well done; at some point I may give it a real go. But then it occurred to me that since I have it running on my own computer, I could just make a video and post it. Duh. (It’s only 20 seconds long.)

[Edit Feb 3, 2020: eerily enough, the same calendar, on my birthday, had the puzzle “TWO+TWO=FOUR,” to be solved in base 8, where it said there are 5 solutions. I fired up the program and, lo and behold, that is correct!]

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.