Views
No views yet
node tools/serve.mjs # -> http://localhost:4173file://)main / root. The site is fully static.quality set — the model is now conditioned on "this move is an
inaccuracy / mistake / blunder". Nerf tokens are masked out on the retry.?! / ? / ??
glyph in the move list if it was nerfed.[#|+]? [x]? [=Q|=R|=B|=N]? [core]
fxe8=Q+ -> [+] [x] [=Q] [fe8]
Nxf3 -> [x] [Nf3]
Raxe1# -> [#] [x] [Rae1]
e4 -> [e4]
O-O -> [O-O]fe8 is a pawn capture
core (source file + destination), piece cores may carry file / rank / square
disambiguators (Nbd7, R1e2, Qh4e1). sanToTokens() / tokensToSan()
in js/vocab.js convert both ways.| group | count |
|---|---|
| core moves (pawn 176, N/B/R/Q/K 5,064, castling 2, generated geometrically) | 5,242 |
modifiers + # x =Q =R =B =N | 7 |
nerf <inaccuracy> <mistake> <blunder> | 3 |
structural <bos> <eos> + 13 <elo-*> buckets + <elo-any> (vocab v2) | 16 |
game-end <white/black-resign> <white/black-flag> <draw> (vocab v3 — the engine resigns / offers you a draw when it samples its own action; flags are training-signal only) | 5 |
tools/vocab-check.mjs plays random games and
asserts every legal move tokenizes into the vocabulary and round-trips:node tools/vocab-check.mjs 500predict(ctx) returning either a
Float32Array / number[] of length VOCAB_SIZE (index i = probability
of TOKENS[i]) or a plain {token: probability} map. It is called once
per token:1{
2 fen, // current position
3 moves, // SAN history: ['e4', 'c5', ...]
4 historyTokens, // same history as a flat token stream, nerf tokens included
5 moveTokens, // tokens emitted so far for the move being decoded
6 turn, // 'w' | 'b' — the side the model plays
7 opponent, // { rating: 1500 | null, site: 'lichess' | null }
8 legalMoves, // SAN list, provided for convenience — free to ignore
9 quality, // null, or 'inaccuracy'|'mistake'|'blunder' after a nerf
10 vocab, // the token list
11}window.chessGpt.setModel({ name: 'the real one', async predict(ctx) { ... } });window.chessGpt.loadFen(fen) jumps to a position,
window.chessGpt.config exposes ENGINE_CONFIG (sampling temperature,
disable nerf tokens, think-delay).index.html page shell
style.css minimalist theme
js/vocab.js token vocabulary + sanToTokens / tokensToSan <- swap for your tokenizer
js/engine.js mask -> renormalize -> sample decode loop <- the AI's socket
js/mock-model.js placeholder model <- replace with the real AI
js/app.js game flow, UI wiring
js/board.js SVG board rendering + input
js/pieces.js geometric piece shapes
lib/chess.js vendored chess.js 1.4.0 (rules, legality, SAN)
tools/serve.mjs dev server: node tools/serve.mjs
tools/vocab-check.mjs vocabulary/round-trip validation900 lichess
blunders a lot; leave rating empty for a middling default). The rating
site is plumbed through but unused by the mock — a real model might embed
it, since ratings aren't comparable across sites.ENGINE_CONFIG.temperature, default 1.0).