From 33e77ff095b6d455a3b1bf511c118de9fc35fd60 Mon Sep 17 00:00:00 2001 From: Henri Bourcereau Date: Thu, 30 Jan 2025 17:42:29 +0100 Subject: [PATCH] feat: bots : quit on match end --- client_cli/src/app.rs | 3 ++- client_cli/src/game_runner.rs | 1 - client_cli/src/main.rs | 3 +++ 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/client_cli/src/app.rs b/client_cli/src/app.rs index 5a143f3..4f617d3 100644 --- a/client_cli/src/app.rs +++ b/client_cli/src/app.rs @@ -38,9 +38,10 @@ impl App { }) .unwrap_or_default(); let schools_enabled = false; + let should_quit = bot_strategies.len() > 1; Self { game: GameRunner::new(schools_enabled, bot_strategies, args.seed.map(|s| s as u64)), - should_quit: false, + should_quit, schools_enabled, } } diff --git a/client_cli/src/game_runner.rs b/client_cli/src/game_runner.rs index f68ea5e..42c836f 100644 --- a/client_cli/src/game_runner.rs +++ b/client_cli/src/game_runner.rs @@ -101,7 +101,6 @@ impl GameRunner { } if let Some(winner) = self.state.determine_winner() { - // panic!("WE HAVE A WINNER!"); next_event = Some(store::GameEvent::EndGame { reason: store::EndGameReason::PlayerWon { winner }, }); diff --git a/client_cli/src/main.rs b/client_cli/src/main.rs index 69b3700..9b163eb 100644 --- a/client_cli/src/main.rs +++ b/client_cli/src/main.rs @@ -37,6 +37,9 @@ fn main() -> Result<()> { // Create an application. let mut app = App::new(args); + if app.should_quit { + println!("{}", app.display()); + } // Start the main loop. while !app.should_quit {