
1K ZX Chess - sjcsjc
https://en.wikipedia.org/wiki/1K_ZX_Chess
======
bdz
Source code

[http://users.ox.ac.uk/~uzdm0006/scans/1kchess/](http://users.ox.ac.uk/~uzdm0006/scans/1kchess/)

Actually it's the 3rd part of the full series, makes more sense with the
previous articles

1st [https://archive.org/stream/your-computer-
magazine-1982-12/Yo...](https://archive.org/stream/your-computer-
magazine-1982-12/YourComputer_1982_12#page/n67/mode/2up)

2nd [https://archive.org/stream/your-computer-
magazine-1983-01/Yo...](https://archive.org/stream/your-computer-
magazine-1983-01/YourComputer_1983_01#page/n79/mode/2up)

3rd
[https://archive.org/stream/YourComputer_198302/YourComputer8...](https://archive.org/stream/YourComputer_198302/YourComputer8302#page/n99/mode/2up)

------
spacehome
It's hard to reconcile this:

> It was the smallest implementation of chess on any computer until its record
> was broken in January 2015 by the PC-compatible BootChess.

with this:

> 1K ZX Chess uses only 672 bytes of RAM,[2] but implements chess rules except
> for castling, promotion, and en passant, including a computer opponent.

If you don't include castling, promotion, and en passant, the game isn't chess
anymore, or at least it hasn't been for a couple hundred years.

~~~
pmden
I believe boot chess also does not implement two of those three, which makes
it a fine comparison. Promotion is something I expect most people know,
castling is something they might know, but en passant is hardly common. I
wouldn't be at all surprised if the number of people who play chess without
knowing that rule exceed those who play by FIDE rules.

Whatever the case, it is still a variant of chess, so I see no problem calling
it chess.

~~~
umanwizard
Promotion shouldn't be compared to castling/en-passant here.

A game without castling or en passant would be similar enough in spirit that
we could call it a "chess variant". Removing promotion, on the other hand,
would result in a wildly different game.

I actually suspect it'd be impossible to win against any non-beginners, making
it more similar to tic-tac-toe than to chess.

------
schoen
See also [http://nanochess.org/chess4.html](http://nanochess.org/chess4.html)
(discussions and links to 2K and 1K Javascript implementations).

"Take note that the 1018 octets of my Javascript code include an artificial
intelligence and also the user's interface and chessboard visualization"

------
pmontra
There was Psion Chess for the expanded ZX81 (16 KB RAM.) I still have the
cassette. The instructions on the cover explain how to castle and state that
it recognize en passant. No mention about promotions but they should be
supported.

Load time "3.5 mins approx." I remember that I lost every signore game against
it but it wasn't very fun because it used fast mode and I couldn't see the
screen when it was thinking.

------
m1el
There's also an implementation of chess in 1K of JS:

[https://js1k.com/2010-first/demo/750](https://js1k.com/2010-first/demo/750)

------
classichasclass
Microchess on the KIM-1 says hi. ZX Chess is still smaller, and actually has a
display, but this wasn't a lot bigger and appeared on other 6502-based
systems.

[https://www.floodgap.com/retrobits/ckb/secret/microchess.htm...](https://www.floodgap.com/retrobits/ckb/secret/microchess.html)

------
antirez
> It was the smallest implementation of chess on any computer until its record
> was broken in January 2015 by the PC-compatible BootChess.[4]

It would be interesting to compare x86 and Z80 code density, that is, how much
you can do per bit of machine code.

~~~
flohofwoe
Not a 'scientific' comparison, but handwritten 8-bit machine code compresses
much less than x86/64 machine code (using gzip --best):

\- a compiled C executable for x86/64 compresses to about 38% of its original
size (199 KB down to 77 KB)

\- a WASM blob of the same code compresses to about 32% (171 KB down to 56
KByte)

In comparison some 8-bit ROMs:

\- ZX Spectrum 128 ROM (Z80): 16384 bytes compresses to 12189 (74.3%)

\- C64 Kernel ROM (6502): 8192 bytes compresses to 6735 (82.2%)

So 8-bit code seems to be a lot 'denser' than today's machine code, and 6502
is denser than Z80 :)

~~~
schoen
That's interesting! Do you think this is because 64-bit code simply doesn't
use a lot of its instruction set space (where more opcodes and instruction
modes and variants are undefined and therefore not routinely used in
executables), or because some of the people hand-writing 8-bit assembly
actively use more opcodes than a typical compiler would, or some other
factors?

Or are there are a lot of pointers in 64-bit code that contain a huge number
of zeroes? :-)

~~~
flohofwoe
I guess it's a combination of compiled vs handwritten code (maybe certain
patterns show up more often in compiled code, while handwritten 8-bit code
tries hard to remove any redundancies because of the limited available space),
and bigger data types (especially 64-bit pointers).

------
aj7
A chess program without castling, promotion, and en passant is incomplete. It
is not chess, it is a work in process.

~~~
johnklos
Let's see you do better ;)

~~~
xiaoxiae
I mean he is right, and it's even said in the article. It is an amazing piece
of software, nobody's arguing against that, but it's not chess.

