1981 1KB Computer vs. Modern PC: CHESS | Nostalgia Nerd

1981 1KB Computer vs. Modern PC: CHESS | Nostalgia Nerd

Here is a copy of 1K Chess for the Sinclair
ZX81. Developed by Artic and released by Sinclair
Research in 1982, it was one of the few playable programs that would happily run on an un-expanded
Sinclair ZX81. This is because a standard ZX81 has only 1KB
of RAM, which is a pathetic amount of memory to run anything of substance. To display a full screen alone would consume
793 bytes, however through creative genius, David Horne, the programmer of this game,
has managed to pack a playable version of chess into just 672 bytes. We’re not talking a 2 player game here either,
this is chess against the computer. Yep, that 672 bytes also contains the code
for an AI opponent, and for most of us, it puts up a pretty good fight. The program was also included in a 3 part
series of Your Computer magazine, from December 1982 to February ’83. These listings were where many of us sourced
games from in the 80s. Here you can see the BASIC program listing,
which consists of only 4 lines of basic, but with two of those occupied by chunks of machine
code, handily stored under a REM statement. Here’s the machine code listing, which looks
even more daunting, and it kinda is, but it’s also a work of beauty, and an incredible exercise
in what can be created in such a limited space. So in one of my late night musings, I pondered
whether this little program would be able to beat a more modern game of chess. Now of course, this isn’t really the ZX81
vs. a modern computer, it’s a 1KB 1982 chess engine vs. a more capable chess engine. We could get hugely bogged down in that notion
alone, given there are so many chess engines of differing abilities, but I wanted to keep
things simple. This isn’t a scientific test by any means. Windows, is a platform I use everyday, so
why not pit Windows Chess against 1K chess? Of course Windows 10 is devoid of games, even
minesweeper, but Windows 7 came with a number, including Chess Titans.. and thanks to ElDiabl0
from mydigitallife.net we can grab the Windows 7 game collection and run them on 10, with
ease. So, here we are. On the left is Chess Titans, set at the standard
difficulty level of 2 (pretty low). On the right is 1K Chess, ready and willing
to fight. Given the limited space, 1K chess always opens
with a White Queen Pawn move, or if you load side B of the tape, a White King Pawn move. This is side A, so we have our first move. I can then translate this move onto the Chess
Titans board and we’re away. On the face of it, things were looking pretty
even, with both sides playing defensively. But then the game had to stop, and not because
someone won, but because of limitations in 1K chess. Although Titans is programmed with all the
chess rules, 1K doesn’t allow for pawn promotion, or castling. Therefore this pairing isn’t an ideal one. I could keep playing games until I get one
where Titans doesn’t attempt to castle, but I felt it was fairer (and easier) to find
a game which allows you to disable these elements. That game came in the form of an engine, known
as StockFish. It’s an open source engine and it packs one
hell of a punch. I mean, it’s the best chess engine out there,
and can easily beat human opponents. So as for our 1K chess, yeah, things are looking
a little grim. Here’s game one running on the Arena front
end, with Stockfish running as-is, out of the box, playing as if it were a 5 minute
tournament match. You can see the Stockfish calculations down
here, where-as 1K chess actually runs through its possible moves on the board, mainly to
conserve memory. The program is broken into a number of elements. We have an STR routine which scans the board
and finds which squares are occupied and by which colour, the Piece routine then creates
pointers to possible moves and then the Move & Pawn routines narrow that down into a legal
list. The Check routine scans for a possible check. Finally the Score routine scores each move
based on where it can take a piece, whether the current position of a piece is under attack,
whether the new position can be attacked, then whether a check is possible and finally
whether the original position is defended. Scores for each move are compared and added
to the scores for each chess piece, and the highest scoring move is made. It’s a pretty basic formula which doesn’t
offer much room for planning ahead, and so it doesn’t take long for 1K chess to be on
the backfoot, and out of the game. Game two is with Stockfish set on a much lower
skill level, and although things look promising for 1K chess to start with, that ends when
you realise that things weren’t actually looking promising to start with at all. So 1K chess is no match for this new engine,
but then of course it isn’t. Still, the fact that you can even play against
a 1K chess program is still frankly phenomenal, and that’s really the main point of this video;
To illuminate the incredulity of 1K chess and show that even in the most dire of circumstances,
and faced with enormous restrictions, amazing things can occur. Talking of amazing, in 2015, 1K chess was
actually beaten by a PC Booter program; BootChess to become the smallest AI chess program at
just 487 bytes. Now that would be a fairer match, and one
I’ll likely do on my extra channel in the near future. If you get a moment, I’d recommend booting
up 1K chess and giving it a blast, or better yet, type it out from the Your Computer listings. Thanks for watching.

100 thoughts on “1981 1KB Computer vs. Modern PC: CHESS | Nostalgia Nerd

  1. Global Thermonuclear War could also apparently run on less than 1KB of RAM, and it almost started World War III.

  2. How about AlphaZero vs. ZX81 1K Chess?
    Seriously love this. I remember playing 1K Chess on my ZX81. Part of the joy of early home computers was doing so much with so little. I'm still blown away by how David Braben and Ian Bell created Elite, an 8 galaxy 3D space battle/trading game on the Acorn BBC model B with 32K RAM minus the screen memory, so only about 24K available for the program.

  3. You don't need much power for an automated chess machine. But if you want an A.i. chess machine, that's a whole other story. Not even a modern PC does the job in real time. It has to be something like IBM's Deep Blue. And by "A.i" I actually mean actual machine learning and prediction based on learning, not the usual crap that people call "A.i" in games, that's not real A.i.

  4. This was a fascinating video! I'd love to hear about whatever other quirky or novel things you've found in old program listings!

  5. haha wow. chess AI coded in less than 1k memory. that's pretty impressive however you look at it. too bad no pawn promotion, etc. not really chess when you leave out stuff like that.

  6. On the subject of impossible feats of programming I recall a 1K program which was designed as a mappable adventure game in the magazine sinclair programs, probably around 1982.

  7. This takes me back to the Spring of 1982 having spent my hard earned money from untangling smelly fishing nets all through the Winter and placing an order for the ZX81 in kit form. Being 10 years old at the time it took me a while to solder together and my uncle had to help me trouble shoot some dodgy solders but it worked. And painstakingly typing in the 1K chess and seeing it work was tremendous fun, and set me on a path to become something different, and dare I say better, than a fisherman like the rest of my family was.

  8. So pointless video, which leads on to you doing the video you should have done but on another channel of yours? what a twat👏👏👏👍

  9. My first computer but I never had chess. I did have a flight simulator that ran with the 16k memory expander.

  10. Nostalgia Nerd I used to have a portable Sega CD/Genesis console. Do you have a video on that, thing was great.

  11. 600 bytes is truly amazing. At first I assumed they were using libraries which is kind of cheating (you can just shift a lot of 'common' code into the libraries) but that doesn't seem to be the case here. At least on the surface.

  12. I always get a chuckle when I see the ZX81. The failed Timex iteration released in the US was my older brother's very first computer. He still has it and keeps it on his work desk.

  13. As an a big fan of our little old guy, the Zilog Z80 , I'm constantly impressed with what people did with it in such humble devices like the ZX81!

  14. Wonder if he wrote the machine code directly or used an assembler … Impressive either way … although, when you described the algorithm, it wasn't hard to predict that it was going to be a bloodbath .

  15. I remember this coming out – and it beating me, but I don't play chess normally and I expect it's pretty easy to beat if you do.

  16. Incredible how resourceful programmers were back then. No IDEs or libraries to work from either, all written from scratch.

  17. 3:08 even you say? None of the white pieces are developed! thousand pawn and rook moves! Black’s position is just so much better.

  18. Reminds me of what I did against Stauf in "The 11th Hour". I couldn't beat the last puzzle against him, so I find out that it's basically a game called Pente. I found a Pente game online where you play against the AI and then let Stauf play the website AI. I was really surprised when Stauf ended up beating the website AI! So I had to find a better AI somewhere else…

  19. A chess program that doesn't allow castling and promotion is an interesting program, but certainly NOT a chess program.

  20. I had chess ♣ on my 286 runing windows 3.0 that game only had black and white or green only colour I can remember

  21. I can remember pitting my atari 2600 against my CPC 464 with chess…was so cool…the delays beyween moves got longer and longer until it must have been 45 min or more..thats where my patience ran out… 🙂

  22. 1k chess can't promote pawns or castle? Sorry, I lost interest. I thought you said this was a Chess program.

  23. Very cool video. Programmers have easy these days. It had to be done in machine code. Using a high level programming language would eat up all the memory. Considering it's easy to chew up 600 and something bytes with a simple text file creating a functional chess game with AI is amazing!

  24. I had a ZX81 and was amazed at the 1K chess program then. 3D Monster Maze was the other brilliant 1K software offering…Or was it in 16K? The Spectrum was pushed to its limits with amazing 3D from Knight Lore and Alien 8 programmed by Ultimate, both looked fantastic and played very well on 48K.
    Chess Master on the Game Boy was good too. EDIT: Chess playing stand alone computers were popular in the 1980s and there were dozens of different types available. Atari had an early chess program too, on cartridge which was usually 4K.
    Great videos, I subscribed.

  25. The first computer v computer chess match was between Moscow Institute of Physics v Stanford University. Played via telegraph over a few months, the Russians beat the Americans… !966/67

  26. My first computer chess game was called Chess Genius for the Palm Computing Platform, it was an average 168k or memory, the smalled chess game I could find for a Palm system was 29k, 1k is simply astounding!

  27. With proper optimisation, you'd think that all modern games could fit into about 50MB each. I wonder if it's actually possible…

  28. Try Titan Chess against QL's Psion Chess to see the ultimate Sinclair computer chess program. It could thrash many poor android chess games I've tried, that's for sure – mind you some are so bad it's like they're trying to lose after a few moves.

  29. I had a C64 when the Timex/Sinclair ZX81 came around in the US. I used to type in the BASIC programs that came in books and magazines, so I knew a bit about what it meant in those days to save bytes of RAM as much as possible in keying-in programs, while also trying to squeeze in as much as possible into every byte of the program. Impressive, to say the least.

    The Timex/Sinclair ZX81 was a very poor idea for a product at that time (totally credible wrist-watch company notwithstanding) and a terribly useless platform (no color, no sound, 1K of RAM, shrunken flat plastic "keyboard", etc., for like $99USD– Are ye mad!?)*– a total waste of money to buy one, I thought when seeing the ads in my computer magazines. But the (one?) guy that wrote that chess program is plainly a computer-programming genius, despite that awful platform. Heh, that platform should be/should've been thanking that computer-chess programmer for that excellent work of his behalf, yes hehehehe

    * http://www.ganjatron.net/retrocomputing/zx81/cc128207a.jpg https://youtu.be/4F4qzPbcFiA

  30. Seeing a lot of complaints about bloat in modern software. In most cases, we've traded bloat for faster development time, and it's a wonderful trade to have the option of making.

    Relative even 20 years ago, companies can develop software 10x as efficiently. This often means doing the same project with a tenth of the developers (which enables companies to tackle niche markets) or doing the same project ten times better (for example, to make the Stockfish the best engine in the world). I once spent two weeks eliminating ~10ms of lag from a common low-level interaction. Companies still create performant software, but only when it makes business sense.

  31. нихуя не понял на вашем нерусском , типа алгоритм спектрума был крут))?

  32. Fun! I wasn't cool enough to have a ZX81 while in school. I had a VIC-20. I remember a friend's ZX81, he had the printer, too. It printed out on receipt paper, or something very similar. Looking back, we had no issue printing out a bunch of code on long lengths of that paper and walking through it to find a bug. If you asked someone to do that today, they would probably freak out, complain, and try and Google the answer.

  33. I had ZX Spectrum and there were strong Colossus Chess. There is game with Stockfish: https://www.chess.com/forum/view/game-showcase/sinclair-spectrum-collosus-4-0-vs-stockfish-8-0

Leave a Reply

Your email address will not be published. Required fields are marked *