CarlSIM Chess Engine

High-performance chess engine written in C, achieving a rating of 2300.

Move Generation

  • Uses bitboards to represent pieces and moves as 64-bit integers. Each full board state uses separate bitboards for each player and piece type.
  • Implements magic bitboard move generation for rooks, bishops, and queens using perfect hashing based on blockers.
  • Uses bitshifts for fast pawn move generation.
  • Highly optimized: generates over 500+ million moves per second.

Evaluation Function

  • Uses material-based evaluation for pawns, knights, bishops, rooks, and queens.
  • Position bonuses applied for pieces on advantageous squares.
  • Leverages __builtin_ctzll to efficiently find piece positions on bitboards.
  • Implements quiescence search to explore all capture moves before static evaluation, avoiding unstable assessments.

Search Optimizations

  • Minimax algorithm with alpha-beta pruning to reduce redundant searches.
  • Uses a transposition table keyed by Zobrist hashing to cache previously evaluated positions and avoid redundant computation.
  • Employs iterative deepening: shallow-depth searches populate the transposition table to accelerate deeper searches.
  • Integrates book moves from 50–100 grandmaster tournament games for early-game optimization.
← Back to all projects