Update app.py
Browse files
app.py
CHANGED
@@ -63,19 +63,19 @@ class WordGame:
|
|
63 |
def generate_task(self):
|
64 |
self.attempts = 3
|
65 |
self.target_word = random.choice(words)
|
66 |
-
print(f"New target word: {self.target_word}")
|
67 |
return self.target_word
|
68 |
|
69 |
def check_input_for_word(self, string):
|
70 |
if self.target_word in string.lower():
|
71 |
-
print(f"The player input the target word and the task was reset.")
|
72 |
self.generate_task()
|
73 |
self.points -= 1
|
74 |
#self.update_status(message="You input the target word yourself, so you lost one point and the game reset.")
|
75 |
return True
|
76 |
|
77 |
else:
|
78 |
-
print(f"The player did not input the target word, so that's good.")
|
79 |
return False
|
80 |
|
81 |
|
@@ -83,7 +83,7 @@ class WordGame:
|
|
83 |
print(f"Checking for '{self.target_word}' in '{string}'.")
|
84 |
if self.target_word in string.lower():
|
85 |
self.points += self.attempts
|
86 |
-
print(f"The player scored {self.attempts} points and has a total of {self.points}.")
|
87 |
score_gained = self.attempts
|
88 |
self.generate_task()
|
89 |
return f"Success! You earned {score_gained} points!"
|
@@ -91,24 +91,18 @@ class WordGame:
|
|
91 |
else:
|
92 |
print("The response did not contain the word.")
|
93 |
self.attempts -= 1
|
94 |
-
print(f"Remaining attempts: {self.attempts}")
|
95 |
if self.attempts <= 0:
|
96 |
self.generate_task()
|
97 |
#print(f"The player ran out of attempts.")
|
98 |
return f"You did not win in three attempts. Generating new target word."
|
99 |
#self.update_status(message=f"You did not win in three attempts. Generating new target word.")
|
100 |
else:
|
101 |
-
print(f"The player has attempts left.")
|
102 |
return "That didn't quite hit the mark. Try again!"
|
103 |
|
104 |
def update_status(self, message=""):
|
105 |
return f'Current score: {self.points}, remaining attempts: {self.attempts}, target word: "{self.target_word}" {message}'
|
106 |
-
|
107 |
-
def analyse_output(self, message, history):
|
108 |
-
print("---message---")
|
109 |
-
print(message)
|
110 |
-
print("---message---")
|
111 |
-
print(history)
|
112 |
|
113 |
|
114 |
|
|
|
63 |
def generate_task(self):
|
64 |
self.attempts = 3
|
65 |
self.target_word = random.choice(words)
|
66 |
+
#print(f"New target word: {self.target_word}")
|
67 |
return self.target_word
|
68 |
|
69 |
def check_input_for_word(self, string):
|
70 |
if self.target_word in string.lower():
|
71 |
+
#print(f"The player input the target word and the task was reset.")
|
72 |
self.generate_task()
|
73 |
self.points -= 1
|
74 |
#self.update_status(message="You input the target word yourself, so you lost one point and the game reset.")
|
75 |
return True
|
76 |
|
77 |
else:
|
78 |
+
#print(f"The player did not input the target word, so that's good.")
|
79 |
return False
|
80 |
|
81 |
|
|
|
83 |
print(f"Checking for '{self.target_word}' in '{string}'.")
|
84 |
if self.target_word in string.lower():
|
85 |
self.points += self.attempts
|
86 |
+
#print(f"The player scored {self.attempts} points and has a total of {self.points}.")
|
87 |
score_gained = self.attempts
|
88 |
self.generate_task()
|
89 |
return f"Success! You earned {score_gained} points!"
|
|
|
91 |
else:
|
92 |
print("The response did not contain the word.")
|
93 |
self.attempts -= 1
|
94 |
+
#print(f"Remaining attempts: {self.attempts}")
|
95 |
if self.attempts <= 0:
|
96 |
self.generate_task()
|
97 |
#print(f"The player ran out of attempts.")
|
98 |
return f"You did not win in three attempts. Generating new target word."
|
99 |
#self.update_status(message=f"You did not win in three attempts. Generating new target word.")
|
100 |
else:
|
101 |
+
#print(f"The player has attempts left.")
|
102 |
return "That didn't quite hit the mark. Try again!"
|
103 |
|
104 |
def update_status(self, message=""):
|
105 |
return f'Current score: {self.points}, remaining attempts: {self.attempts}, target word: "{self.target_word}" {message}'
|
|
|
|
|
|
|
|
|
|
|
|
|
106 |
|
107 |
|
108 |
|