1K ZX Chess – a tiny game

1K ZX Chess is a program that has gone down in the history of computer science. Over the years, it has been an excellent example of optimization.

1K ZX Chess – a tiny game

The ZX81 was one of the first 8-bit computers, in its basic version it had only 1KB of RAM. Nevertheless, it has thousands of games and programs in the form of both listings and applications distributed on tapes. The machine could be expanded with modules extending the available memory up to 64 KB. From today’s perspective, it is fascinating how much could be squeezed out of the basic 1KB version.

One of the memorable programs, engineering masterpieces, is 1K ZX Chess, which, as its name suggests, allows you to play chess against the computer, the entire application is only 672 bytes. Let’s have a look.

The computer will always play white, it will always start with one of the two moves, either 1.d4 or 1.e4. To make a move, we enter the number and letter of the figure we want to play and then the number and letter of the field we want to go to, e.g. e7e5. The computer will analyse available moves and make its turn. Almost all chess rules are implemented, except promotion, castling and en passant. That’s it. The program is not a master-player but also not a stupid one, it takes some thinking to beat it.

Since it was published (as an article containing code listings in a British computer magazine Your Computer) in 1982, 1K ZX Chess was known as world smallest computer game of chess. This record was broken in 2015 by demoscene team Red Sector Inc, who published BootChess – game in only 487 bytes.

Links: Play online / download