Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

510 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Chess 4K Engine

License

Overview

A c++ chess engine that fits into 4KiB

It supports the following subset of the UCI protocol:

  • uci
  • isready
  • position startpos moves ...
  • go wtime ... btime ...
  • quit

Additional support for non-4K builds:

  • ucinewgame
  • position fen ... moves ...
  • go infinite

The first message is always regarded as uci due to the space restriction

Building

Building c4ke requires g++ that supports c++23:

git clone https://github.com/citrus610/c4ke
cd c4ke
make c4ke

To build c4ke-mini on Linux, run:

make mini

Minification

The minifier isn't general-purpose and won't work on all c++ code

  • Removing whitespaces
  • Removing single-line comments
  • Removing #ifdef blocks (usually for OpenBench compliance code)
  • Finding and replacing #define constants
  • Renaming identifiers

Features

Board representation

  • Bitboard
  • 8x8 Mailbox
  • Hyperbola Quintessence move generation

Search

  • Iterative deepening
  • Aspiration windows
  • Lazy SMP
  • Principal variation search
  • Quiescence search
    • Check evasions
  • Transposition table
  • Move ordering
    • TT move
    • MVV
    • Quiet history
    • Noisy history
    • Continuation history
      • 1-ply
      • 2-ply
    • Static exchange evaluation
  • Selectivity
    • Pruning
      • Reverse futility pruning
      • Null move pruning
      • Late move pruning
      • Futility pruning
      • PVS SEE pruning
      • QS SEE pruning
    • Extensions
      • Singular extensions
        • Double extensions
        • Triple extensions
        • Multicut
    • Reductions
      • Late move reductions
  • Static evaluation correction history
    • Pawn correction history
    • Non-pawn correction history
    • Continuation correction history
      • 1-ply
      • 2-ply

Evaluation

  • Material
  • Rank/file piece-square tables
  • Bishop pair
  • Mobility
  • Tempo
  • Rook on open file
  • Rook on semi-open file
  • Pawn threats
  • Pawn push threats
  • Pawn structure
    • Protected pawn
    • Doubled pawn
    • Passed pawn
    • Pawn phalanx
    • Passed pawn kings proximity
  • King safety
    • King on open file
    • King on semi-open file
    • Pawn shield
    • King ring attack
    • Queenless attack
  • Endgame scaling

Time management

  • Soft limit
  • Hard limit
  • Best move's node count scaling

Thanks

  • Members of the MinusKelvin discord server for helping me and allowing me into their OpenBench instance
  • The following engines that I used as references:

About

chess 4k engine

Resources

Stars

13 stars

Watchers

2 watching

Forks

Releases

Packages

Contributors

Languages