Skip to content

Commit

Permalink
fix bestmove being output in chess960
Browse files Browse the repository at this point in the history
  • Loading branch information
MinusKelvin committed Mar 10, 2022
1 parent 4c1c273 commit a3087cb
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
8 changes: 4 additions & 4 deletions frozenight/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ fn spawn_search_thread(
}
}
let (e, m) = best_move.unwrap();
listener.best_move(m, e);
listener.best_move(&board, m, e);
})
}

Expand All @@ -184,12 +184,12 @@ pub struct Statistics {
pub trait Listener: Send + 'static {
fn info(&mut self, depth: u16, stats: Statistics, eval: Eval, board: &Board, pv: &[Move]);

fn best_move(self, mv: Move, eval: Eval);
fn best_move(self, board: &Board, mv: Move, eval: Eval);
}

impl Listener for () {
fn info(&mut self, _: u16, _: Statistics, _: Eval, _: &Board, _: &[Move]) {}
fn best_move(self, _: Move, _: Eval) {}
fn best_move(self, _: &Board, _: Move, _: Eval) {}
}

impl<F> Listener for F
Expand All @@ -198,7 +198,7 @@ where
{
fn info(&mut self, _: u16, _: Statistics, _: Eval, _: &Board, _: &[Move]) {}

fn best_move(self, mv: Move, eval: Eval) {
fn best_move(self, _: &Board, mv: Move, eval: Eval) {
self(mv, eval)
}
}
2 changes: 1 addition & 1 deletion uci/src/bench.rs
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ impl Listener for BenchListener {
self.nodes = stats.nodes;
}

fn best_move(self, _: Move, _: Eval) {
fn best_move(self, _: &Board, _: Move, _: Eval) {
self.sender.send(self.nodes).unwrap();
}
}
4 changes: 2 additions & 2 deletions uci/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -209,8 +209,8 @@ impl Listener for UciListener {
println!();
}

fn best_move(self, mv: Move, _: Eval) {
println!("bestmove {}", mv);
fn best_move(self, board: &Board, mv: Move, _: Eval) {
println!("bestmove {}", to_uci_castling(board, mv));
stdout().flush().unwrap();
}
}

0 comments on commit a3087cb

Please sign in to comment.