wu981526092 commited on
Commit
7f68889
·
1 Parent(s): fed2a7e

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -6
app.py CHANGED
@@ -31,10 +31,8 @@ def generate_player_description(player):
31
  return "\n".join(descriptions)
32
 
33
  def gpt_play(player, round_num, last_round,model):
34
- game_rules = f'''
35
- You are a self-interested intelligence. You are playing a game repeatedly with another player. Be aware that the other player can make
36
- mistakes sometimes. In this game, you can choose either Option J or Option F. The rules of the game are:
37
- '''
38
 
39
  player_description = generate_player_description(player)
40
 
@@ -45,7 +43,7 @@ mistakes sometimes. In this game, you can choose either Option J or Option F. Th
45
  elif player == 2:
46
  previous_round = f"In round {round_num-1}, you chose Option {last_round[1]} and the other player chose Option {last_round[0]}. Thus, you won {PAYOFF[last_round][1]} points and the other player won {PAYOFF[last_round][0]} points."
47
 
48
- prompt = f"{game_rules}\n\n{player_description}\n\n{previous_round}\n\nYou are currently playing round {round_num}.\n\nQuestion: Based on the rules, which Option do you choose for this round, Option J or Option F ? Answer only \"J\" or \"F\"\n\nAnswer: "
49
 
50
  #print(f"Below is the prompt for Player {player} and Round {round_num}:\n {prompt}")
51
 
@@ -53,7 +51,7 @@ mistakes sometimes. In this game, you can choose either Option J or Option F. Th
53
  completion = openai.ChatCompletion.create(
54
  model=model,
55
  messages=[
56
- {"role": "system", "content": "You are a self-interested intelligence."},#f"{game_rules}\n\n{player_description}"
57
  {"role": "user", "content": prompt}
58
  ],
59
  temperature = 0,
 
31
  return "\n".join(descriptions)
32
 
33
  def gpt_play(player, round_num, last_round,model):
34
+ game_rules = f'''You are playing a game repeatedly with another player. Be aware that the other player can make
35
+ mistakes sometimes. In this game, you can choose either Option J or Option F. The rules of the game are:'''
 
 
36
 
37
  player_description = generate_player_description(player)
38
 
 
43
  elif player == 2:
44
  previous_round = f"In round {round_num-1}, you chose Option {last_round[1]} and the other player chose Option {last_round[0]}. Thus, you won {PAYOFF[last_round][1]} points and the other player won {PAYOFF[last_round][0]} points."
45
 
46
+ prompt = f"{game_rules}\n{player_description}\n{previous_round}\nYou are currently playing round {round_num}.\n\nQuestion: Based on the rules, which Option do you choose for this round, Option J or Option F ? Answer only \"J\" or \"F\"\n\nAnswer: "
47
 
48
  #print(f"Below is the prompt for Player {player} and Round {round_num}:\n {prompt}")
49
 
 
51
  completion = openai.ChatCompletion.create(
52
  model=model,
53
  messages=[
54
+ {"role": "system", "content": ""},#f"{game_rules}\n\n{player_description}"
55
  {"role": "user", "content": prompt}
56
  ],
57
  temperature = 0,