test: add failing test in training_common::tests::checker_moves_to_trictrac_action
This commit is contained in:
parent
db5c1ea4f4
commit
68ad99b4be
1 changed files with 32 additions and 2 deletions
|
|
@ -224,7 +224,10 @@ pub fn get_valid_actions(game_state: &GameState) -> anyhow::Result<Vec<TrictracA
|
||||||
let cum = rules.board.white_checker_cumulative();
|
let cum = rules.board.white_checker_cumulative();
|
||||||
for (move1, move2) in possible_moves {
|
for (move1, move2) in possible_moves {
|
||||||
valid_actions.push(white_checker_moves_to_trictrac_action(
|
valid_actions.push(white_checker_moves_to_trictrac_action(
|
||||||
&move1, &move2, &game_state.dice, &cum,
|
&move1,
|
||||||
|
&move2,
|
||||||
|
&game_state.dice,
|
||||||
|
&cum,
|
||||||
)?);
|
)?);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -239,7 +242,10 @@ pub fn get_valid_actions(game_state: &GameState) -> anyhow::Result<Vec<TrictracA
|
||||||
let cum = rules.board.white_checker_cumulative();
|
let cum = rules.board.white_checker_cumulative();
|
||||||
for (move1, move2) in possible_moves {
|
for (move1, move2) in possible_moves {
|
||||||
valid_actions.push(white_checker_moves_to_trictrac_action(
|
valid_actions.push(white_checker_moves_to_trictrac_action(
|
||||||
&move1, &move2, &game_state.dice, &cum,
|
&move1,
|
||||||
|
&move2,
|
||||||
|
&game_state.dice,
|
||||||
|
&cum,
|
||||||
)?);
|
)?);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -458,5 +464,29 @@ mod tests {
|
||||||
}),
|
}),
|
||||||
ttaction.ok()
|
ttaction.ok()
|
||||||
);
|
);
|
||||||
|
|
||||||
|
// Black player
|
||||||
|
state.active_player_id = 2;
|
||||||
|
state.board.set_positions(
|
||||||
|
&crate::Color::White,
|
||||||
|
[
|
||||||
|
2, -11, 0, -2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 2, 6, 4,
|
||||||
|
],
|
||||||
|
);
|
||||||
|
let ttaction = super::checker_moves_to_trictrac_action(
|
||||||
|
&CheckerMove::new(21, 0).unwrap(),
|
||||||
|
&CheckerMove::new(0, 0).unwrap(),
|
||||||
|
&crate::Color::Black,
|
||||||
|
&state,
|
||||||
|
);
|
||||||
|
|
||||||
|
assert_eq!(
|
||||||
|
Some(TrictracAction::Move {
|
||||||
|
dice_order: true,
|
||||||
|
checker1: 2,
|
||||||
|
checker2: 0, // blocked by white on last field
|
||||||
|
}),
|
||||||
|
ttaction.ok()
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue