Skip to content

Latest commit

 

History

37 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Recommended Read

Technical documentation on how chess engines work

Chess Engine

Overview

Chess engine written in C with UCI protocol support. Features bitboard-based move generation, alpha-beta search with transposition tables, and piece-square table evaluation. Can interface with any UCI-compatible chess GUI.

Core Features

  • Move Generation: Bitboard-based with magic numbers for sliding pieces (bishops and rooks)
  • Position Evaluation: Piece-square table evaluation with material counting
  • Search Algorithm: Iterative deepening negamax search with alpha-beta pruning and move ordering
  • Game State Handling: Full support for castling, en passant, checkmate, stalemate, and insufficient material
  • No Opening Book: Pure tactical play from position evaluation

Technical Implementation

  • Bitboard Representation: 64-bit integers represent board state for efficient operations
  • Magic Bitboards: Pre-computed magic numbers enable fast sliding piece attack generation
  • Transposition Table: 100,000-entry hash table keyed by Zobrist hash; each entry stores evaluation, depth, node type (EXACT / LOWER / UPPER bound), and best move. Cache hits at sufficient depth skip subtree expansion entirely.
  • Iterative Deepening: Searches depth 1, 2, … N in sequence. Each iteration warms the TT so the best move is tried first at the next depth, dramatically improving alpha-beta cutoffs at ~20% extra total work.
  • Move Ordering: PV move from the TT is tried first; captures are scored by MVV-LVA (Most Valuable Victim − Least Valuable Attacker). Together these produce the cutoffs that make iterative deepening effective.
  • UCI Protocol: Standard chess interface for GUI compatibility

Attributions

Heavily based on the following documentation and code:

About

Basic chess engine. Single Piece-Square Table Evaluation & UCI compatible

Resources

Stars

3 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages