awacke1 commited on
Commit
ac0345f
Β·
1 Parent(s): dccfd82

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +43 -48
app.py CHANGED
@@ -1,9 +1,10 @@
1
  import streamlit as st
2
  import streamlit.components.v1 as components
 
 
3
 
4
  # Function to generate HTML with textarea for speech synthesis
5
  def generate_speech_textarea(text_to_speak):
6
- #st.markdown(text_to_speak)
7
  documentHTML5 = '''
8
  <!DOCTYPE html>
9
  <html>
@@ -29,55 +30,49 @@ def generate_speech_textarea(text_to_speak):
29
  </html>
30
  '''
31
  components.html(documentHTML5, width=1280, height=500)
32
-
33
- # Game list and associated icons
34
- games = ['Terraforming Mars', 'Twilight Imperium (Fourth Edition)', 'Scythe', 'Eclipse', 'Small World', 'Risk Legacy', 'Axis & Allies', 'Diplomacy', 'Pandemic Legacy: Season 1', 'Brass: Birmingham']
35
- icons = ['πŸͺ', 'πŸš€', 'πŸ€–', '🌌', 'πŸ§β€β™‚οΈ', 'πŸ—ΊοΈ', 'βš”οΈ', '🀝', '🦠', '🏭']
36
 
37
- # Main code
38
- st.title('Top Ten Board Games with Map-Making Strategies πŸ—ΊοΈ')
39
-
40
- for i, (game, icon) in enumerate(zip(games, icons)):
41
- st.markdown(f"{i + 1}. {game} {icon}")
42
-
43
- # Expanders for each game to outline map rules or strategies
44
- with st.expander(f"See Map Building & Gamification Strategy for {game}"):
45
- text_to_speak = ""
 
46
 
47
- # ... Cut here for content change!
 
 
48
 
49
- if game == 'Terraforming Mars':
50
- text_to_speak = "πŸͺπŸ’‘ **Terraforming Mars** \n1️⃣ πŸŒ±πŸ’§ Opt for plant-heavy and water tiles \n2️⃣ πŸ­πŸŒ‹ Position factories near volcanic areas \n3️⃣ πŸŒπŸ’‘ Control key parameters and energy grid \n4️⃣ πŸ›€οΈπŸŒ‘οΈ Connect colonies and temperature control \n5️⃣ πŸš€πŸŽ― Upgrade spaceports and aim for synergies."
51
- st.markdown(text_to_speak)
52
- elif game == 'Twilight Imperium (Fourth Edition)':
53
- text_to_speak = "πŸš€πŸŒŒ **Twilight Imperium** \n1️⃣ πŸŒŒβš–οΈ Position fleets in strategic nebulas and balance resources \n2️⃣ πŸ°πŸ›‘οΈ Fortify chokepoints and use PDS systems \n3️⃣ πŸŒπŸŒ€ Effective trade routes and wormhole caution \n4️⃣ πŸŒŸπŸŒ• Prioritize Mecatol Rex and moon attacks \n5️⃣ πŸ› οΈπŸ€ Optimize unit upgrades and forge alliances."
54
- st.markdown(text_to_speak)
55
- elif game == 'Scythe':
56
- text_to_speak = "πŸ€–πŸžοΈ **Scythe** \n1️⃣ πŸžοΈπŸ› οΈ Choose starting positions and factory cards \n2️⃣ πŸ—ΊοΈπŸŒŠ Be aware of neighbors and control rivers \n3️⃣ πŸ­πŸ›‘οΈ Maximize resource buildings and backdoor defense \n4️⃣ 🎯🌾 Focus objectives and manage food \n5️⃣ πŸŽ²πŸ’Ž Play probabilities and hunt treasures."
57
- st.markdown(text_to_speak)
58
- elif game == 'Eclipse':
59
- text_to_speak = "🌌🌟 **Eclipse** \n1️⃣ 🌌🌟 Control sectors and central hexes \n2️⃣ πŸ›ΈπŸ›‘οΈ Build formidable fleets and defenses \n3️⃣ πŸ­πŸ”­ Prioritize production and research \n4️⃣ 🀝🌐 Trade and diplomacy \n5️⃣ πŸŒ€πŸš€ Wormhole travel and expansion speed."
60
- st.markdown(text_to_speak)
61
- elif game == 'Small World':
62
- text_to_speak = "πŸ§β€β™‚οΈπŸŒ **Small World** \n1️⃣ πŸ—ΊοΈπŸ‘‘ Choose realms and races wisely \n2️⃣ πŸŽ­πŸ›‘οΈ Exploit powers and defend territories \n3️⃣ πŸ†πŸ’Ž Collect victory coins and treasures \n4️⃣ πŸ€πŸŒ‹ Forge short alliances and occupy mountains \n5️⃣ πŸ”„πŸ° Know when to decline and occupy forts."
63
- st.markdown(text_to_speak)
64
- elif game == 'Risk Legacy':
65
- text_to_speak = "πŸ—ΊοΈβš”οΈ **Risk Legacy** \n1️⃣ πŸ—ΊοΈβš”οΈ Control continents and aggressive expansion \n2️⃣ πŸ›‘οΈπŸ” Fortify borders and use fortresses \n3️⃣ πŸ“œπŸš€ Complete missions and airfields \n4️⃣ πŸ†πŸ”₯ Collect victory points and scorched earth \n5️⃣ πŸ€πŸ”„ Alliances and betrayal."
66
- st.markdown(text_to_speak)
67
- elif game == 'Axis & Allies':
68
- text_to_speak = "βš”οΈπŸŒ **Axis & Allies** \n1️⃣ βš”οΈπŸŒ Strategic frontlines and global dominance \n2️⃣ πŸ­πŸ“ˆ Resource management and economy \n3️⃣ πŸ›‘οΈπŸš’ Naval blockades and fortress defenses \n4️⃣ πŸŽ–οΈπŸŽ― Focused objectives and key battles \n5️⃣ 🀝πŸ’₯ Alliances and surprise attacks."
69
- st.markdown(text_to_speak)
70
- elif game == 'Diplomacy':
71
- text_to_speak = "🀝🌍 **Diplomacy** \n1️⃣ πŸ€πŸ“œ Negotiation and written orders \n2️⃣ πŸ—ΊοΈπŸ›‘οΈ Strategic positioning and defenses \n3️⃣ πŸš’βš“ Naval forces and chokepoints \n4️⃣ 🏰🌐 Territory control and key regions \n5️⃣ πŸ”„πŸŽ­ Timing and deception."
72
- st.markdown(text_to_speak)
73
- elif game == 'Pandemic Legacy: Season 1':
74
- text_to_speak = "🦠🌍 **Pandemic Legacy** \n1️⃣ πŸ¦ πŸ”¬ Cure research and outbreak control \n2️⃣ 🌍🚁 Global movement and airlifts \n3️⃣ πŸ₯πŸ›‘οΈ Build research stations and quarantine \n4️⃣ πŸ“œπŸŽ― Complete objectives and bonus cards \n5️⃣ πŸ€πŸ”„ Teamwork and role synergy."
75
- st.markdown(text_to_speak)
76
- elif game == 'Brass: Birmingham':
77
- text_to_speak = "πŸ­πŸ›€οΈ **Brass Birmingham** \n1️⃣ πŸ­πŸ›€οΈ Industry and canal routes \n2️⃣ πŸ“ˆπŸΊ Economic management and beer supply \n3️⃣ πŸ› οΈπŸ—ΊοΈ Optimize developments and map control \n4️⃣ πŸ€πŸ’‘ Partnerships and market strategy \n5️⃣ πŸš‚πŸ† Railroads and victory points."
78
- st.markdown(text_to_speak)
79
 
80
- # ... Cut here for content change!
 
81
 
82
- if st.button(f"πŸ”Š Read {game}'s Strategies Aloud"):
83
- generate_speech_textarea(text_to_speak)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  import streamlit as st
2
  import streamlit.components.v1 as components
3
+ import geopandas as gpd
4
+ import matplotlib.pyplot as plt
5
 
6
  # Function to generate HTML with textarea for speech synthesis
7
  def generate_speech_textarea(text_to_speak):
 
8
  documentHTML5 = '''
9
  <!DOCTYPE html>
10
  <html>
 
30
  </html>
31
  '''
32
  components.html(documentHTML5, width=1280, height=500)
 
 
 
 
33
 
34
+ # Function to display the state outline
35
+ def plot_state_outline(state_code):
36
+ # Read U.S. geometries file
37
+ gdf = gpd.read_file(gpd.datasets.get_path('naturalearth_lowres'))
38
+ # Filter data for the given state
39
+ gdf_state = gdf[gdf['iso_a3'] == 'USA']
40
+ # Plot the geometry
41
+ ax = gdf_state.boundary.plot()
42
+ plt.title(f"{state_code} State Outline")
43
+ st.pyplot(plt)
44
 
45
+ # States list and associated icons
46
+ states = ['MN', 'CA', 'WA', 'FL', 'TX', 'NY', 'NV']
47
+ icons = ['πŸ¦†', '🌴', '🍎', '🌞', '🀠', 'πŸ—½', '🎰']
48
 
49
+ # Main code
50
+ st.title('U.S. States Trivia πŸ—ΊοΈ')
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
51
 
52
+ for i, (state, icon) in enumerate(zip(states, icons)):
53
+ st.markdown(f"{i + 1}. {state} {icon}")
54
 
55
+ # Expanders for each state to outline fascinating facts
56
+ with st.expander(f"See Fascinating Facts about {state}"):
57
+ text_to_speak = ""
58
+
59
+ if state == 'MN':
60
+ text_to_speak = "πŸ¦† **Minnesota** \n🏞️ Known as the 'Land of 10,000 Lakes' \n🎣 Famous for its fishing \nπŸ›Ά Boundary Waters offers incredible canoeing \nπŸŽ“ Home to prestigious colleges \n❄️ Cold winters but lovely summers."
61
+ elif state == 'CA':
62
+ text_to_speak = "🌴 **California** \nπŸŒ‰ Home to the Golden Gate Bridge \n🎬 Center of the American entertainment industry \nπŸ‡ Famous for Napa Valley's wine \n🌲 Home to Redwood National Park \nπŸ„β€β™€οΈ Excellent beaches and surf spots."
63
+ elif state == 'WA':
64
+ text_to_speak = "🍎 **Washington** \nβ˜• Known for its coffee culture \nπŸ—» Home to Mount Rainier \n🍏 Leading apple-producing state \n🐟 Rich in seafood, especially salmon \n🌧️ Known for its rainy weather."
65
+ elif state == 'FL':
66
+ text_to_speak = "🌞 **Florida** \n🏝️ Famous for its beaches \n🎒 Home to various amusement parks like Disney World \nπŸš€ Space launches from Cape Canaveral \n🐊 Known for the Everglades and alligators \n🍊 Major orange producer."
67
+ elif state == 'TX':
68
+ text_to_speak = "🀠 **Texas** \nπŸ›’οΈ Known for its oil and gas industry \nπŸ– Famous for its barbecue \n🎸 Rich musical heritage \nπŸ„ Home to many cattle ranches \n🌡 Includes part of the Chihuahuan Desert."
69
+ elif state == 'NY':
70
+ text_to_speak = "πŸ—½ **New York** \nπŸ™οΈ Home to New York City, the largest city in the U.S. \n🍎 Known as the Big Apple \n🎭 Major hub for arts and culture \n🏞️ Adirondack Mountains offer outdoor adventures \nπŸ• Famous for its style of pizza."
71
+ elif state == 'NV':
72
+ text_to_speak = "🎰 **Nevada** \nπŸŒ† Known for Las Vegas and its casinos \n🏜️ Includes part of the Mojave Desert \nπŸŽͺ Entertainment is a major industry \nπŸ’Ž Known for the Hoover Dam \nπŸ‘½ Area 51 is located here."
73
+
74
+ st.markdown(text_to_speak)
75
+ plot_state_outline(state)
76
+
77
+ if st.button(f"πŸ”Š Read {state}'s Facts Aloud"):
78
+ generate_speech_textarea(text_to_speak)