Spaces:
Build error
Build error
Delete app.py
Browse files
app.py
DELETED
|
@@ -1,53 +0,0 @@
|
|
| 1 |
-
import streamlit as st
|
| 2 |
-
import random
|
| 3 |
-
|
| 4 |
-
# Define the emojis for each class
|
| 5 |
-
engineering_emojis = ['🛠️', '🔧', '🔩', '🔨', '🚀']
|
| 6 |
-
magic_emojis = ['🧙', '🔮', '✨', '🌟', '🎩']
|
| 7 |
-
industry_emojis = ['🏭', '🚜', '🔨', '🏗️', '🚛']
|
| 8 |
-
|
| 9 |
-
# Define the function to roll the dice
|
| 10 |
-
def roll_dice():
|
| 11 |
-
return [random.choice(emojis) for i in range(20)]
|
| 12 |
-
|
| 13 |
-
# Define the function to check for three of a kind
|
| 14 |
-
def check_three_of_a_kind(dice):
|
| 15 |
-
for emoji in set(dice):
|
| 16 |
-
if dice.count(emoji) >= 3:
|
| 17 |
-
return True
|
| 18 |
-
return False
|
| 19 |
-
|
| 20 |
-
# Define the Streamlit app
|
| 21 |
-
def main():
|
| 22 |
-
st.title("Roll the Dice Game")
|
| 23 |
-
st.write("Select a class to roll for:")
|
| 24 |
-
class_selection = st.selectbox("", ["Engineering", "Magic", "Industry"])
|
| 25 |
-
|
| 26 |
-
if class_selection == "Engineering":
|
| 27 |
-
emojis = engineering_emojis
|
| 28 |
-
elif class_selection == "Magic":
|
| 29 |
-
emojis = magic_emojis
|
| 30 |
-
else:
|
| 31 |
-
emojis = industry_emojis
|
| 32 |
-
|
| 33 |
-
st.write("Selected class:", class_selection)
|
| 34 |
-
st.write("Click the button to roll the dice:")
|
| 35 |
-
|
| 36 |
-
rolls_left = 3
|
| 37 |
-
dice_rolled = False
|
| 38 |
-
while rolls_left > 0 and not dice_rolled:
|
| 39 |
-
if st.button("Roll the Dice"):
|
| 40 |
-
dice = roll_dice()
|
| 41 |
-
st.write("Dice:", " ".join(dice))
|
| 42 |
-
if check_three_of_a_kind(dice):
|
| 43 |
-
st.write("Congratulations! You rolled three of a kind!")
|
| 44 |
-
dice_rolled = True
|
| 45 |
-
else:
|
| 46 |
-
st.write("You did not roll three of a kind. Try again.")
|
| 47 |
-
rolls_left -= 1
|
| 48 |
-
|
| 49 |
-
if not dice_rolled:
|
| 50 |
-
st.write("Sorry, you did not roll three of a kind. Better luck next time.")
|
| 51 |
-
|
| 52 |
-
if __name__ == "__main__":
|
| 53 |
-
main()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|