Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -15,9 +15,7 @@ def get_userInput():
|
|
| 15 |
|
| 16 |
def validate_userInput(user_input):
|
| 17 |
if user_input.isdigit():
|
| 18 |
-
if int(user_input)
|
| 19 |
-
return False
|
| 20 |
-
else:
|
| 21 |
if int(user_input) in st.session_state.legal_numbers:
|
| 22 |
return True
|
| 23 |
else:
|
|
@@ -125,13 +123,14 @@ st.header("Python - Tic Tac Toe")
|
|
| 125 |
display_guide()
|
| 126 |
|
| 127 |
user_input=get_userInput()
|
| 128 |
-
update_legalNumbers(0)
|
| 129 |
-
#display_board(0)
|
| 130 |
|
| 131 |
#UI Buttons
|
| 132 |
submit=st.button('Submit')
|
| 133 |
replay=st.button('Replay')
|
| 134 |
|
|
|
|
|
|
|
|
|
|
| 135 |
#Button functionality
|
| 136 |
if submit:
|
| 137 |
response=validate_userInput(user_input)
|
|
|
|
| 15 |
|
| 16 |
def validate_userInput(user_input):
|
| 17 |
if user_input.isdigit():
|
| 18 |
+
if int(user_input) >= 1 and int(user_input) <= 9:
|
|
|
|
|
|
|
| 19 |
if int(user_input) in st.session_state.legal_numbers:
|
| 20 |
return True
|
| 21 |
else:
|
|
|
|
| 123 |
display_guide()
|
| 124 |
|
| 125 |
user_input=get_userInput()
|
|
|
|
|
|
|
| 126 |
|
| 127 |
#UI Buttons
|
| 128 |
submit=st.button('Submit')
|
| 129 |
replay=st.button('Replay')
|
| 130 |
|
| 131 |
+
update_legalNumbers(0)
|
| 132 |
+
display_board(0)
|
| 133 |
+
|
| 134 |
#Button functionality
|
| 135 |
if submit:
|
| 136 |
response=validate_userInput(user_input)
|