The greatest program ever written

How do you think, which of existing programs can be called the greatest? Can you say about one of your programs that it is cooler than the others? There is an opinion which is not unreasonable that such program was written by David Horn in 1983: “1kb chess on the ZX81”.

chesspic

David Horne is not an urban myth. David Horne achieved what many would even now consider impossible. He wrote a chess game, with AI, that ran on a poorly documented, buggy machine that contained only 1k of memory.

The Sinclar ZX81.

Think about that amount of memory for a moment. 1 kilobyte. 1024 bytes. Can you write down the rules of chess in less than one thousand characters? That’s a tricky task in itself. Fire up you favourite compiler, and build a minimal application. I’m guessing that its more than 1k in size, and it doesn’t do anything yet.

But wait a second. 1k was the capacity of the machine. How much was actually available? The answer, as you will find if you follow the link at the end of the article, is a meagre six hundred and seventy two bytes! This article takes up more space than that.

And it had AI. Not very tough AI mind you, but AI none the less. So not only could is display the board, verify the your moves according to the rules, and detect a win or a draw, but it could select moves for itself and play them.

All this and more. He not only conceived and executed the idea that a game of chess could be packed into so few bytes, but he published the source code, along with a detailed explanation of how it was done in the February 1983 issue of `Your Computer’ magazine. This article is essential reading, a trip down memory lane for those of us old enough to remember those furious, exciting 8 bit days, when the limitations defined the experience of programming, and an important piece of history for those brave young hackers who take for granted the luxuries of life, like compilers, swap space, and keyboards that click.

So, David Horne, if your out there – this is for you. I, and I’m sure, my fellow programmers, bestow upon you this honour: You, sir, created The Greatest Program Ever Written.

Original source – http://thad.frogley.info/

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s