34

Writing A Very Tiny Chess Program

 5 years ago
source link: https://www.tuicool.com/articles/hit/yYvUryA
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

When programming for modern platforms, the restraints are different to those of 30 years ago. Back in the dawn of the microcomputer age, storage and RAM were measured in kilobytes. It simply wasn’t possible to store large amounts of graphical data, and even code had to be pared back at times. [reeabgo] found out some of these limitations first hand, when coding a tiny chess program for the Sinclair ZX81 .

[reeabgo]’s project goes by the name ChesSkelet, and is truly tiny. Measuring in at just 377 bytes in its smallest version, the entire program takes up less space than this very article describing it. To achieve these feat requires certain sacrifices, of course. The tiniest edition contains no graphics whatsoever, representing the game state with simple characters and featuring no adornments whatsoever. The full-fat version comes in at 477 bytes and adds quite a lot of functionality. There’s a proper checkerboard, along with move legality checks and pawn promotion.

Unfortunately, advanced chess play isn’t quite possible – castling is not implemented, and the AI doesn’t yet handle check situations properly. Despite this, it’s a solid approximation of the real game, all packed into an impressively small space.

We see plenty of chess hacks around these parts – including the robotic variety .


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK