diff --git a/src/bin/movegen_tool.rs b/src/bin/movegen_tool.rs index 56ad263..5187311 100644 --- a/src/bin/movegen_tool.rs +++ b/src/bin/movegen_tool.rs @@ -6,11 +6,10 @@ use chess_inator::movegen::LegalMoveGen; use std::env; fn main() { - for arg in env::args().skip(2) { - let board = Board::from_fen(&arg).unwrap(); - let mvs = board.gen_moves(); - for mv in mvs.into_iter() { - println!("{mv:?}") - } + let fen = env::args().nth(1).unwrap(); + let board = Board::from_fen(&fen).unwrap(); + let mvs = board.gen_moves(); + for mv in mvs.into_iter() { + println!("{mv:?}") } } diff --git a/src/bin/perft_tool.rs b/src/bin/perft_tool.rs new file mode 100644 index 0000000..6d76479 --- /dev/null +++ b/src/bin/perft_tool.rs @@ -0,0 +1,14 @@ +//! Runs perft at depth for a given FEN. + +use chess_inator::Board; +use chess_inator::fen::FromFen; +use chess_inator::movegen::perft; +use std::env; + +fn main() { + let depth = env::args().nth(1).unwrap().parse::().unwrap(); + let fen = env::args().nth(2).unwrap(); + let mut board = Board::from_fen(&fen).unwrap(); + let res = perft(depth, &mut board); + println!("{res}") +}