awacke1 commited on
Commit
b2c222d
β€’
1 Parent(s): 814d3fc

Update backupapp.py

Browse files
Files changed (1) hide show
  1. backupapp.py +67 -52
backupapp.py CHANGED
@@ -1,19 +1,33 @@
1
  import streamlit as st
2
 
3
- # Game list and associated icons
4
- games = [
5
- 'Terraforming Mars',
6
- 'Twilight Imperium (Fourth Edition)',
7
- 'Scythe',
8
- 'Eclipse',
9
- 'Small World',
10
- 'Risk Legacy',
11
- 'Axis & Allies',
12
- 'Diplomacy',
13
- 'Pandemic Legacy: Season 1',
14
- 'Brass: Birmingham'
15
- ]
 
 
 
 
 
 
 
 
 
 
 
 
16
 
 
 
17
  icons = ['πŸͺ', 'πŸš€', 'πŸ€–', '🌌', 'πŸ§β€β™‚οΈ', 'πŸ—ΊοΈ', 'βš”οΈ', '🀝', '🦠', '🏭']
18
 
19
  # Main code
@@ -24,48 +38,49 @@ for i, (game, icon) in enumerate(zip(games, icons)):
24
 
25
  # Expanders for each game to outline map rules or strategies
26
  with st.expander(f"See Map Building & Gamification Strategy for {game}"):
 
 
27
 
28
  if game == 'Terraforming Mars':
29
- st.markdown("""
30
- πŸͺ **Terraforming Mars Map Strategies**
31
- 1. 🌱 Opt for plant-heavy areas
32
- 2. πŸ’§ Prioritize water tiles
33
- 3. 🏭 Position factories near energy resources
34
- 4. πŸŒ‹ Leverage volcanic areas
35
- 5. 🌐 Control key global parameters
36
- 6. πŸ’‘ Plan your energy grid
37
- 7. πŸ›€οΈ Connect your colonies
38
- 8. 🌑️ Master temperature control
39
- 9. 🎯 Aim for synergies
40
- 10. πŸš€ Upgrade spaceports for max mobility
41
- """)
42
 
43
  elif game == 'Twilight Imperium (Fourth Edition)':
44
- st.markdown("""
45
- πŸš€ **Twilight Imperium Map Strategies**
46
- 1. 🌌 Position fleets in strategic nebulas
47
- 2. 🏰 Fortify chokepoints
48
- 3. βš–οΈ Balance resources among systems
49
- 4. 🌐 Establish effective trade routes
50
- 5. πŸ›‘οΈ Use PDS systems wisely
51
- 6. πŸŒ€ Be cautious around wormholes
52
- 7. 🌟 Prioritize Mecatol Rex
53
- 8. πŸŒ• Use moons for surprise attacks
54
- 9. πŸ› οΈ Optimize unit upgrades
55
- 10. 🀝 Forge strategic alliances
56
- """)
57
 
58
  elif game == 'Scythe':
59
- st.markdown("""
60
- πŸ€– **Scythe Map Strategies**
61
- 1. 🏞️ Choose starting positions wisely
62
- 2. πŸ› οΈ Optimize for factory cards
63
- 3. πŸ—ΊοΈ Be aware of your neighbors
64
- 4. 🌊 Control rivers for mobility
65
- 5. 🏭 Maximize resource buildings
66
- 6. πŸ›‘οΈ Guard against backdoor attacks
67
- 7. 🎯 Focus on objectives
68
- 8. 🌾 Manage food resources
69
- 9. 🎲 Play the probabilities
70
- 10. πŸ’Ž Hunt for treasures
71
- """)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  import streamlit as st
2
 
3
+ # Function to generate HTML with textarea
4
+ def generate_html_with_textarea(text_to_speak):
5
+ return f'''
6
+ <!DOCTYPE html>
7
+ <html>
8
+ <head>
9
+ <title>Read It Aloud</title>
10
+ <script type="text/javascript">
11
+ function readAloud() {{
12
+ const text = document.getElementById("textArea").value;
13
+ const speech = new SpeechSynthesisUtterance(text);
14
+ window.speechSynthesis.speak(speech);
15
+ }}
16
+ </script>
17
+ </head>
18
+ <body>
19
+ <h1>πŸ”Š Read It Aloud</h1>
20
+ <textarea id="textArea" rows="10" cols="80">
21
+ {text_to_speak}
22
+ </textarea>
23
+ <br>
24
+ <button onclick="readAloud()">πŸ”Š Read Aloud</button>
25
+ </body>
26
+ </html>
27
+ '''
28
 
29
+ # Game list and associated icons
30
+ games = ['Terraforming Mars', 'Twilight Imperium (Fourth Edition)', 'Scythe', 'Eclipse', 'Small World', 'Risk Legacy', 'Axis & Allies', 'Diplomacy', 'Pandemic Legacy: Season 1', 'Brass: Birmingham']
31
  icons = ['πŸͺ', 'πŸš€', 'πŸ€–', '🌌', 'πŸ§β€β™‚οΈ', 'πŸ—ΊοΈ', 'βš”οΈ', '🀝', '🦠', '🏭']
32
 
33
  # Main code
 
38
 
39
  # Expanders for each game to outline map rules or strategies
40
  with st.expander(f"See Map Building & Gamification Strategy for {game}"):
41
+ # Defining text for each game's map strategy to use as a variable
42
+ text_to_speak = ""
43
 
44
  if game == 'Terraforming Mars':
45
+ 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."
46
+ st.markdown(text_to_speak)
 
 
 
 
 
 
 
 
 
 
 
47
 
48
  elif game == 'Twilight Imperium (Fourth Edition)':
49
+ 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."
50
+ st.markdown(text_to_speak)
 
 
 
 
 
 
 
 
 
 
 
51
 
52
  elif game == 'Scythe':
53
+ 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."
54
+ st.markdown(text_to_speak)
55
+
56
+ elif game == 'Eclipse':
57
+ 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."
58
+ st.markdown(text_to_speak)
59
+
60
+ elif game == 'Small World':
61
+ 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."
62
+ st.markdown(text_to_speak)
63
+
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
+
68
+ elif game == 'Axis & Allies':
69
+ 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."
70
+ st.markdown(text_to_speak)
71
+
72
+ elif game == 'Diplomacy':
73
+ 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."
74
+ st.markdown(text_to_speak)
75
+
76
+ elif game == 'Pandemic Legacy: Season 1':
77
+ 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."
78
+ st.markdown(text_to_speak)
79
+
80
+ elif game == 'Brass: Birmingham':
81
+ 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."
82
+ st.markdown(text_to_speak)
83
+
84
+ # Button to read the strategies aloud
85
+ if st.button(f"πŸ”Š Read {game}'s Strategies Aloud"):
86
+ st.markdown(generate_html_with_textarea(text_to_speak), unsafe_allow_html=True)