Games

1K Chess Showdown

JavaScript vs a ZX-81 program from 1982

(The original version of this was published on my company blog in 2010)

The Tiny Chess submission to JS1k impressed me. I’m terrible at Chess, and made several rash moves out of complacency and curiosity, but it’s still strangely humbling to be defeated by 1014 bytes.

1K ZX ChessIt reminded me of 1K ZX Chess (actually 672 bytes) for the ZX81 (explanation and source code). And then I noticed that one always plays as black, the other as white.

So, which is better: Tiny Chess (black) or 1K ZX Chess (white)? There’s only one way to find out…

Opening

It’s all pawns early on, and I’m crossing my fingers that none of the little blighters will reach the other side, as 1K ZX Chess doesn’t support promotion.

Then white slices forward with a bishop to put black in check, with Tiny then using a pawn for defence. ZX clearly played chess at school during lunchtimes, where the first check was hugely important and had to be announced with maximum pride.

Mid-game

After much dithering about on both sides, black eventually swoops in, taking a rook then bishop without the queen even retaliating. Tiny is on the offensive.

White loses more pawns then a rook and knight, before sacrificing a bishop for a mere pawn. Things are starting to look bleak for tired old ZX.

Endgame

Black moves in for a pawn and a check.

As the king moves away, black’s rook takes the beleaguered knight.

Soon the queen is gone too, I can hardly bear to look…

But hang on a second, what’s this? Stalemate!

Yes, after making full use of its extra 342 bytes to advance with savage brutality, Tiny Chess blew it right at the end, allowing plucky 1K ZX Chess to snatch a draw. David Horne’s 1982 program can hold its head high.

(The creator of Tiny Chess, Óscar Toledo G., later emailed to let me know that this blog post inspired him to create an improved version that tries to avoid stalemate)