Spaces:
Sleeping
Sleeping
TuanScientist
commited on
Commit
•
3f02d24
1
Parent(s):
5bda4f8
Update app.py
Browse files
app.py
CHANGED
@@ -37,7 +37,7 @@ def init(post_init=False):
|
|
37 |
if not post_init:
|
38 |
st.session_state.opponent = 'Human'
|
39 |
st.session_state.win = {'X': 0, 'O': 0}
|
40 |
-
st.session_state.board = np.full((
|
41 |
st.session_state.player = 'X'
|
42 |
st.session_state.warning = False
|
43 |
st.session_state.winner = None
|
@@ -47,7 +47,7 @@ def check_available_moves(extra=False) -> list:
|
|
47 |
raw_moves = [row for col in st.session_state.board.tolist() for row in col]
|
48 |
num_moves = [i for i, spot in enumerate(raw_moves) if spot == '.']
|
49 |
if extra:
|
50 |
-
return [(i //
|
51 |
return num_moves
|
52 |
|
53 |
def check_rows(board):
|
|
|
37 |
if not post_init:
|
38 |
st.session_state.opponent = 'Human'
|
39 |
st.session_state.win = {'X': 0, 'O': 0}
|
40 |
+
st.session_state.board = np.full((3, 3), '.', dtype=str)
|
41 |
st.session_state.player = 'X'
|
42 |
st.session_state.warning = False
|
43 |
st.session_state.winner = None
|
|
|
47 |
raw_moves = [row for col in st.session_state.board.tolist() for row in col]
|
48 |
num_moves = [i for i, spot in enumerate(raw_moves) if spot == '.']
|
49 |
if extra:
|
50 |
+
return [(i // 3, i % 3) for i in num_moves]
|
51 |
return num_moves
|
52 |
|
53 |
def check_rows(board):
|