Spaces:
Runtime error
Runtime error
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 | |
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) |