summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorJustin Worthe <justin@worthe-it.co.za>2018-07-02 21:29:52 +0200
committerJustin Worthe <justin@worthe-it.co.za>2018-07-02 21:29:52 +0200
commit8251d5899a64515c9b2e8a71349dd4d2fcece69e (patch)
treef869d2e0cb543fbc39861afe33f6945338410f98 /tests
parent8dd9517ae4b925fba5b825da04254412e039fa0c (diff)
Game engine working, except for teslas and choosing a move
Diffstat (limited to 'tests')
-rw-r--r--tests/expressive_to_bitwise_comparison.rs11
1 files changed, 5 insertions, 6 deletions
diff --git a/tests/expressive_to_bitwise_comparison.rs b/tests/expressive_to_bitwise_comparison.rs
index 40181b2..cb57e3b 100644
--- a/tests/expressive_to_bitwise_comparison.rs
+++ b/tests/expressive_to_bitwise_comparison.rs
@@ -38,7 +38,6 @@ fn test_reading_from_replay(replay_folder: &str, length: usize) {
proptest! {
#[test]
- #[ignore]
fn follows_the_same_random_game_tree(seed in any::<[u32;4]>()) {
let mut rng = XorShiftRng::from_seed(seed);
@@ -49,25 +48,25 @@ proptest! {
while expected_status == GameStatus::Continue {
let player_command = random_player_move(&settings, &expressive_state, &mut rng);
let opponent_command = random_opponent_move(&settings, &expressive_state, &mut rng);
+ println!("Player command: {}", player_command);
+ println!("Opponent command: {}", opponent_command);
expected_status = expressive_state.simulate(&settings, player_command, opponent_command);
let actual_status = bitwise_state.simulate(&settings, player_command, opponent_command);
assert_eq!(&expected_status, &actual_status);
- assert_eq!(build_bitwise_from_expressive(&expressive_state), bitwise_state.clone());
+ assert_eq!(build_bitwise_from_expressive(&expressive_state), bitwise_state.sorted());
}
}
}
-
-
fn random_player_move<R: Rng, GS: GameState>(settings: &GameSettings, state: &GS, rng: &mut R) -> Command {
- let all_buildings = sensible_buildings(settings, &state.player(), state.player_has_max_teslas());
+ let all_buildings = sensible_buildings(settings, &state.player(), state.player_has_max_teslas()||true);
random_move(&state.unoccupied_player_cells(), &all_buildings, rng)
}
fn random_opponent_move<R: Rng, GS: GameState>(settings: &GameSettings, state: &GS, rng: &mut R) -> Command {
- let all_buildings = sensible_buildings(settings, &state.opponent(), state.opponent_has_max_teslas());
+ let all_buildings = sensible_buildings(settings, &state.opponent(), state.opponent_has_max_teslas()||true);
random_move(&state.unoccupied_opponent_cells(), &all_buildings, rng)
}