diff --git a/examples/werewolf/README.md b/examples/werewolf/README.md index 04f5b128c..90e275329 100644 --- a/examples/werewolf/README.md +++ b/examples/werewolf/README.md @@ -92,7 +92,7 @@ More details please refer to the code of [`DictDialogAgent`](../.. with msghub(wolves, announcement=hint) as hub: for _ in range(MAX_WEREWOLF_DISCUSSION_ROUND): x = sequentialpipeline(wolves) - if x.agreement: + if x.get("agreement", False): break # ... ``` \ No newline at end of file diff --git a/examples/werewolf/prompt.py b/examples/werewolf/prompt.py index 5537d672e..ed454de44 100644 --- a/examples/werewolf/prompt.py +++ b/examples/werewolf/prompt.py @@ -8,7 +8,7 @@ class Prompts: to_wolves = ( "{}, you are werewolves. If you are alone, eliminate a player, else " "discuss with your teammates and reach an agreement. Response in the " - "following format which can be loaded by python json.loads()" + "following format which can be loaded by python json.loads()\n" "{{\n" ' "thought": "thought",\n' ' "speak": "thoughts summary to say to others",\n' @@ -35,7 +35,7 @@ class Prompts: "{{\n" ' "thought": "thought",\n' ' "speak": "thoughts summary to say",\n' - ' "resurrect": "true/false"\n' + ' "resurrect": true/false\n' "}}" ) @@ -44,7 +44,8 @@ class Prompts: "json format which can be loaded by python json.loads()\n" "{{\n" ' "thought": "thought", \n' - ' "speak": "False or player_name"\n' + ' "speak": "thoughts summary to say",\n' + ' "eliminate": ture/false\n' "}}" ) diff --git a/examples/werewolf/werewolf.py b/examples/werewolf/werewolf.py index bb39294f2..96af8a0b2 100644 --- a/examples/werewolf/werewolf.py +++ b/examples/werewolf/werewolf.py @@ -35,7 +35,7 @@ with msghub(wolves, announcement=hint) as hub: for _ in range(MAX_WEREWOLF_DISCUSSION_ROUND): x = sequentialpipeline(wolves) - if x.agreement: + if x.get("agreement", False): break # werewolves vote @@ -56,14 +56,14 @@ {"witch_name": witch.name, "dead_name": dead_player[0]}, ), ) - if witch(hint).resurrect: + if witch(hint).get("resurrect", False): healing_used_tonight = True dead_player.pop() healing = False if poison and not healing_used_tonight: x = witch(HostMsg(content=Prompts.to_witch_poison)) - if "False" not in x.content: + if x.get("eliminate", False): dead_player.append(extract_name_and_id(x.content)[0]) poison = False