Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -3,6 +3,9 @@ import pandas as pd
|
|
| 3 |
|
| 4 |
#Globals
|
| 5 |
legal_numbers = [1,2,3,4,5,6,7,8,9]
|
|
|
|
|
|
|
|
|
|
| 6 |
|
| 7 |
def get_userInput():
|
| 8 |
input = st.text_input("Enter a number between 1 to 9: ", key="input")
|
|
@@ -14,16 +17,13 @@ def validate_userInput(user_input):
|
|
| 14 |
else:
|
| 15 |
return "Please enter a digit between 1 to 9."
|
| 16 |
|
| 17 |
-
def display_board():
|
| 18 |
-
col1, col2, col3 = st.columns(3)
|
| 19 |
-
col4, col5, col6 = st.columns(3)
|
| 20 |
-
col7, col8, col9 = st.columns(3)
|
| 21 |
with col1:
|
| 22 |
-
st.text("
|
| 23 |
with col2:
|
| 24 |
-
st.text("
|
| 25 |
with col3:
|
| 26 |
-
st.text("
|
| 27 |
with col4:
|
| 28 |
st.text(" X ")
|
| 29 |
with col5:
|
|
@@ -46,17 +46,18 @@ def reset_legalNumbers():
|
|
| 46 |
#UIApp starts here
|
| 47 |
st.set_page_config(page_title="Python - Tic Tac Toe", page_icon=":python:")
|
| 48 |
st.header("Python - Tic Tac Toe")
|
| 49 |
-
st.text("Legal Numbers: " + "".join(str(legal_numbers)))
|
| 50 |
|
| 51 |
user_input=get_userInput()
|
| 52 |
-
|
| 53 |
-
|
| 54 |
display_board()
|
| 55 |
|
| 56 |
#UI Buttons
|
| 57 |
submit=st.button('Submit')
|
| 58 |
replay=st.button('Replay')
|
| 59 |
|
|
|
|
|
|
|
|
|
|
| 60 |
#Button functionality
|
| 61 |
if submit:
|
| 62 |
st.subheader("")
|
|
|
|
| 3 |
|
| 4 |
#Globals
|
| 5 |
legal_numbers = [1,2,3,4,5,6,7,8,9]
|
| 6 |
+
col1, col2, col3 = st.columns(3)
|
| 7 |
+
col4, col5, col6 = st.columns(3)
|
| 8 |
+
col7, col8, col9 = st.columns(3)
|
| 9 |
|
| 10 |
def get_userInput():
|
| 11 |
input = st.text_input("Enter a number between 1 to 9: ", key="input")
|
|
|
|
| 17 |
else:
|
| 18 |
return "Please enter a digit between 1 to 9."
|
| 19 |
|
| 20 |
+
def display_board():
|
|
|
|
|
|
|
|
|
|
| 21 |
with col1:
|
| 22 |
+
st.text("X")
|
| 23 |
with col2:
|
| 24 |
+
st.text("O")
|
| 25 |
with col3:
|
| 26 |
+
st.text("...")
|
| 27 |
with col4:
|
| 28 |
st.text(" X ")
|
| 29 |
with col5:
|
|
|
|
| 46 |
#UIApp starts here
|
| 47 |
st.set_page_config(page_title="Python - Tic Tac Toe", page_icon=":python:")
|
| 48 |
st.header("Python - Tic Tac Toe")
|
|
|
|
| 49 |
|
| 50 |
user_input=get_userInput()
|
| 51 |
+
st.text("Legal Numbers: " + "".join(str(legal_numbers)))
|
|
|
|
| 52 |
display_board()
|
| 53 |
|
| 54 |
#UI Buttons
|
| 55 |
submit=st.button('Submit')
|
| 56 |
replay=st.button('Replay')
|
| 57 |
|
| 58 |
+
#After User Interaction
|
| 59 |
+
response=validate_userInput(user_input)
|
| 60 |
+
|
| 61 |
#Button functionality
|
| 62 |
if submit:
|
| 63 |
st.subheader("")
|