awacke1 commited on
Commit
b745733
·
1 Parent(s): 0432453

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +33 -13
app.py CHANGED
@@ -63,23 +63,43 @@ 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
- for player in players:
68
- st.write(f"## {player}'s Play Area")
69
- player_data = pd.DataFrame({'Habitat Tiles': game_state['players'][player]['habitat'],
70
- 'Wildlife Tokens': game_state['players'][player]['wildlife']})
71
- st.dataframe(player_data)
 
 
 
 
 
 
 
 
 
 
 
 
72
 
73
- # Drafting Phase
74
- if st.button(f"{player}: Draw Habitat and Wildlife"):
75
- draw_habitat_and_wildlife(player, game_state)
76
- game_state = load_game_state() # Reload game state after update
 
77
 
78
- # Tile and Wildlife Placement (Placeholders for actual game logic)
79
- # ... (Add selectbox and logic for tile and wildlife placement)
 
 
 
 
 
 
 
 
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"):
 
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': [
75
+ f"{emoji} ({category})" for emoji, category in
76
+ game_state['players'][player]['wildlife']
77
+ ]
78
+ })
79
+ st.dataframe(player_data)
80
+
81
+ # Drafting Phase
82
+ if st.button(f"{player}: Draw Habitat and Wildlife"):
83
+ draw_habitat_and_wildlife(player, game_state)
84
+ game_state = load_game_state()
85
 
86
+ # Tile and Wildlife Placement
87
+ placement_options = ['Place Habitat', 'Place Wildlife', 'Skip']
88
+ placement_choice = st.selectbox(f"{player}: Choose an action", placement_options, key=f'placement_{player}')
89
+ if placement_choice != 'Skip':
90
+ st.write(f"{player} chose to {placement_choice}")
91
 
92
+ # Nature Tokens
93
+ nature_tokens = game_state['players'][player]['nature_tokens']
94
+ if st.button(f"{player}: Use a Nature Token ({nature_tokens} left)"):
95
+ if nature_tokens > 0:
96
+ # Logic to use a nature token
97
+ st.write(f"{player} used a Nature Token!")
98
+ game_state['players'][player]['nature_tokens'] -= 1
99
+ save_game_state(game_state)
100
+ else:
101
+ st.warning("No Nature Tokens left!")
102
 
 
 
103
 
104
  # Reset Button
105
  if st.button("Reset Game"):