Revisiting smaller chess engines

Discussion of chess software programming and technical issues.

Moderator: Ras

orac81
Posts: 7
Joined: Sat Jul 13, 2024 2:19 pm
Full name: Adrian millett

Revisiting smaller chess engines

Post by orac81 »

I was experimenting with a very simple C chess engine for 6502 computers (see previous post: viewtopic.php?t=86366), something in the line of pre bitboard, classic simple byte board array, trying to make a really small engine that plays (relatively) ok.

I was wondering what lessons or small tricks learned from the modern engines might be valuable for this, perhaps things we know with hindsight?

I will give a very simple example - applying a small random factor to the terminal evaluation might improve play by avoiding bad forced lines, if there is an option to get the same score by many routes.

Conversely, what things should we not bother with, in hindsight?

I liked Olithinks engine, just using material+mobility as a reductionist approach.

On another point, I was trying to build UMAX with Oscar64 C, but the obfuscation is to much for it! Is there a non obfuscated version of this program? Its small enough to build..
urbanmusic
Posts: 12
Joined: Tue Dec 12, 2023 11:36 pm
Full name: Bruno Santos

Re: Revisiting smaller chess engines

Post by urbanmusic »

I thought about doing it for an 8 bit ( even a 16 bit) small microcontrollers in the past. And i almost done it for a much faster, better Teensy 4.1 ( running at 600mhz) and enough memory to develop something reliable.
Is there any specific reason why you chose a 6502 architecture ? Or just the challenge in itself?
orac81
Posts: 7
Joined: Sat Jul 13, 2024 2:19 pm
Full name: Adrian millett

Re: Revisiting smaller chess engines

Post by orac81 »

Mainly its the challenge. Ive been writing small games for the 5k Vic20. For example Owarix, a version of Mancala, in 3k, with a reasonably challenging search engine and graphics:

https://www.lemon64.com/forum/viewtopic.php?t=89674

For chess I have a graphics front end running in 3k, board 4x4 upto 10x8, playing random moves. I have my own simple engine, (link in earlier thread) but its too big/weak!

I was just looking at other open-source stuff to see what is small enough. Here is a list of small engines:

Toledo made different versions of nanochess in C, 6502, 8086, about 500 bytes:
https://nanochess.org/chess.html

Umax is a 2k C prog:
https://home.hccnet.nl/h.g.muller/max-src2.html

A small C engine:
https://www.hackster.io/Ripred/building ... ram-04cbff
https://github.com/ripred/CPlusPlusChess

Fisher vs 1k Microchess:
http://www.benlo.com/microchess/chessmate.html

Sargon, a famous 1k z80 program:
https://github.com/billforsternz/retro-sargon

There is the famous 1k zx81 chess, but there is a new stronger program, which I can't find the link for!

https://www.chessprogramming.org/index. ... iew_mobile
urbanmusic
Posts: 12
Joined: Tue Dec 12, 2023 11:36 pm
Full name: Bruno Santos

Re: Revisiting smaller chess engines

Post by urbanmusic »

Nice. I love me a challenge :D
I remember someone doing a minimal in 2K, in arduino, let me look... Is it the microchess you posted?
https://www.hackster.io/Ripred/building ... ram-04cbff
orac81
Posts: 7
Joined: Sat Jul 13, 2024 2:19 pm
Full name: Adrian millett

Re: Revisiting smaller chess engines

Post by orac81 »

Thats one of them, but not the classic "microchess" but another one. I couldn't see the source, just the binary. I think it uses 2k RAM, but much more arduino flash memory.

Small C source of 1-2k does not always translate as small exe for an 8bit like the 6502. For example printf is small in source, but maybe a 2k+ overhead in the binary.
The obfuscated C versions of umax and toledo won't build with Oscar64, which is a bit fussier than other compilers.

To get small builds to have to have the binary code in mind, ie: using BYTE rather than int, etc.