The greatest program ever written

I'm a programmer. I write games. Games programmers get a lot of respect, but none of them, not me, not Carmak, and not Abrash. None of them deserve the honour which I want to bestow on David Horne. This is because David Horne wrote the greatest program ever written: 1k chess on the ZX81.

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 you're 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.

Originally posted to kuro5hin on Aug 10, 2001, here: http://www.kuro5hin.org/story/2001/8/10/12620/2164, & Subsequently discussed on reddit, here: www.reddit.com/r/programming/comments/2y1hex/the_greatest_program_ever_written/.

You may also enjoy: An introduction to C++ Traits, "Using typedefs to write maintainable code" or "Iterators".