ilyassh commited on
Commit
4cf1475
·
verified ·
1 Parent(s): 6491daf

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +16 -7
app.py CHANGED
@@ -128,15 +128,22 @@ def generate_others_locations_knowledge(suspect):
128
  chance = random.random()
129
  if chance < 0.5:
130
  # They know where the other was
131
- knowledge[other["name"]] = f"They were in the {other['alibi_location']}."
132
  elif chance < 0.75:
133
  # They are unsure
134
- knowledge[other["name"]] = "You are not sure where they were."
135
  else:
136
  # They don't know
137
- knowledge[other["name"]] = "You have no idea where they were."
138
  return knowledge
139
 
 
 
 
 
 
 
 
140
  def get_ai_response(suspect_name, player_input):
141
  suspect = suspects[suspect_name]
142
  game_state["turns"] += 1
@@ -288,10 +295,12 @@ def bluff(player_input):
288
 
289
  def analyze_response():
290
  game_state["turns"] += 1
291
- puzzle = "Solve this riddle to analyze the suspect's response: What has keys but can't open locks?"
292
- correct_answer = "piano"
293
- # For the purpose of this code, we'll assume the player always fails
294
- return "You fail to detect any lies."
 
 
295
 
296
  def handle_accusation(player_input):
297
  suspect_guess = None
 
128
  chance = random.random()
129
  if chance < 0.5:
130
  # They know where the other was
131
+ knowledge[other["name"]] = f"was in the {other['alibi_location']}."
132
  elif chance < 0.75:
133
  # They are unsure
134
+ knowledge[other["name"]] = "you are not sure where they were."
135
  else:
136
  # They don't know
137
+ knowledge[other["name"]] = "you have no idea where they were."
138
  return knowledge
139
 
140
+ def analyze_tone(player_input):
141
+ accusatory_words = ["did you", "murderer", "kill", "guilty", "crime", "weapon", "suspect"]
142
+ if any(word in player_input.lower() for word in accusatory_words):
143
+ return "accusatory"
144
+ else:
145
+ return "neutral"
146
+
147
  def get_ai_response(suspect_name, player_input):
148
  suspect = suspects[suspect_name]
149
  game_state["turns"] += 1
 
295
 
296
  def analyze_response():
297
  game_state["turns"] += 1
298
+ # For simplicity, we'll simulate the outcome
299
+ success = random.choice([True, False])
300
+ if success:
301
+ return "You successfully detect that the suspect is lying!"
302
+ else:
303
+ return "You fail to detect any lies."
304
 
305
  def handle_accusation(player_input):
306
  suspect_guess = None