Eric Botti commited on
Commit
cebc517
·
1 Parent(s): 172af0f

separate prompts file

Browse files
Files changed (3) hide show
  1. src/game.py +1 -0
  2. src/game_utils.py +1 -57
  3. src/prompts.py +55 -0
src/game.py CHANGED
@@ -4,6 +4,7 @@ from game_utils import *
4
  from models import *
5
  from player import Player
6
  from parser import ParserKani
 
7
 
8
  # Default Values
9
  NUMBER_OF_PLAYERS = 5
 
4
  from models import *
5
  from player import Player
6
  from parser import ParserKani
7
+ from prompts import fetch_prompt
8
 
9
  # Default Values
10
  NUMBER_OF_PLAYERS = 5
src/game_utils.py CHANGED
@@ -49,60 +49,4 @@ def count_chameleon_votes(player_votes: list[str]) -> str | None:
49
 
50
  def log(log_object, log_file):
51
  with open(log_file, "a+") as f:
52
- f.write(json.dumps(log_object) + "\n")
53
-
54
-
55
- # Prompt Stuff
56
- def fetch_prompt(prompt_name):
57
- return prompts[prompt_name]
58
-
59
-
60
- _game_rules = '''\
61
- GAME RULES: You are playing a social deduction game where every player pretends the be the same animal.
62
- During the round players go around the room and make an "I"-statement as if they were the animal.
63
- All players know what animal they are pretending to be, except one who is known as the Chameleon. The Chameleon and must blend in by providing details about the animal using context from other players.
64
- The other players must be careful not to give away too much information with their responses so that Chameleon cannot guess the animal. After all players have spoken, they vote on who they think the Chameleon is.
65
-
66
- '''
67
-
68
- _herd_animal = """\
69
- You are a {animal}, keep this a secret at all costs.
70
- In 10 words or less give a description of yourself starting with "I". The description should not give away too much information about the {animal} as you do not want the Chameleon to be able to guess what animal you are. Do not repeat responses from other players.
71
- If the Chameleon can guess what animal you really are you will LOSE.
72
- Previously Mentioned Descriptions:
73
- {player_responses}
74
- """
75
-
76
- _chameleon_animal = """\
77
- You are the Chameleon, keep this a secret at all costs.
78
- You don't know what animal the other players are, your goal is to deduce it using the context they provide.
79
- Starting with "I" describe yourself in 10 words or less as if you are the same animal as the other players.
80
- If no one else has said anything try to say something generic that could be true of any animals.
81
- If the other players realize you are the Chameleon you will LOSE.
82
- Previously Mentioned Descriptions:
83
- {player_responses}
84
- """
85
-
86
- _chameleon_guess_decision = """\
87
- You now have the opportunity to guess what animal the other players are pretending to be.
88
- If you guess correctly you will WIN, if you guess incorrectly you will LOSE.
89
- If you believe you know what animal the other players are pretending to be make choose to GUESS, otherwise choose to PASS.
90
- """
91
-
92
- _chameleon_guess_animal = """\
93
- What animal do you think the other players are pretending to be?
94
- """
95
-
96
- _vote_prompt = """\
97
- Below are the responses from all players. Now it is time to vote. Choose from the players below who you think the Chameleon is.
98
- {player_responses}
99
- """
100
-
101
- prompts = {
102
- "herd_animal": _game_rules + _herd_animal,
103
- "chameleon_animal": _game_rules + _chameleon_animal,
104
- "chameleon_guess_decision": _chameleon_guess_decision,
105
- "chameleon_guess_animal": _chameleon_guess_animal,
106
- "vote": _vote_prompt
107
- }
108
-
 
49
 
50
  def log(log_object, log_file):
51
  with open(log_file, "a+") as f:
52
+ f.write(json.dumps(log_object) + "\n")
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
src/prompts.py ADDED
@@ -0,0 +1,55 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+
3
+ def fetch_prompt(prompt_name):
4
+ return prompts[prompt_name]
5
+
6
+
7
+ _game_rules = '''\
8
+ GAME RULES: You are playing a social deduction game where every player pretends the be the same animal.
9
+ During the round players go around the room and make an "I"-statement as if they were the animal.
10
+ All players know what animal they are pretending to be, except one who is known as the Chameleon. The Chameleon and must blend in by providing details about the animal using context from other players.
11
+ The other players must be careful not to give away too much information with their responses so that Chameleon cannot guess the animal. After all players have spoken, they vote on who they think the Chameleon is.
12
+
13
+ '''
14
+
15
+ _herd_animal = """\
16
+ You are a {animal}, keep this a secret at all costs.
17
+ In 10 words or less give a description of yourself starting with "I". The description should not give away too much information about the {animal} as you do not want the Chameleon to be able to guess what animal you are. Do not repeat responses from other players.
18
+ If the Chameleon can guess what animal you really are you will LOSE.
19
+ Previously Mentioned Descriptions:
20
+ {player_responses}
21
+ """
22
+
23
+ _chameleon_animal = """\
24
+ You are the Chameleon, keep this a secret at all costs.
25
+ You don't know what animal the other players are, your goal is to deduce it using the context they provide.
26
+ Starting with "I" describe yourself in 10 words or less as if you are the same animal as the other players.
27
+ If no one else has said anything try to say something generic that could be true of any animals.
28
+ If the other players realize you are the Chameleon you will LOSE.
29
+ Previously Mentioned Descriptions:
30
+ {player_responses}
31
+ """
32
+
33
+ _chameleon_guess_decision = """\
34
+ You now have the opportunity to guess what animal the other players are pretending to be.
35
+ If you guess correctly you will WIN, if you guess incorrectly you will LOSE.
36
+ If you believe you know what animal the other players are pretending to be make choose to GUESS, otherwise choose to PASS.
37
+ """
38
+
39
+ _chameleon_guess_animal = """\
40
+ What animal do you think the other players are pretending to be?
41
+ """
42
+
43
+ _vote_prompt = """\
44
+ Below are the responses from all players. Now it is time to vote. Choose from the players below who you think the Chameleon is.
45
+ {player_responses}
46
+ """
47
+
48
+ prompts = {
49
+ "herd_animal": _game_rules + _herd_animal,
50
+ "chameleon_animal": _game_rules + _chameleon_animal,
51
+ "chameleon_guess_decision": _chameleon_guess_decision,
52
+ "chameleon_guess_animal": _chameleon_guess_animal,
53
+ "vote": _vote_prompt
54
+ }
55
+