fix: bot training : empty move if no other move allowed
This commit is contained in:
parent
e66d8b6624
commit
c8d6712f09
|
|
@ -226,7 +226,11 @@ pub fn get_valid_actions(game_state: &crate::GameState) -> Vec<TrictracAction> {
|
||||||
}
|
}
|
||||||
TurnStage::Move => {
|
TurnStage::Move => {
|
||||||
let rules = store::MoveRules::new(&color, &game_state.board, game_state.dice);
|
let rules = store::MoveRules::new(&color, &game_state.board, game_state.dice);
|
||||||
let possible_moves = rules.get_possible_moves_sequences(true, vec![]);
|
let mut possible_moves = rules.get_possible_moves_sequences(true, vec![]);
|
||||||
|
if possible_moves.is_empty() {
|
||||||
|
// Empty move
|
||||||
|
possible_moves.push((CheckerMove::default(), CheckerMove::default()));
|
||||||
|
}
|
||||||
|
|
||||||
// Modififier checker_moves_to_trictrac_action si on doit gérer Black
|
// Modififier checker_moves_to_trictrac_action si on doit gérer Black
|
||||||
assert_eq!(color, store::Color::White);
|
assert_eq!(color, store::Color::White);
|
||||||
|
|
|
||||||
|
|
@ -146,7 +146,11 @@ pub fn get_valid_actions(game_state: &crate::GameState) -> Vec<TrictracAction> {
|
||||||
}
|
}
|
||||||
TurnStage::Move => {
|
TurnStage::Move => {
|
||||||
let rules = store::MoveRules::new(&color, &game_state.board, game_state.dice);
|
let rules = store::MoveRules::new(&color, &game_state.board, game_state.dice);
|
||||||
let possible_moves = rules.get_possible_moves_sequences(true, vec![]);
|
let mut possible_moves = rules.get_possible_moves_sequences(true, vec![]);
|
||||||
|
if possible_moves.is_empty() {
|
||||||
|
// Empty move
|
||||||
|
possible_moves.push((CheckerMove::default(), CheckerMove::default()));
|
||||||
|
}
|
||||||
|
|
||||||
// Modififier checker_moves_to_trictrac_action si on doit gérer Black
|
// Modififier checker_moves_to_trictrac_action si on doit gérer Black
|
||||||
assert_eq!(color, store::Color::White);
|
assert_eq!(color, store::Color::White);
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue