chess
chess copied to clipboard
Move generation is unsound for non-standard positions
trafficstars
fn main() {
chess::MoveGen::new_legal(&"3k4/8/PPPPPPPP/8/PPPPPPPP/8/PPPPPPPP/3K4 w - - 0 1".parse().unwrap());
}
leads to
thread 'main' panicked at 'assertion failed: len < A::CAPACITY', C:\Users\analog_hors\.cargo\registry\src\github.com-1ecc6299db9ec823\arrayvec-0.5.2\src\lib.rs:265:9
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
error: process didn't exit successfully: `target\debug\chess-test.exe` (exit code: 101)
on debug mode. Compiling for release disables the assertion and causes undefined behavior instead. Should probably either prevent non-standard boards from getting created (which sounds tricky since I doubt this is the only way to get one) or account for this during move generation.
Yeah. It should not be possible to create positions with more than 16 pieces.