This commit is contained in:
cool-mist
2025-02-02 00:37:45 +05:30
parent 303f3d23b6
commit f4b41bc6de
7 changed files with 440 additions and 65 deletions
+4 -4
View File
@@ -1,6 +1,6 @@
use crate::board::{
cmove::CMove,
{Board, GameState},
{Board, BoardState},
};
pub struct Solver {
@@ -26,12 +26,12 @@ impl Solver {
pub fn solve(&self) -> Vec<Vec<CMove>> {
let mut solutions = Vec::new();
if let GameState::Won = self.board.game_state {
if let BoardState::Won = self.board.game_state {
solutions.push(self.moves.clone());
return solutions;
}
let GameState::InProgress = self.board.game_state else {
let BoardState::InProgress = self.board.game_state else {
return solutions;
};
@@ -81,7 +81,7 @@ mod tests {
solution
.into_iter()
.for_each(|m| assert!(board.make_move(m).is_some()));
assert_eq!(GameState::Won, board.game_state);
assert_eq!(BoardState::Won, board.game_state);
}
}