awacke1 commited on
Commit
101edd4
Β·
1 Parent(s): ebd82cd

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +40 -16
app.py CHANGED
@@ -3,9 +3,13 @@ import random
3
  import pandas as pd
4
  import os
5
 
6
- # Cascadia Game Components
7
- habitat_tiles = ['🌲', '🏞️', '🌊', '🌡', 'πŸŒ„']
8
- wildlife_tokens = ['🐻', 'πŸ¦…', '🐟', '🦌', '🐿️']
 
 
 
 
9
  players = ['Player 1', 'Player 2']
10
  save_file = 'cascadia_game_state.csv'
11
 
@@ -63,23 +67,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"):
 
3
  import pandas as pd
4
  import os
5
 
6
+ # Game Components
7
+ habitat_tiles = ['🌲', '🏞️', '🌊', '🌡', 'πŸŒ„', 'πŸ‚', 'πŸŒ…', 'πŸ”οΈ']
8
+ wildlife_tokens = [
9
+ ('🐻', 'Mammal'), ('πŸ¦…', 'Bird'), ('🐟', 'Fish'),
10
+ ('🦌', 'Mammal'), ('🐿️', 'Mammal'), ('πŸ¦†', 'Bird'),
11
+ ('πŸ¦‹', 'Insect'), ('🐒', 'Reptile')
12
+ ]
13
  players = ['Player 1', 'Player 2']
14
  save_file = 'cascadia_game_state.csv'
15
 
 
67
  game_state['players'][player]['wildlife'].append(wildlife)
68
  save_game_state(game_state)
69
 
70
+
71
+ col1, col2 = st.columns(2)
72
+
73
  # Display players' areas and handle actions
74
+ for index, player in enumerate(players):
75
+ with (col1 if index == 0 else col2):
76
+ st.write(f"## {player}'s Play Area")
77
+ player_data = pd.DataFrame({
78
+ 'Habitat Tiles': game_state['players'][player]['habitat'],
79
+ 'Wildlife Tokens': [
80
+ f"{emoji} ({category})" for emoji, category in
81
+ game_state['players'][player]['wildlife']
82
+ ]
83
+ })
84
+ st.dataframe(player_data)
85
 
86
+ # Drafting Phase
87
+ if st.button(f"{player}: Draw Habitat and Wildlife"):
88
+ draw_habitat_and_wildlife(player, game_state)
89
+ game_state = load_game_state()
90
 
91
+ # Tile and Wildlife Placement
92
+ placement_options = ['Place Habitat', 'Place Wildlife', 'Skip']
93
+ placement_choice = st.selectbox(f"{player}: Choose an action", placement_options, key=f'placement_{player}')
94
+ if placement_choice != 'Skip':
95
+ st.write(f"{player} chose to {placement_choice}")
96
 
97
+ # Nature Tokens
98
+ nature_tokens = game_state['players'][player]['nature_tokens']
99
+ if st.button(f"{player}: Use a Nature Token ({nature_tokens} left)"):
100
+ if nature_tokens > 0:
101
+ # Logic to use a nature token
102
+ st.write(f"{player} used a Nature Token!")
103
+ game_state['players'][player]['nature_tokens'] -= 1
104
+ save_game_state(game_state)
105
+ else:
106
+ st.warning("No Nature Tokens left!")
107
 
108
  # Reset Button
109
  if st.button("Reset Game"):