Spaces:
Runtime error
Runtime error
Create app.py
Browse files
app.py
ADDED
@@ -0,0 +1,105 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import streamlit as st
|
2 |
+
|
3 |
+
# Define all the characters and their skills
|
4 |
+
characters = {
|
5 |
+
"π¦": {"name": "Lion the Crying Zion", "skill": "Distracts and intimidates opponents"},
|
6 |
+
"π¦": {"name": "Fox the Box of mocks", "skill": "Steals an item from an opponent"},
|
7 |
+
"π¦": {"name": "Unicorn the Mystic Foreman", "skill": "Charms opponents into doing what Unicorn wants"},
|
8 |
+
"π―": {"name": "Tiger the Sassy Swiper", "skill": "Attacks opponents with a surprise jump"},
|
9 |
+
"πΊ": {"name": "Wolf the Howlinβ Aloof", "skill": "Finds hidden items or people"},
|
10 |
+
"π": {"name": "Snake the Sneak Freak", "skill": "Blends in with surroundings and become invisible"},
|
11 |
+
"π": {"name": "Elephant the Trunk Slammer", "skill": "Stampedes and knocks opponents over"},
|
12 |
+
"π¦": {"name": "Parrot the Chat Squawk", "skill": "Imitates sounds to distract or confuse opponents"}
|
13 |
+
}
|
14 |
+
|
15 |
+
# Define all the classifications and their associated skills
|
16 |
+
classifications = {
|
17 |
+
"Attacker": ["Roar", "Pounce", "Charge"],
|
18 |
+
"Thief": ["Steal", "Camouflage"],
|
19 |
+
"Supporter": ["Enchant", "Mimic"],
|
20 |
+
"Tracker": ["Track"],
|
21 |
+
"Defender": ["Charge", "Camouflage"],
|
22 |
+
"Versatile": ["Roar", "Steal", "Enchant", "Pounce", "Camouflage", "Mimic"]
|
23 |
+
}
|
24 |
+
|
25 |
+
# Define three teams of additional animals to the zoo with their rhyming names
|
26 |
+
team_1 = {
|
27 |
+
"π¦": {"name": "Duck the Buck", "skill": "Hits opponents below the belt"},
|
28 |
+
"π": {"name": "Rabbit the Habit", "skill": "Dodges enemy attacks with ease"},
|
29 |
+
"π¦": {"name": "Squid the Kid", "skill": "Sprays ink to obscure opponents' vision"}
|
30 |
+
}
|
31 |
+
|
32 |
+
team_2 = {
|
33 |
+
"π¦": {"name": "Parakeet the Sweet Tweet", "skill": "Puts opponents to sleep with a lullaby"},
|
34 |
+
"π¦": {"name": "Owl the Foul Howl", "skill": "Sends enemies into a frenzy with a piercing screech"},
|
35 |
+
"π¦": {"name": "Hedgehog the Sledge Blog", "skill": "Rolls into a ball to knock over opponents"}
|
36 |
+
}
|
37 |
+
|
38 |
+
team_3 = {
|
39 |
+
"π": {"name": "Viper the Diaper Wiper", "skill": "Leaves opponents in a state of confusion"},
|
40 |
+
"π¦": {"name": "Zebra the High Hebra", "skill": "Lifts spirits and boosts morale"},
|
41 |
+
"π¦": {"name": "Bat the Cat Rats", "skill": "Echolocates to locate hidden enemies and objects"}
|
42 |
+
}
|
43 |
+
|
44 |
+
# Define a function to generate random dice rolls
|
45 |
+
@st.cache
|
46 |
+
def roll_dice(num_dice):
|
47 |
+
dice_rolls = ""
|
48 |
+
for i in range(num_dice):
|
49 |
+
dice_rolls += chr(0x267f + int(st.session_state[f"dice_{i+1}"])) + " "
|
50 |
+
return dice_rolls
|
51 |
+
|
52 |
+
# Define the streamlit app
|
53 |
+
def app():
|
54 |
+
st.title("Fantasy Zoo Emoji Card Game")
|
55 |
+
|
56 |
+
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:")
|
57 |
+
|
58 |
+
# Display each character
|
59 |
+
for emoji, character in characters.items():
|
60 |
+
st.write(f"- {emoji} {character['name']} β {character['skill']}")
|
61 |
+
|
62 |
+
st.write("")
|
63 |
+
|
64 |
+
st.write("Let's roll the dice and see who wins! π²π²π²")
|
65 |
+
|
66 |
+
# Create a dice roller for dice rolling emoji lists
|
67 |
+
num_dice = 3
|
68 |
+
for i in range(num_dice):
|
69 |
+
st.session_state[f"dice_{i+1}"] = st.slider(f"Select a value for dice {i+1}", 1, 6)
|
70 |
+
roll_button = st.button("Roll the dice!")
|
71 |
+
if roll_button:
|
72 |
+
st.write("Your dice rolls are:")
|
73 |
+
st.write(roll_dice(num_dice))
|
74 |
+
|
75 |
+
st.write("")
|
76 |
+
|
77 |
+
st.write("Now let's add some new animals to the mix. Here are their names and skills:")
|
78 |
+
|
79 |
+
# Display each team of additional animals
|
80 |
+
st.write("Team 1:")
|
81 |
+
for emoji, animal in team_1.items():
|
82 |
+
st.write(f"- {emoji} {animal['name']} β {animal['skill']}")
|
83 |
+
|
84 |
+
st.write("Team 2:")
|
85 |
+
for emoji, animal in team_2.items():
|
86 |
+
st.write(f"- {emoji} {animal['name']} β {animal['skill']}")
|
87 |
+
|
88 |
+
st.write("Team 3:")
|
89 |
+
for emoji, animal in team_3.items():
|
90 |
+
st.write(f"- {emoji} {animal['name']} β {animal['skill']}")
|
91 |
+
|
92 |
+
st.write("")
|
93 |
+
|
94 |
+
st.write("Finally, let's take a look at the classifications and skills:")
|
95 |
+
|
96 |
+
# Display the classifications and their associated skills in a markdown table
|
97 |
+
classification_table = "| Role | Skills |\n|------|--------|\n"
|
98 |
+
for classification, skills in classifications.items():
|
99 |
+
classification_table += f"| {classification} | "
|
100 |
+
for i, skill in enumerate(skills):
|
101 |
+
classification_table += f"{skill}"
|
102 |
+
if i < len(skills) - 1:
|
103 |
+
classification_table += ", "
|
104 |
+
classification_table += " |\n"
|
105 |
+
st.markdown(classification_table)
|