6

Does anyone know of any efforts to write modern chess engines for old hardware? (e.g. C64, A2e?)

I'd love to see how a pared-down Stockfish or Leela that could fit in RAM could do rating wise etc.

Surprisingly, I can't seem to find any efforts of people doing this online (to me seems like a fun / informative pursuit).

You can imagine Leela or Stockfish using a compressed NN eval function that can fit in memory (using perhaps low-precision weights) doing pretty well.

Interesting side question: what wins, (reduced) Stockfish on old hardware, or old C64 chess programs (like Colossus, around 1700 rating) on new hardware? I'm guessing the former.

9
  • Aside from the performance issues, there are unlikely to be any compilers for C64-era computers which support any programming language resembling modern C (let alone modern C++). – alephzero Mar 30 at 14:56
  • 1
    Cc65 is a modern c compiler for 6502. Many folks write programs for c64. Anyway you could always port to c64 assembly.. – dashnick Mar 30 at 23:41
  • Well, RAM is less of an issue, as some classic systems have been expanded quite far, already back in the days. It should be possible to stick even large networks in RAM (or ROM) . More relevant is speed. A ~1MHz 6502 is incredible slow. So unless there is (literally) unlimited search time, an engine needs to provide extreme compact access algorithms based on next to no calculation overhead - hard to do with the FP often needed. Adding a 9511 card (like Redshift or AP-1) would only help so far. – Raffzahn Mar 31 at 12:01
  • 1
    If you can fit it into 24-bit (16MiB) memory, it should be feasible on expanded 8 or 16-bit retrocomputers. A C64 or C128 with 16MiB REU swaps memory very quickly. Modern AII expanders less quick but decent. A IIgs is also a good example of slow CPU and (relatively) large memory. – Brian H Mar 31 at 16:53
  • 1
    @dashnick Cc65 is a modern c compiler for 6502 -- maybe, but very few modern C programs will actually run as intended if compiled with it. Use of auto variables and large parameter lists will very quickly fill the 256 byte stack, not to mention that accessing them will be very slow due to the lack of pointer+offset relative addressing modes (which will also kill any Z80 ports). – occipita Apr 1 at 20:51
10

Leela is not going to fit in an 8-bit machine, period. The NN weights take many megabytes to represent.

It's conceivable that Stockfish's evaluation function could fit - I think it's only comparable in complexity to some of the better 8-bit engines (eg. those by Ed Schröder). However, Stockfish's main strength is that it can do a lot of searching very quickly, which requires large transposition tables - which will not fit.

Most 8-bit chess engines relied on a relatively sophisticated evaluation function and a much less sophisticated search function, which was not able to search very deep in the game tree. That fitted well with the slow CPUs and limited RAM of the time.

Subsequent developments allowed searching deeper and more efficiently using faster CPUs and more RAM; the 68020 and ARM were popular in dedicated chess engines after the 6502 was superseded.

Only very deep searches allow using a simpler, more naive evaluation function, which itself is a tradeoff to further increase search depth. And only the extra RAM of modern machines permits doing the deep, smart searches, even with unlimited time. These are inherently unavailable to vintage hardware.

5
  • Agreed, although I think a smaller, low precision net "inspired" by Leela is still possible. Anyway, my original question stands, isn't this an interesting problem? – dashnick Mar 30 at 23:42
  • @dashnick Possibly, but I anticipate you would end up reinventing all the tricks the old-timers used to squeeze a workable chess engine into an 8-bit CPU in the first place. Also, I seriously doubt that any "small" version of Leela would have anything even slightly resembling her performance. – Chromatix Mar 31 at 3:14
  • 1
    Erm ... not sure why 'many megabytes' should not be possible with 8 bit systems? Banking has been used with many systems. I've seen Apple II with 8 MiB back in the days - that is standard II+, not IIe or IIgs. The original Apple RAM card offered up to 1 MiB RAM, while RAM-Factor did 4 MiB, each per card. Since the the question is about porting it nowadays, I would as well include new designs and large Flash banks. The only real issue with this is accessing the data, as CPU speed is rather limited - still, it can be imagined. – Raffzahn Mar 31 at 11:56
  • @Raffzahn What software allowed you to use 8 MB RAM? Ramdisks or visicalc? – Thorbjørn Ravn Andersen Mar 31 at 13:29
  • 1
    @ThorbjørnRavnAndersen and most important Apple Works. Almost forgotten today, but Apple Works, what today would be called an office suite, was an important piece of software keeping Apple II useful for office applications way into the 1990s. Its spread sheet took over from VisiCalc rather soon. There was a 'replacement' called GS Works for the IIgs, but to my knowledge, it never caught on and People only bought the IIgs to have their Apple Works run faster and use better Keyboards :)) BTW, similar large enhancements were as well available for the Apple IIc and IIc+. – Raffzahn Mar 31 at 18:09
2

This is a "modern" chess program for the c64 that at least could be used as a framework maybe:

https://github.com/StewBC/cc65-Chess

2
  • The project you linked is indeed a chess program, but I think the author's definition of what constitutes a 'modern chess engine' is more around "has had years of refinement and learning how to do it better" rather than "it has been created in the last few years". The project appears to be more a hobby that someone created recently for the intellectual curiosity, but even notes in their documentation that they're not really a chess expert nor does the AI work very well yet. So while cool to see, I don't think this is what the question was looking for. – bjb Mar 31 at 16:42
  • Agreed... More like a framework that could be "populated" with a serious engine rather than starting from scratch.. – dashnick Mar 31 at 16:50
2

Regarding the last question, I've tried running Cyrus II on ZX Spectrum versus CuckooChess engine on android (droidfish app). If the engine was severely down-tuned, sometimes Cyrus II was winning.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.