Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
@@ -110,10 +110,12 @@ def play_boggle(board, words, time_limit):
|
|
110 |
start_time = time.time()
|
111 |
remaining_time = time_limit
|
112 |
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
|
|
|
|
117 |
if len(new_word) >= 3 and new_word not in words and validate_word(new_word.upper(), board):
|
118 |
words.add(new_word)
|
119 |
st.write(f"Added {new_word} to the list of words!")
|
@@ -122,14 +124,15 @@ def play_boggle(board, words, time_limit):
|
|
122 |
else:
|
123 |
st.write("Invalid word. Try again.")
|
124 |
|
125 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
126 |
st.write(words)
|
127 |
-
st.write("Time remaining:", remaining_time)
|
128 |
-
time.sleep(1)
|
129 |
-
remaining_time = int(time_limit - (time.time() - start_time))
|
130 |
|
131 |
-
st.write("Time's up! Here are your final words:")
|
132 |
-
st.write(words)
|
133 |
|
134 |
|
135 |
if __name__ == "__main__":
|
|
|
110 |
start_time = time.time()
|
111 |
remaining_time = time_limit
|
112 |
|
113 |
+
with st.form(key="new_word"):
|
114 |
+
new_word = st.text_input("Enter a new word:")
|
115 |
+
submit_button = st.form_submit_button("Submit")
|
116 |
+
|
117 |
+
while remaining_time > 0:
|
118 |
+
if submit_button:
|
119 |
if len(new_word) >= 3 and new_word not in words and validate_word(new_word.upper(), board):
|
120 |
words.add(new_word)
|
121 |
st.write(f"Added {new_word} to the list of words!")
|
|
|
124 |
else:
|
125 |
st.write("Invalid word. Try again.")
|
126 |
|
127 |
+
st.write("Here are your words:")
|
128 |
+
st.write(words)
|
129 |
+
st.write("Time remaining:", remaining_time)
|
130 |
+
time.sleep(1)
|
131 |
+
remaining_time = int(time_limit - (time.time() - start_time))
|
132 |
+
|
133 |
+
st.write("Time's up! Here are your final words:")
|
134 |
st.write(words)
|
|
|
|
|
|
|
135 |
|
|
|
|
|
136 |
|
137 |
|
138 |
if __name__ == "__main__":
|