Emilio Melis / aatricks
  • build 2024.11
  • stack · 5 components
  • published 2024-11-07

CChess

Small, direct engine work in C. Explicit state, deterministic search, and code you can actually follow.

stack // C / engine logic / minimax / alpha-beta pruning / board evaluation

architecture flow

01

Board state and moves stay explicit, so you can follow what the search is doing.

02

Minimax with alpha-beta pruning picks the move.

03

Evaluation scores positions with simple heuristics instead of anything heavy.

04

Deterministic control flow means you can step through it in a debugger.

engineering notes

CChess is a small chess engine in plain C. The idea was to keep the board state, the search, and the evaluation visible in the code, with nothing hiding what the engine is doing.

How it works

  • Board state lives in bitboards, so updating a position and generating moves are bitwise operations instead of walking objects.
  • Search is minimax with alpha-beta pruning. The pruning cuts the tree hard but still picks the same move.
  • Evaluation scores positions with light heuristics (material, position, mobility), kept simple so it’s easy to tune.

Why plain C

The engine owns its memory and control flow. Bugs are reproducible because the behavior is deterministic, and with no dependencies the performance comes down to the code itself.