diff --git a/botagent/bot_agent.py b/botagent/bot_agent.py index 3139377..e63d25a 100644 --- a/botagent/bot_agent.py +++ b/botagent/bot_agent.py @@ -271,8 +271,15 @@ class SmartBotAgent: while True: turn_info = requests.get(f"{self.base_url}/turn").json() if not turn_info.get("game_started", False): - print("⏳ [LOBBY] Waiting for game to start via 'Start Game' in UI...", end="\r", flush=True) - time.sleep(0.5) + # Check if bot was removed (e.g., board was reset) + if self.bot_id: + res = requests.get(f"{self.base_url}/players/{self.bot_id}") + if res.status_code == 404: + print("\n⚠️ [RESET] Board was regenerated. Rejoining lobby...") + self.register() + + print("⏳ [LOBBY] Waiting for game to start via 'Start Game' in UI... ", end="\r", flush=True) + time.sleep(1.0) continue curr_player_id = turn_info.get("current_player_id")