Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move generation is unsound for non-standard positions #55

Open
analog-hors opened this issue Jun 13, 2021 · 1 comment
Open

Move generation is unsound for non-standard positions #55

analog-hors opened this issue Jun 13, 2021 · 1 comment

Comments

@analog-hors
Copy link

analog-hors commented Jun 13, 2021

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.

@analog-hors analog-hors changed the title Move Generation is unsound for custom positions Move generation is unsound for non-standard positions Jun 13, 2021
@jordanbray
Copy link
Owner

Yeah. It should not be possible to create positions with more than 16 pieces.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants