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

iterative_parallel_mvv_lva panic #162

Open
brandonros opened this issue Nov 4, 2024 · 0 comments
Open

iterative_parallel_mvv_lva panic #162

brandonros opened this issue Nov 4, 2024 · 0 comments

Comments

@brandonros
Copy link

use pleco::{bots::IterativeSearcher, tools::Searcher, Board};

fn main() {
    let mut clipboard = arboard::Clipboard::new().unwrap();
    let mut last_clipboard_text = "".to_string();
    loop {
        let current_clipboard_text = clipboard.get_text().unwrap();
        if current_clipboard_text.starts_with("FEN: ") {
            if current_clipboard_text != last_clipboard_text {
                let fen = current_clipboard_text[5..].trim();
                let board = Board::from_fen(&fen).unwrap();
                let depth = 10;
                println!("Searching depth {depth} for FEN: {fen}");
                let best_move = IterativeSearcher::best_move(board, depth);
                println!("FEN: {fen} Best move: {}", best_move);
                last_clipboard_text = current_clipboard_text.clone();
            }
        }
        std::thread::sleep(std::time::Duration::from_millis(100));
    }
}
 $ cargo run
   Compiling chess_bot v0.1.0 (/Users/brandon/Desktop/chess_bot)
    Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.21s
     Running `/Users/brandon/.cargo/target/debug/chess_bot`
Searching depth 10 for FEN: 1k6/R7/8/7B/7P/8/5Q2/B3K2R w K - 11 47
thread 'main' panicked at /Users/brandon/.cargo/registry/src/index.crates.io-6f17d22bba15001f/pleco-0.5.0/src/bots/iterative_parallel_mvv_lva.rs:39:64:
index out of bounds: the len is 10 but the index is 10
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
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

1 participant