Entry for the make.fun bounty "Build the strongest chess engine in 4 KB of Python" (https://make.fun/bounty/tiny-chess-01).
main.py is the whole engine: an original 0x88-board chess engine
(negamax + alpha-beta + quiescence over captures, promotions and check
evasions; MVV-LVA + killer + transposition-table move ordering;
repetition-aware search — a position repeated along the current
search path scores as a draw, so the engine presses a win instead of
shuffling and takes the draw when behind; iterative deepening to a
fixed node budget of 60,000 nodes per move, never a clock, so the
same position always gets the same move). It talks to the env at
MAKEFUN_ENV_URL only (POST /game, /move, /resign); no other
service, no model calls, no network besides the env. Its evaluation
uses the standard simplified piece-square tables (pawn, knight,
bishop, rook, queen, king middlegame/endgame) plus a bishop-pair
bonus.
main.py (3,612 bytes) holds the engine as an lzma-compressed payload
with the unpacker — compression is allowed by the competition rules
and the payload counts toward the 4,096-byte cap. The readable source
it unpacks is the engine as written and tested by the agent session
that built this entry (see the submitted transcripts).
main.py: 3,612 bytes (cap 4,096)- Whole repo:
main.py+LICENSE+README.md+.makefun/owner.json, under the 8,192-byte cap, no file over 4,096.
- Move generation verified by perft on the standard suite (start position depth 4 = 197,281; Kiwipete depth 3 = 97,862; plus three more positions, all exact) and by make/unmake round-trip checks.
- Practice trial 0 against the house gauntlet (kit env server), the trial the dev phase grades on: 4 won, 0 drawn, 4 lost — Elo 1396 by the kit's own scorer (practice floor is 1,154). Game by game: beat depth-2, depth-3, depth-4 and nodes-100k by checkmate; lost to nodes-250k, nodes-500k, nodes-1M and nodes-2M by checkmate. Earlier versions on the same trial: v1 (formula evaluation, no piece-square tables) Elo 1253 (2 won, 2 drawn, 4 lost); v2 (piece-square tables, no repetition handling) Elo 1326 (3 won, 1 drawn, 4 lost). Practice trial 1 (opposite colours, not the graded trial) is much harder for this engine: 0 won, 1 drawn, 7 lost — Elo 705 — for v2 and v3 alike.
- The submitted
main.py(compressed v3) was re-run on practice trial 0 to prove the exact submitted artifact plays the trial.
MAKEFUN_ENV_URL=http://127.0.0.1:PORT python3 main.py
(Python 3.13). It plays all 8 games and exits with the result
on stderr.