Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -29,7 +29,34 @@ def toggleValue():
|
|
| 29 |
st.session_state.Value = "O"
|
| 30 |
else:
|
| 31 |
st.session_state.Value = "X"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 32 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 33 |
def display_board(num):
|
| 34 |
col1, col2, col3 = st.columns(3)
|
| 35 |
col4, col5, col6 = st.columns(3)
|
|
@@ -62,13 +89,15 @@ def reset_game():
|
|
| 62 |
|
| 63 |
def update_legalNumbers(number):
|
| 64 |
st.session_state.legal_numbers.remove(int(user_input))
|
| 65 |
-
st.
|
| 66 |
|
| 67 |
#UIApp starts here
|
| 68 |
st.set_page_config(page_title="Python - Tic Tac Toe", page_icon=":python:")
|
| 69 |
st.header("Python - Tic Tac Toe")
|
|
|
|
| 70 |
|
| 71 |
user_input=get_userInput()
|
|
|
|
| 72 |
|
| 73 |
#UI Buttons
|
| 74 |
submit=st.button('Submit')
|
|
|
|
| 29 |
st.session_state.Value = "O"
|
| 30 |
else:
|
| 31 |
st.session_state.Value = "X"
|
| 32 |
+
|
| 33 |
+
def display_guide():
|
| 34 |
+
st.text("How to play: Enter the grid number as shown below to mark 'X' or 'O'. "+
|
| 35 |
+
"Kinldy pick any number shown in Legal Numbers. " +
|
| 36 |
+
"Number cannot be repeated more than twice.")
|
| 37 |
|
| 38 |
+
col1, col2, col3 = st.columns(3)
|
| 39 |
+
col4, col5, col6 = st.columns(3)
|
| 40 |
+
col7, col8, col9 = st.columns(3)
|
| 41 |
+
with col1:
|
| 42 |
+
st.text("1")
|
| 43 |
+
with col2:
|
| 44 |
+
st.text("2")
|
| 45 |
+
with col3:
|
| 46 |
+
st.text("3")
|
| 47 |
+
with col4:
|
| 48 |
+
st.text("4")
|
| 49 |
+
with col5:
|
| 50 |
+
st.text("5")
|
| 51 |
+
with col6:
|
| 52 |
+
st.text("6")
|
| 53 |
+
with col7:
|
| 54 |
+
st.text("7")
|
| 55 |
+
with col8:
|
| 56 |
+
st.text("8")
|
| 57 |
+
with col9:
|
| 58 |
+
st.text("9")
|
| 59 |
+
|
| 60 |
def display_board(num):
|
| 61 |
col1, col2, col3 = st.columns(3)
|
| 62 |
col4, col5, col6 = st.columns(3)
|
|
|
|
| 89 |
|
| 90 |
def update_legalNumbers(number):
|
| 91 |
st.session_state.legal_numbers.remove(int(user_input))
|
| 92 |
+
st.text("Legal Numbers: " + "".join(str(st.session_state.legal_numbers)))
|
| 93 |
|
| 94 |
#UIApp starts here
|
| 95 |
st.set_page_config(page_title="Python - Tic Tac Toe", page_icon=":python:")
|
| 96 |
st.header("Python - Tic Tac Toe")
|
| 97 |
+
display_guide()
|
| 98 |
|
| 99 |
user_input=get_userInput()
|
| 100 |
+
update_legalNumbers(user_input)
|
| 101 |
|
| 102 |
#UI Buttons
|
| 103 |
submit=st.button('Submit')
|