Show HN: Sameshi – a ~1200 Elo chess engine that fits within 2KB
230 points| datavorous_ | 15 days ago |github.com
I am a great fan of demoscene (computer art subculture) since middle school, and hence it was a ritual i had to perform.
For estimating the Elo, I measured 240 automated games against Stockfish Elo levels (1320 to 1600) under fixed depth-5 and some constrained rules, using equal color distribution.
Then converted pooled win/draw/loss scores to Elo through some standard logistic formula with binomial 95% confidence interval.
sireat|15 days ago
As you write: not implemented: castling, en passant, promotion, repetition, 50-move rule - those are all required to call the game being played modern chess.
I could see an argument for skipping repetition and 50-move rule for tiny engines, but you do need castling, en pessant and promotion for pretty much any serious play.
https://en.wikipedia.org/wiki/Video_Chess fit in 4k and supported fuller ruleset in 1980 did it not?
So I would ask what is the smallest fully UCI (https://www.chessprogramming.org/UCI) compliant engine available currently?
This would be a fun goal to beat - make something tiny that supports full ruleset.
PS my first chess computer in early 1980s was this: https://www.ismenio.com/chess_fidelity_cc3.html - it also supported castling, en pessant, not sure about 50 move rule.
dmurray|15 days ago
2KB of JavaScript with castling, en passant, promotion, search and even a GUI
326 bytes of assembly, without the special rules
I don't think the author has a UCI-compliant one, but it should be easier than the GUI. There are forks of the JS one that might do it.
[0] https://nanochess.org/chess6.html
jll29|15 days ago
Bug report:
The pawn is not permitted to move two fields after it has already beeen moved once before: b6b4 isn't a valid move after b7b6. (First moving two fields, and then one would have been okay, in contrast.)datavorous_|15 days ago
Appreciate you taking the time to test it.
l674|15 days ago
[1] https://cutechess.com/
[2] https://www.chessprogramming.org/Sequential_Probability_Rati...
[3] https://github.com/michiguel/Ordo
lekevicius|15 days ago
esafak|15 days ago
datavorous_|15 days ago
thomasmg|15 days ago
[1] https://github.com/thomasmueller/bau-lang/blob/main/src/test...
ycombinatrix|15 days ago
tromp|15 days ago
dfc|15 days ago
datavorous_|15 days ago
so every game stayed in the same no castling variant
and you're right, this rating is for that constrained variant, not full chess.
unknown|15 days ago
[deleted]
galkk|15 days ago
> Not implemented: castling, en passant, promotion, repetition, 50-move rule.
Mr_Minderbinder|15 days ago
If anyone reading this is interested in small and efficient chess programs that are still reasonably strong, there was a x86 assembly port of Stockfish called asmFish from a couple of years ago (the Win64 release binary was about 130KiB). Also see OliThink (~1000 LOC) and Xiphos which has some of the simplest C code for an engine of its strength that I have seen. I have not investigated the supposedly 4K sized engines that participated in TCEC too closely but from what I have seen so far it would seem that there are a few asterisks to be attached to those claims.
chvid|15 days ago
Do you work with it like this or do you have some sort of script you apply to get it down to a single line, single letter variable names?
mackeye|15 days ago
noutella|15 days ago
alansaber|15 days ago
GeertB|15 days ago
datavorous_|15 days ago
also removed castling/EP rights from FEN
yuppiepuppie|15 days ago
Aachen|12 days ago
burstw0w|15 days ago
datavorous_|15 days ago
It is hideous now!
y-curious|15 days ago
The PR:
recursive|15 days ago
bstsb|15 days ago
drev|14 days ago
kachapopopow|15 days ago
haute_cuisine|15 days ago
P.S. I assume 1200 elo in chess com scale (not lichess / fide elo) and bullet chess variant?
grumpopotamus|15 days ago
falsaberN1|15 days ago
dxxvi|15 days ago
oh_my_goodness|15 days ago
jqr-|15 days ago
newzino|15 days ago
The gap between your 1200 Elo in 2KB and the TCEC 4K engines at ~3000 Elo is interesting. That extra 2KB buys a lot when it goes to better evaluation and move ordering. Even a simple captures-first sort in alpha-beta pruning costs only a few bytes of code but can roughly double your effective search depth.
unknown|15 days ago
[deleted]
raphaelmolly8|15 days ago
[deleted]
genie3io|15 days ago
[deleted]
wittlesus|15 days ago
[deleted]
TZubiri|15 days ago
datavorous_|15 days ago
scribbling long enough on a piece of paper is more enjoyable than prompting.
lyu07282|15 days ago