awacke1's picture
Update backupapp.py
1fd0d56
import streamlit as st
import streamlit.components.v1 as components
# Function to generate HTML with textarea for speech synthesis
def generate_speech_textarea(text_to_speak):
documentHTML5 = '''
<!DOCTYPE html>
<html>
<head>
<title>Read It Aloud</title>
<script type="text/javascript">
function readAloud() {{
const text = document.getElementById("textArea").value;
const speech = new SpeechSynthesisUtterance(text);
window.speechSynthesis.speak(speech);
}}
</script>
</head>
<body>
<h1>πŸ”Š Read It Aloud</h1>
<textarea id="textArea" rows="10" cols="80" readonly>'''
documentHTML5 = documentHTML5 + text_to_speak
documentHTML5 = documentHTML5 + '''
</textarea>
<br>
<button onclick="readAloud()">πŸ”Š Read Aloud</button>
</body>
</html>
'''
components.html(documentHTML5, width=1280, height=1024)
# Game list and associated icons
games = ['Terraforming Mars', 'Twilight Imperium (Fourth Edition)', 'Scythe', 'Eclipse', 'Small World', 'Risk Legacy', 'Axis & Allies', 'Diplomacy', 'Pandemic Legacy: Season 1', 'Brass: Birmingham']
icons = ['πŸͺ', 'πŸš€', 'πŸ€–', '🌌', 'πŸ§β€β™‚οΈ', 'πŸ—ΊοΈ', 'βš”οΈ', '🀝', '🦠', '🏭']
# Main code
st.title('Top Ten Board Games with Map-Making Strategies πŸ—ΊοΈ')
for i, (game, icon) in enumerate(zip(games, icons)):
st.markdown(f"{i + 1}. {game} {icon}")
# Expanders for each game to outline map rules or strategies
with st.expander(f"See Map Building & Gamification Strategy for {game}"):
text_to_speak = ""
# ... Cut here for content change!
if game == 'Terraforming Mars':
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."
st.markdown(text_to_speak)
elif game == 'Twilight Imperium (Fourth Edition)':
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."
st.markdown(text_to_speak)
elif game == 'Scythe':
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."
st.markdown(text_to_speak)
elif game == 'Eclipse':
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."
st.markdown(text_to_speak)
elif game == 'Small World':
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."
st.markdown(text_to_speak)
elif game == 'Risk Legacy':
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."
st.markdown(text_to_speak)
elif game == 'Axis & Allies':
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."
st.markdown(text_to_speak)
elif game == 'Diplomacy':
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."
st.markdown(text_to_speak)
elif game == 'Pandemic Legacy: Season 1':
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."
st.markdown(text_to_speak)
elif game == 'Brass: Birmingham':
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."
st.markdown(text_to_speak)
# ... Cut here for content change!
if st.button(f"πŸ”Š Read {game}'s Strategies Aloud"):
st.markdown(text_to_speak)
generate_speech_textarea(text_to_speak)