Skip to content

Commit a337ac8

Browse files
committed
fix and test
1 parent 8735bf8 commit a337ac8

4 files changed

Lines changed: 9 additions & 8 deletions

File tree

scripts/random_game.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,8 @@ def main(reset=False, always_kill=False, remove_last_n=0):
5656
try:
5757
# Here, you would insert your custom LLM call and log probability logic.
5858
action_taken = random.choice(actions_pd)
59-
llm_response, cot = action_taken.text, "<think>Was thinking about this option: " + action_taken.text + "</think>"
59+
action_taken.set_stories()
60+
llm_response, cot = action_taken.command_perspective, "<think>Was thinking about this option: " + action_taken.command_perspective + "</think>"
6061
except KeyboardInterrupt:
6162
action_idx, llm_response, cot, _ = prompt_manual_fallback_action(actions_pd)
6263

@@ -87,7 +88,7 @@ def main(reset=False, always_kill=False, remove_last_n=0):
8788
action_taken = random.choice(kill_actions)
8889
elif current_player.role == PlayerRole.CREWMATE and task_actions:
8990
action_taken = random.choice(task_actions)
90-
llm_response, cot = action_taken.text, "<think>Was thinking about this option: " + action_taken.text + "</think>"
91+
llm_response, cot = action_taken.command_perspective, "<think>Was thinking about this option: " + action_taken.command_perspective + "</think>"
9192
except KeyboardInterrupt:
9293
action_idx, llm_response, cot, _ = prompt_manual_fallback_action(actions_player_can_take)
9394

src/among_them/models/action.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ def __init__(
2626
def set_stories(self):
2727
if self.type == ActionType.MOVE:
2828
self.command_perspective = f"move to {self.target_location.value}"
29-
self.agent_perspective = f"You are in {self.target_location.value}."
29+
self.agent_perspective = f"You moved to {self.target_location.value}."
3030
self.observer_perspective = f"You saw {self.player_name} move to {self.target_location.value}."
3131
self.global_perspective = f"{self.player_name} moved to {self.target_location.value}."
3232
elif self.type == ActionType.WAIT:

src/among_them/utils/player_utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ def get_last_player_action(history: List[History], player: Player) -> History:
3939
for i in range(len(history) - 1, -1, -1):
4040
if history[i].action_taken.player_name == player.name:
4141
return history[i]
42-
elif history[i].action_taken.target_message and history[i].action_taken.target_message.startswith("Everyone is in the cafeteria and start from there"):
42+
elif getattr(history[i].action_taken, "target_message", None) and history[i].action_taken.target_message.startswith("Everyone is in the cafeteria and start from there"):
4343
return history[i]
4444
return history[0]
4545

src/among_them/utils/ui_utils.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ def prompt_manual_fallback_action(actions: List[Action]) -> Tuple[int, str, str,
3535
"""Handles manual action selection when AI generation is interrupted."""
3636
print("\nAI action generation interrupted. Please choose an action manually:")
3737
for i, action in enumerate(actions):
38-
print(f"{i + 1}. {action.text}")
38+
print(f"{i + 1}. {action.set_stories().command_perspective}")
3939

4040
if actions[0].type == ActionType.SPEAK:
4141
try:
@@ -49,10 +49,10 @@ def prompt_manual_fallback_action(actions: List[Action]) -> Tuple[int, str, str,
4949
choice_idx = int(choice) - 1
5050
if 0 <= choice_idx < len(actions):
5151
selected_action = actions[choice_idx]
52-
print(f"You chose: {selected_action.text}")
52+
print(f"You chose: {selected_action.command_perspective}")
5353
return (
5454
choice_idx,
55-
selected_action.text,
55+
selected_action.command_perspective,
5656
"",
5757
{},
5858
)
@@ -64,7 +64,7 @@ def prompt_manual_fallback_action(actions: List[Action]) -> Tuple[int, str, str,
6464
print("\nInput stream closed. Defaulting to first action.")
6565
return (
6666
0,
67-
actions[0].text,
67+
actions[0].command_perspective,
6868
"",
6969
{},
7070
)

0 commit comments

Comments
 (0)