Random Chess Player Panda
e4 · d4 · Nf3 · …↓🎲 Pick one
Every legal move is a possibility. Panda does not score boards or learn from its games.
Browser edition · no installation · one active workshop tab
15-MINUTE INSTRUCTOR-LED ROUTEExplain one layer. Try it. Inspect what changed. The engine’s name is a version, not a rating.
Choose a legal move. Following rules does not mean making a good decision.
Count pieces after candidate moves. Greed can miss the opponent’s reply.
Add hand-written preferences for center activity, pawn structure and king shelter. These are rules we supply, not learned knowledge.
Can adding one more half-move of search change a greedy capture?
Try the bot ladder →Minimax chooses the best move against a strong reply. Alpha-beta stops branches that cannot change that answer. Move ordering tries promising branches first. Iterative deepening finishes depth 1, then 2, then 3 until the node budget is used.
Does pruning change the answer or only the amount of work?
Compare identical positions and fully completed depths. A budget can stop a deeper iteration. “Cutoffs” counts cutoff events; “moves skipped” counts immediate moves skipped there, not an invented count of entire unseen subtrees.
Each input says where a piece is or describes game state. Connections have adjustable weights. Hidden neurons combine inputs nonlinearly, allowing the score to depend on patterns rather than five piece prices. The student network starts from seeded random weights.
Our targets come from saved Stockfish evaluations in the Lichess archive. We transform centipawns with tanh(cp / 400) into a bounded teaching scale. The output is not a calibrated win probability. Search converts it back to evaluation units.
Why does knowing the target during training not give the answer away during play?
One epoch is one full-batch gradient update in this small implementation. Compare training and validation error, then save a model version. During play, our search calls that saved network; it does not call Stockfish. A small dataset and network can still produce a poor player.
If the loss falls but the bot loses more games, did we improve the engine?
Train a network, then enter it in the arena →The arena freezes engine versions, uses paired openings and swaps colors. It records wins, draws, losses, unfinished games and PGNs. Games stopped at the move limit stay unfinished; they are not counted as draws or losses. Compare the named players’ results under the same search settings.
Promotion requires at least 40 completed games against the current champion, no caps, and a paired bootstrap score interval above 50%. This is a conservative development gate, not proof of broad strength. Use more varied, independent evaluation before making a human-strength claim.
Self-play game collection is possible by pairing networks in the arena. Training from their outcomes, live Stockfish re-labeling, transposition tables, quiescence, books, tablebases and policy/MCTS are future work. They are not silently active here.
Rules decide what is legal. An evaluator judges a position. Search looks ahead.
Every legal move is a possibility. Panda does not score boards or learn from its games.
Piece prices come from us. Search can reveal that a tempting capture loses a queen on the next turn.
The scoring recipe is written by people. Changing a coefficient is manual tuning; playing games alone does not change it.
We replace the scoring recipe with learned weights. The legal-move rules and our search stay in place.
Representative neurons shown, not every connection. 768 piece-square inputs + 14 game-state inputs = 782. This fully connected network has 25,089 adjustable parameters.
6 piece types × 2 colors × 64 squares = 768. Imagine 12 transparent chessboards stacked together. Each layer tracks one kind of piece, such as White pawns. A 1 means that piece is on this square; a 0 means it is not.
Example: a White pawn on e4 turns on the e4 input in the White-pawn layer. The other 11 layers have 0 at e4. An empty square has 0 in all 12 layers. We flatten these layers into a list for the network; 768 describes the input slots, not the number of pieces.
The other 14 inputs are: 1 for whose turn it is, 4 for castling rights, 8 for the en-passant file, and 1 for the half-move clock. Total: 768 + 14 = 782. This is our simple encoding choice; other chess networks use different features.
“Tanh” is short for hyperbolic tangent. It converts any real number into a value between −1 and +1. Values near zero stay near zero; large positive or negative values flatten toward the ends.
Two jobs in our model: hidden neurons use tanh to make the network nonlinear, so stacked layers can represent patterns beyond a single weighted sum. The output uses tanh to match the bounded teacher targets.
For training we first divide a teacher score by 400 centipawns: +400 cp becomes tanh(1) ≈ +0.76, 0 cp becomes 0, and −400 cp becomes about −0.76. This scale keeps very large scores from dominating the target range. It does not turn +0.76 into a 76% chance of winning.
Limit: near −1 or +1 the curve is flat, so gradients become small and learning can slow. Tanh is a design choice for this small model; Stockfish’s NNUE uses different activation functions.
No teacher answer is supplied during play. The output describes White’s advantage on a bounded scale; it is not a measured chance of winning.
It has the same 782 → 32 → 1 architecture as your student model, with weights prepared ahead of time using more training and validation-based checkpoint selection. It is a reference for this small learning approach, not a guarantee of strong human-level chess. Lower teacher error must still be checked through games.
A neuron-and-connection view of the Stockfish 18 release. Each circle represents a value in a layer; only a few circles are drawn, and labels give the actual sizes.
Read left to right. The first layer has 16 outputs: 15 each pass through two activation functions, creating 30 values; the remaining output follows the gold bypass. The teal path adds a learned piece-square contribution. The resulting evaluation helps search choose a move.
There are big and small networks; Stockfish selects between them and can re-evaluate with the big one. It also selects one of 8 output-layer stacks by piece count. These details are simplified here. This is an evaluator inside search, not a network that directly outputs a move.
Release-specific sources: layer dimensions & activations · feature transformation · network selection & score adjustments · piece-count layer selection
NNUE means “Efficiently Updatable Neural Network.” This diagram is conceptual: Stockfish does not use our small 782 → 32 → 1 network. Its strength comes from both its trained evaluator and years of search engineering.
Our demo runs the installed Stockfish engine with 1 CPU thread, 32 MiB hash memory and 0.3 seconds per analysis. Its compute limits differ from Panda’s node budget, so this is a reference comparison rather than an equal-compute experiment. We do not train Stockfish in this lab.
Sources: Stockfish evaluation & search · How NNUE reuses calculations · Stockfish overview
Models, saved games, arena history and project settings stay in this browser. Download your project before deleting them. This removes only this chess site’s saved work; other sites, downloaded ZIPs and the browser’s normal runtime cache are unaffected.