Spaces:
Runtime error
Runtime error
Update backup4.app.py
Browse files- backup4.app.py +31 -14
backup4.app.py
CHANGED
|
@@ -63,23 +63,40 @@ def draw_habitat_and_wildlife(player, game_state):
|
|
| 63 |
game_state['players'][player]['wildlife'].append(wildlife)
|
| 64 |
save_game_state(game_state)
|
| 65 |
|
|
|
|
| 66 |
# Display players' areas and handle actions
|
| 67 |
-
|
| 68 |
-
|
| 69 |
-
|
| 70 |
-
|
| 71 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 72 |
|
| 73 |
-
|
| 74 |
-
|
| 75 |
-
|
| 76 |
-
|
|
|
|
| 77 |
|
| 78 |
-
|
| 79 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 80 |
|
| 81 |
-
# Nature Tokens (Placeholder for actual game logic)
|
| 82 |
-
# ... (Add button and logic for using nature tokens)
|
| 83 |
|
| 84 |
# Reset Button
|
| 85 |
if st.button("Reset Game"):
|
|
@@ -94,4 +111,4 @@ if st.button("Reset Game"):
|
|
| 94 |
|
| 95 |
# Game Controls and Instructions
|
| 96 |
st.write("## Game Controls")
|
| 97 |
-
st.write("Use the buttons and select boxes to play the game!")
|
|
|
|
| 63 |
game_state['players'][player]['wildlife'].append(wildlife)
|
| 64 |
save_game_state(game_state)
|
| 65 |
|
| 66 |
+
|
| 67 |
# Display players' areas and handle actions
|
| 68 |
+
col1, col2 = st.columns(2)
|
| 69 |
+
for index, player in enumerate(players):
|
| 70 |
+
with (col1 if index == 0 else col2):
|
| 71 |
+
st.write(f"## {player}'s Play Area")
|
| 72 |
+
player_data = pd.DataFrame({
|
| 73 |
+
'Habitat Tiles': game_state['players'][player]['habitat'],
|
| 74 |
+
'Wildlife Tokens': game_state['players'][player]['wildlife']
|
| 75 |
+
})
|
| 76 |
+
st.dataframe(player_data)
|
| 77 |
+
|
| 78 |
+
# Drafting Phase
|
| 79 |
+
if st.button(f"{player}: Draw Habitat and Wildlife"):
|
| 80 |
+
draw_habitat_and_wildlife(player, game_state)
|
| 81 |
+
game_state = load_game_state()
|
| 82 |
|
| 83 |
+
# Tile and Wildlife Placement
|
| 84 |
+
placement_options = ['Place Habitat', 'Place Wildlife', 'Skip']
|
| 85 |
+
placement_choice = st.selectbox(f"{player}: Choose an action", placement_options, key=f'placement_{player}')
|
| 86 |
+
if placement_choice != 'Skip':
|
| 87 |
+
st.write(f"{player} chose to {placement_choice}")
|
| 88 |
|
| 89 |
+
# Nature Tokens
|
| 90 |
+
nature_tokens = game_state['players'][player]['nature_tokens']
|
| 91 |
+
if st.button(f"{player}: Use a Nature Token ({nature_tokens} left)"):
|
| 92 |
+
if nature_tokens > 0:
|
| 93 |
+
# Logic to use a nature token
|
| 94 |
+
st.write(f"{player} used a Nature Token!")
|
| 95 |
+
game_state['players'][player]['nature_tokens'] -= 1
|
| 96 |
+
save_game_state(game_state)
|
| 97 |
+
else:
|
| 98 |
+
st.warning("No Nature Tokens left!")
|
| 99 |
|
|
|
|
|
|
|
| 100 |
|
| 101 |
# Reset Button
|
| 102 |
if st.button("Reset Game"):
|
|
|
|
| 111 |
|
| 112 |
# Game Controls and Instructions
|
| 113 |
st.write("## Game Controls")
|
| 114 |
+
st.write("Use the buttons and select boxes to play the game!")
|