Skip to content

acherm/agentic-chessengine-css-codex

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ChessCSS Engine

This repository contains a chess engine whose evaluation function is authored in CSS.

Strict Pure CSS Variant

If you want a strict HTML+CSS-only implementation (no Python, no JavaScript), use:

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.

What is “pure CSS” here?

  • 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.

Full Search Engine Core

The runtime engine implements:

  • Iterative deepening alpha-beta search
  • Quiescence search (captures/promotions/check evasions)
  • Transposition table (Hash UCI option)
  • Killer and history heuristics for move ordering
  • Principal variation output in UCI info lines
  • Clear Hash UCI option

Quick start

Run a UCI engine instance:

python3 scripts/css_engine.py --style styles/club.css

Smoke test UCI handshake:

printf "uci\nisready\nposition startpos\ngo depth 2\nquit\n" | python3 scripts/css_engine.py --style styles/club.css

Elo testing

Play 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 80

Estimate 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 80

config/opponents.json defines opponents and their reference ratings.

CSS rule model

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, K
  • color: white, black
  • file: a..h
  • rank: 1..8
  • square: 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

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors