From 1c1425c566e9547c1d09e501a89d00b0c89e6d73 Mon Sep 17 00:00:00 2001 From: Steve Phelps Date: Sun, 5 Nov 2023 10:30:47 +0000 Subject: [PATCH] fix bug in extracting the ai choice in the next round messag --- llm_cooperation/gametypes/simultaneous.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/llm_cooperation/gametypes/simultaneous.py b/llm_cooperation/gametypes/simultaneous.py index a7f4762..7df95bc 100644 --- a/llm_cooperation/gametypes/simultaneous.py +++ b/llm_cooperation/gametypes/simultaneous.py @@ -52,8 +52,12 @@ def analyse_rounds( def next_round( partner_strategy: Strategy[CT], state: GameState[CT, PT, RT] ) -> List[Completion]: - ai_choice = state.game_setup.extract_choice(state.messages[-2]) + previous_message = state.messages[-1] + logger.debug("previous_message = %s", previous_message) + ai_choice = state.game_setup.extract_choice(previous_message) user_choice = partner_strategy(state) + logger.debug("ai_choice = %s", ai_choice) + logger.debug("user_choice = %s", user_choice) ai_payoff, user_payoff = state.game_setup.payoffs(ai_choice, user_choice) return [ user_message(