Live data from Hacker News

Show HN: Sameshi – a ~1200 Elo chess engine that fits within 2KB

github.com

1–10 of 78 posts

Show HN: Sameshi – a ~1200 Elo chess engine that fits within 2KB

#1
I made a chess engine today, and made it fit within 2KB. I used a variant of MinMax called Negamax, with alpha beta pruning. For the board representation I have used a 120-cell "mailbox". I managed to squeeze in checkmate/stalemate in there, after trimming out some edge cases.

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.

Show HN: Sameshi – a ~1200 Elo chess engine that fits within 2KB
github.com

Re: Show HN: Sameshi – a ~1200 Elo chess engine that fits within 2KB

#3
post #2

Cool that you could keep it under 2k but it would nice to have a readable version of the source code. 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?

What you’re describing is the typical output / function of a minifier

Re: Show HN: Sameshi – a ~1200 Elo chess engine that fits within 2KB

#5
post #2

Cool that you could keep it under 2k but it would nice to have a readable version of the source code. 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?

The real fun would be reverse-engineering the minified code (there are loads of tools to do this for chrome extensions)

Re: Show HN: Sameshi – a ~1200 Elo chess engine that fits within 2KB

#7
post #4

How did you handle games where Stockfish would castle or promote?

i forced stockfish to play only non castling, non en passant, non promotion moves by filtering legal moves and passing only those as root_moves

also removed castling/EP rights from FEN

Re: Show HN: Sameshi – a ~1200 Elo chess engine that fits within 2KB

#9
post #2

Cool that you could keep it under 2k but it would nice to have a readable version of the source code. 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?

The real fun would be reverse-engineering the minified code (there are loads of tools to do this for chrome extensions)

not lossless

Re: Show HN: Sameshi – a ~1200 Elo chess engine that fits within 2KB

#10

Do you think it would be possible to achieve 1:1 ELO:bytes? Even smaller, but can be less smart.

maybe for very low ratings it's plausible? 1 elo per byte might happen in a tiny range but at a useful strength it would break fast, that's what i think
Post reply on HN