Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,24 +1,7 @@
|
|
| 1 |
import streamlit as st
|
| 2 |
|
| 3 |
-
#UIApp starts here
|
| 4 |
-
st.set_page_config(page_title="Python - Tic Tac Toe", page_icon=":python:")
|
| 5 |
-
st.header("Python - Tic Tac Toe")
|
| 6 |
-
|
| 7 |
-
user_input=get_userInput()
|
| 8 |
-
display_board()
|
| 9 |
-
|
| 10 |
-
#UI Buttons
|
| 11 |
-
submit=st.button('Submit')
|
| 12 |
-
replay=st.button('Replay')
|
| 13 |
-
|
| 14 |
-
#After User Interaction
|
| 15 |
-
response=validate_userInput(user_input)
|
| 16 |
-
|
| 17 |
#Globals
|
| 18 |
legal_numbers = [1,2,3,4,5,6,7,8,9]
|
| 19 |
-
col1, col2, col3 = st.columns(3)
|
| 20 |
-
col4, col5, col6 = st.columns(3)
|
| 21 |
-
col7, col8, col9 = st.columns(3)
|
| 22 |
|
| 23 |
def get_userInput():
|
| 24 |
input = st.text_input("Enter a number between 1 to 9: ", key="input")
|
|
@@ -31,7 +14,10 @@ def validate_userInput(user_input):
|
|
| 31 |
else:
|
| 32 |
return "Please enter a digit between 1 to 9."
|
| 33 |
|
| 34 |
-
def display_board():
|
|
|
|
|
|
|
|
|
|
| 35 |
with col1:
|
| 36 |
st.text("X")
|
| 37 |
with col2:
|
|
@@ -56,6 +42,20 @@ def reset_legalNumbers():
|
|
| 56 |
|
| 57 |
#def update_legalNumbers():
|
| 58 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 59 |
#Button functionality
|
| 60 |
if submit:
|
| 61 |
st.subheader("")
|
|
|
|
| 1 |
import streamlit as st
|
| 2 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 3 |
#Globals
|
| 4 |
legal_numbers = [1,2,3,4,5,6,7,8,9]
|
|
|
|
|
|
|
|
|
|
| 5 |
|
| 6 |
def get_userInput():
|
| 7 |
input = st.text_input("Enter a number between 1 to 9: ", key="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("X")
|
| 23 |
with col2:
|
|
|
|
| 42 |
|
| 43 |
#def update_legalNumbers():
|
| 44 |
|
| 45 |
+
#UIApp starts here
|
| 46 |
+
st.set_page_config(page_title="Python - Tic Tac Toe", page_icon=":python:")
|
| 47 |
+
st.header("Python - Tic Tac Toe")
|
| 48 |
+
|
| 49 |
+
user_input=get_userInput()
|
| 50 |
+
display_board()
|
| 51 |
+
|
| 52 |
+
#UI Buttons
|
| 53 |
+
submit=st.button('Submit')
|
| 54 |
+
replay=st.button('Replay')
|
| 55 |
+
|
| 56 |
+
#After User Interaction
|
| 57 |
+
response=validate_userInput(user_input)
|
| 58 |
+
|
| 59 |
#Button functionality
|
| 60 |
if submit:
|
| 61 |
st.subheader("")
|