CharacterZoo / app.py
awacke1's picture
Create app.py
242ce09
import streamlit as st
# Define all the characters and their skills
characters = {
"🦁": {"name": "Lion the Crying Zion", "skill": "Distracts and intimidates opponents"},
"🦊": {"name": "Fox the Box of mocks", "skill": "Steals an item from an opponent"},
"πŸ¦„": {"name": "Unicorn the Mystic Foreman", "skill": "Charms opponents into doing what Unicorn wants"},
"🐯": {"name": "Tiger the Sassy Swiper", "skill": "Attacks opponents with a surprise jump"},
"🐺": {"name": "Wolf the Howlin’ Aloof", "skill": "Finds hidden items or people"},
"🐍": {"name": "Snake the Sneak Freak", "skill": "Blends in with surroundings and become invisible"},
"🐘": {"name": "Elephant the Trunk Slammer", "skill": "Stampedes and knocks opponents over"},
"🦜": {"name": "Parrot the Chat Squawk", "skill": "Imitates sounds to distract or confuse opponents"}
}
# Define all the classifications and their associated skills
classifications = {
"Attacker": ["Roar", "Pounce", "Charge"],
"Thief": ["Steal", "Camouflage"],
"Supporter": ["Enchant", "Mimic"],
"Tracker": ["Track"],
"Defender": ["Charge", "Camouflage"],
"Versatile": ["Roar", "Steal", "Enchant", "Pounce", "Camouflage", "Mimic"]
}
# Define three teams of additional animals to the zoo with their rhyming names
team_1 = {
"πŸ¦†": {"name": "Duck the Buck", "skill": "Hits opponents below the belt"},
"πŸ‡": {"name": "Rabbit the Habit", "skill": "Dodges enemy attacks with ease"},
"πŸ¦‘": {"name": "Squid the Kid", "skill": "Sprays ink to obscure opponents' vision"}
}
team_2 = {
"🦜": {"name": "Parakeet the Sweet Tweet", "skill": "Puts opponents to sleep with a lullaby"},
"πŸ¦‰": {"name": "Owl the Foul Howl", "skill": "Sends enemies into a frenzy with a piercing screech"},
"πŸ¦”": {"name": "Hedgehog the Sledge Blog", "skill": "Rolls into a ball to knock over opponents"}
}
team_3 = {
"🐍": {"name": "Viper the Diaper Wiper", "skill": "Leaves opponents in a state of confusion"},
"πŸ¦“": {"name": "Zebra the High Hebra", "skill": "Lifts spirits and boosts morale"},
"πŸ¦‡": {"name": "Bat the Cat Rats", "skill": "Echolocates to locate hidden enemies and objects"}
}
# Define a function to generate random dice rolls
@st.cache
def roll_dice(num_dice):
dice_rolls = ""
for i in range(num_dice):
dice_rolls += chr(0x267f + int(st.session_state[f"dice_{i+1}"])) + " "
return dice_rolls
# Define the streamlit app
def app():
st.title("Fantasy Zoo Emoji Card Game")
st.write("Welcome to the Fantasy Zoo, where the animals are all emojis and they're ready to play with you! Each emoji has a unique skill that makes them an excellent addition to your team. Here are their names and a brief description:")
# Display each character
for emoji, character in characters.items():
st.write(f"- {emoji} {character['name']} – {character['skill']}")
st.write("")
st.write("Let's roll the dice and see who wins! 🎲🎲🎲")
# Create a dice roller for dice rolling emoji lists
num_dice = 3
for i in range(num_dice):
st.session_state[f"dice_{i+1}"] = st.slider(f"Select a value for dice {i+1}", 1, 6)
roll_button = st.button("Roll the dice!")
if roll_button:
st.write("Your dice rolls are:")
st.write(roll_dice(num_dice))
st.write("")
st.write("Now let's add some new animals to the mix. Here are their names and skills:")
# Display each team of additional animals
st.write("Team 1:")
for emoji, animal in team_1.items():
st.write(f"- {emoji} {animal['name']} – {animal['skill']}")
st.write("Team 2:")
for emoji, animal in team_2.items():
st.write(f"- {emoji} {animal['name']} – {animal['skill']}")
st.write("Team 3:")
for emoji, animal in team_3.items():
st.write(f"- {emoji} {animal['name']} – {animal['skill']}")
st.write("")
st.write("Finally, let's take a look at the classifications and skills:")
# Display the classifications and their associated skills in a markdown table
classification_table = "| Role | Skills |\n|------|--------|\n"
for classification, skills in classifications.items():
classification_table += f"| {classification} | "
for i, skill in enumerate(skills):
classification_table += f"{skill}"
if i < len(skills) - 1:
classification_table += ", "
classification_table += " |\n"
st.markdown(classification_table)