Validate valid move
This commit is contained in:
parent
58514844a8
commit
4aa7ee9f2e
|
@ -91,9 +91,14 @@ impl<Fi: Read, Fo: Write> UciEngine<Fi, Fo> {
|
|||
///
|
||||
/// uci.make_move(ChessMove::from_str("e2e4").expect("error converting e2e4"));
|
||||
/// ```
|
||||
pub fn make_move(&mut self, chess_move: ChessMove) {
|
||||
self.game.make_move(chess_move);
|
||||
self.push(GuiCommand::Position { position: Some(self.initial), moves: self.game.actions().to_vec() })
|
||||
pub fn make_move(&mut self, chess_move: ChessMove) -> bool {
|
||||
if self.game.make_move(chess_move) {
|
||||
self.push(GuiCommand::Position { position: Some(self.initial), moves: self.game.actions().to_vec() });
|
||||
true
|
||||
} else {
|
||||
false
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue