Skip to content

willforman/chess-engine-invalid-move-finder

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

25 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

chess-engine-invalid-move-finder

Find bugs in your chess engine's move generation by comparing to Stockfish.

❯ chess-engine-invalid-move-finder "8/2p5/3p4/KP5r/1R3p1k/8/4P1P1/8 w - - 0 1" 5 my-engine
Engines initialized. Starting search on engines now.
Invalid moves found!
STOCKFISH ONLY MOVES:
A5A6 -> H5H7 -> A6B7 -> C7C5 -> B7C6

Requirements

  • Your engine must implement UCI
  • Your engine must support the non-standard uci command go perft. The output must match Stockfish's

How It Works

At the given position, it runs go perft 1 to get the list of valid moves. Then for each move, it will update the position (position <fen> moves <move>) and run go perft 1 again. It does this until it reaches the required depth. This gives it all lines.

Note

Note: this project isn't guaranteed to find every bug in your perft move generation. For example, I can imagine that if you have a path dependent bug, it could miss it due to how the position is initialized vs how the position is reached in a regular perft search.

How to run

With nix:

nix run github:willforman/chess-engine-invalid-move-finder

Build with cargo:

cargo build --release

About

Find invalid moves in a UCI-compatible chess engine

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors