Skip to content

Commit

Permalink
max_ticks in favor of max_turns
Browse files Browse the repository at this point in the history
  • Loading branch information
bcollazo committed Oct 27, 2024
1 parent de503c7 commit 07a13c5
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion catanatron_rust/src/enums.rs
Original file line number Diff line number Diff line change
Expand Up @@ -102,5 +102,5 @@ pub struct GameConfiguration {
pub vps_to_win: u8,
pub map_type: MapType,
pub num_players: u8,
pub max_turns: u32,
pub max_ticks: u32,
}
10 changes: 5 additions & 5 deletions catanatron_rust/src/game.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@ pub fn play_game(
let rc_config = Rc::new(config);
println!("Playing game with configuration: {:?}", rc_config);
let mut state = State::new(rc_config.clone(), Rc::new(map_instance));
let mut num_turns = 0;
while state.winner().is_none() && num_turns < rc_config.max_turns {
println!("Playing turn {:?}", num_turns);
let mut num_ticks = 0;
while state.winner().is_none() && num_ticks < rc_config.max_ticks {
println!("Playing turn {:?}", num_ticks);
play_tick(&players, &mut state);
num_turns += 1;
num_ticks += 1;
}
state.winner()
}
Expand Down Expand Up @@ -62,7 +62,7 @@ mod tests {
vps_to_win: 10,
map_type: MapType::Base,
num_players: 4,
max_turns: 8, // TODO: Change!
max_ticks: 8, // TODO: Change!
};
let mut players: HashMap<u8, Box<dyn Player>> = HashMap::new();
players.insert(0, Box::new(RandomPlayer {}));
Expand Down
2 changes: 1 addition & 1 deletion catanatron_rust/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ fn main() {
vps_to_win: 10,
map_type: MapType::Base,
num_players: 2,
max_turns: 2,
max_ticks: 4,
};
let mut players: HashMap<u8, Box<dyn Player>> = HashMap::new();
players.insert(Color::Red as u8, Box::new(RandomPlayer {}));
Expand Down
2 changes: 1 addition & 1 deletion catanatron_rust/src/state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ impl State {
vps_to_win: 10,
map_type: MapType::Base,
num_players: 4,
max_turns: 10,
max_ticks: 10,
};
let map_instance = MapInstance::new(
&global_state.base_map_template,
Expand Down

1 comment on commit 07a13c5

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Performance Alert

Possible performance regression was detected for benchmark.
Benchmark result of this commit is worse than the previous benchmark result exceeding threshold 1.30.

Benchmark suite Current: 07a13c5 Previous: 76442c7 Ratio
tests/integration_tests/test_speed.py::test_alphabeta_speed 1.8172471359507134 iter/sec (stddev: 0.8532807041844619) 2.7254399580971604 iter/sec (stddev: 0.5967653859703547) 1.50

This comment was automatically generated by workflow.

Please sign in to comment.