This repository contains a chess engine whose evaluation function is authored in CSS.
If you want a strict HTML+CSS-only implementation (no Python, no JavaScript), use:
- /Users/mathieuacher/SANDBOX/chess-css-codex/strict-css/index.html
- /Users/mathieuacher/SANDBOX/chess-css-codex/strict-css/pseudo-legal.html
- /Users/mathieuacher/SANDBOX/chess-css-codex/strict-css/stateful-game.html
- /Users/mathieuacher/SANDBOX/chess-css-codex/strict-css/README.md
That variant is a larger finite-state engine emulation (v2, 6-ply book horizon) and intentionally does not use any runtime code.
It also includes:
- a strict CSS board-first pseudo-legal/play lab with a quick-play UI, real chess-piece squares, occupancy-aware move masks, and a roulette-style random move picker;
- a strict CSS stateful playable game graph where each click commits a full board/status transition.
- Chess strength/tuning rules are written in
styles/*.css. - Engine I/O and search are provided by a thin Python UCI runtime.
- You can create stronger/weaker engines by editing only CSS files.
The runtime engine implements:
- Iterative deepening alpha-beta search
- Quiescence search (captures/promotions/check evasions)
- Transposition table (
HashUCI option) - Killer and history heuristics for move ordering
- Principal variation output in UCI
infolines Clear HashUCI option
Run a UCI engine instance:
python3 scripts/css_engine.py --style styles/club.cssSmoke test UCI handshake:
printf "uci\nisready\nposition startpos\ngo depth 2\nquit\n" | python3 scripts/css_engine.py --style styles/club.cssPlay two engines and estimate Elo difference:
python3 scripts/run_matches.py \
--engine-a-name "Club" \
--engine-a-cmd "python3 scripts/css_engine.py --style styles/club.css" \
--engine-b-name "Novice" \
--engine-b-cmd "python3 scripts/css_engine.py --style styles/novice.css" \
--games 40 \
--time-ms 80Estimate rating via adaptive similar-level pairings:
python3 scripts/rating_ladder.py \
--candidate-name "MyCSS" \
--candidate-cmd "python3 scripts/css_engine.py --style styles/club.css" \
--initial-rating 1200 \
--rounds 5 \
--games-per-round 12 \
--time-ms 80config/opponents.json defines opponents and their reference ratings.
Each rule is a selector with attributes and a numeric custom property value.
[piece="N"][center="true"] { --bonus: 22; }
[piece="P"][passed="true"] { --bonus: 25; }Supported piece attributes in selectors:
piece:P,N,B,R,Q,Kcolor:white,blackfile:a..hrank:1..8square: UCI square (example:e4)center,near-center,edge,advanced,developed,doubled,isolated,passed,king-ring:true/false
Root tuning variables (:root) include:
--search-depth--blunder-probability--eval-noise-cp--mobility-weight--tempo-bonus--check-bonus--mate-score--draw-score--random-seed