Skip to content

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

1 Commit

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

IconKnight: Chess Engine in Icon + Elo Pipeline

This repository gives you a complete starter workflow to:

  • build a chess engine in Icon (src/icon_chess.icn),
  • expose it via UCI,
  • validate move generation with perft checks,
  • run automated matches with cutechess-cli,
  • estimate Elo from match scores against Stockfish at nearby strength levels.

What is implemented now

  • Engine core in Icon

    • 0x88 board representation
    • UCI loop (uci, isready, position, go, setoption, quit)
    • legal move handling via make-move legality checks
    • alpha-beta + quiescence search
    • basic material + positional evaluation
    • castling, en passant, promotion
  • Tooling for validation and Elo estimation

    • scripts/uci_smoke.py: protocol smoke test
    • scripts/perft_check.py: perft regression checks against reference node counts
    • scripts/run_matches.py: runs match batches via cutechess
    • scripts/elo_math.py: Elo and confidence-interval math
    • scripts/build_engine.sh: compile Icon engine
    • scripts/run_engine.sh: run compiled binary

Prerequisites

  • python3
  • stockfish in PATH
  • cutechess-cli in PATH
  • Icon compiler in PATH: icont or unicon

On your machine right now, stockfish and cutechess-cli are available. You still need to install icont/unicon before compiling the Icon source.

1) Build the engine

./scripts/build_engine.sh

Expected output binary:

  • build/icon_chess

2) UCI smoke test

python3 scripts/uci_smoke.py --engine-path ./build/icon_chess --timeout 8 --movetime-ms 120

This confirms the engine answers UCI commands and returns a valid bestmove.

3) Validate move generation (perft)

Quick suite:

python3 scripts/perft_check.py --engine-path ./build/icon_chess

Full suite (deeper/slower):

python3 scripts/perft_check.py --engine-path ./build/icon_chess --full

The engine also supports interactive perft commands:

perft 3
go perft 3

4) Run matches and estimate Elo

Example with three nearby anchors:

python3 scripts/run_matches.py \
  --engine-path ./build/icon_chess \
  --engine-name IconKnight \
  --opponent-elo 1320 1450 1600 \
  --games 40 \
  --tc 10+0.1 \
  --repeat

Each run writes:

  • one PGN per anchor,
  • cutechess logs,
  • summary.json + summary.txt with Elo estimate and CI,

under results/<timestamp>/.

5) Quick skill ladder (n=20)

For a quick assessment against different Stockfish skill levels:

python3 scripts/quick_elo_skills.py \
  --engine-path ./build/icon_chess \
  --games 20 \
  --skill 0 4 8 12 16 20 \
  --tc 3+0.05

Notes:

  • This reports Elo difference versus each specific Stockfish skill configuration.
  • If you also provide --skill-elo SKILL=ELO, the script computes anchored absolute-Elo estimates.

How to target "similar-level" opponents

Use this loop:

  1. Start with weak anchors (e.g. 1320 1450 1600).
  2. Check score at each anchor.
  3. Keep anchors where your score is roughly 35% to 65%.
  4. Re-run more games around that band (100-300 games total).
  5. Use the weighted aggregate Elo from summary.txt.

This gives a much more stable estimate than playing only one fixed level.

Suggested next upgrades for engine strength

  1. Add transposition table and iterative deepening with aspiration windows.
  2. Add better move ordering (history, killer moves, MVV-LVA tuning).
  3. Add piece-square tables and endgame-aware king evaluation.
  4. Add null-move pruning / late move reductions (carefully, with regression tests).

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages