facebook rss twitter

Computer chess program written in just 487 bytes of code

by Mark Tyson on 29 January 2015, 13:04

Quick Link: HEXUS.net/qacogw

Add to My Vault: x

A long standing record for the smallest amount of code required to implement a fully-playable game of computer chess has been broken this week. Demo scene group Red Sector released BootChess, which is written with just 487 bytes of code. It easily trumps the 33 year record held by David Horne's 1K ZX Chess which was written in, as you might guess, 1K of code.

1K ZX Chess

The feat of coding efficiency represented by BootChess is all the more impressive today when some games require install sizes of 50GB or more, then require huge downloaded updates before they will actually work.

Red Sector member Olivier "Baudsurfer/RSi" Poudade wrote BootChess in assembly language with extra help of Peter "QKumba" Ferrie. The code is compatible with Windows, Linux, OSX, DOS, BSD, DOSBox and Bochs. The name is 'BootChess' simply because the program is small enough to (optionally) fit on the bootsector of a floppy disk. The full code with comments is available here and an archive containing more details, resources and other files is available here.

BootChess

In the BootChess documentation Red Sector says the tiny chess program was coded to celebrate the group's 30th anniversary. In the distant past this program might have been placed on a floppy disk boot sector to be distributed and to run it, but nowadays such 'assembly art' works are known as 'sizetros'. As such a 487 byte program isn't so small as Red Sector, and other demo groups, regularly create sizetros in the confines of as little as 64 bytes of code.

BootChess is 'fully playable', reports Geek. However it isn't a comprehensive chess game with all the rules and moves available or a smart AI - but neither was 1K ZX Chess - both programs implement most chess rules. For instance castling, queening, and en passant capture are missing from 1K ZX Chess. BootChess also leaves out castling and en passant capture but queening was shoehorned into the code.



HEXUS Forums :: 3 Comments

Login with Forum Account

Don't have an account? Register today!
The spectrum version has (better) graphics!
shaithis
The spectrum version has (better) graphics!

Even back in the heyday of the Spectrum you wouldn't have heard that very often. The C64 often caused graphics envy back then.
mtyson
shaithis
The spectrum version has (better) graphics!

Even back in the heyday of the Spectrum you wouldn't have heard that very often. The C64 often caused graphics envy back then.

It was actually written for the pre-Spectrum ZX81, so that makes it even more astounding!