awacke1 commited on
Commit
39bd597
ยท
1 Parent(s): 88bab31

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +33 -0
app.py CHANGED
@@ -68,6 +68,39 @@ def update_dice_roll_history(dice_type, rolls):
68
 
69
  return bonus_match
70
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
71
  st.write("""
72
 
73
  ๐Ÿž Bread, ๐Ÿฅ Croissant, ๐Ÿฅ– Baguette Bread, ๐Ÿซ“ Flatbread, ๐Ÿฅจ Pretzel, ๐Ÿฅฏ Bagel, ๐Ÿฅž Pancakes, ๐Ÿง‡ Waffle, ๐Ÿง€ Cheese Wedge, ๐Ÿ– Meat on Bone, ๐Ÿ— Poultry Leg, ๐Ÿฅฉ Cut of Meat, ๐Ÿฅ“ Bacon, ๐Ÿ” Hamburger, ๐ŸŸ French Fries, ๐Ÿ• Pizza, ๐ŸŒญ Hot Dog, ๐Ÿฅช Sandwich, ๐ŸŒฎ Taco, ๐ŸŒฏ Burrito, ๐Ÿซ” Tamale, ๐Ÿฅ™ Stuffed Flatbread, ๐Ÿง† Falafel, ๐Ÿฅš Egg, ๐Ÿณ Cooking, ๐Ÿฅ˜ Shallow Pan of Food, ๐Ÿฒ Pot of Food, ๐Ÿซ• Fondue, ๐Ÿฅฃ Bowl with Spoon, ๐Ÿฅ— Green Salad, ๐Ÿฟ Popcorn, ๐Ÿงˆ Butter, ๐Ÿง‚ Salt, ๐Ÿฅซ Canned Food, ๐Ÿฑ Bento Box, ๐Ÿ˜ Rice Cracker, ๐Ÿ™ Rice Ball, ๐Ÿš Cooked Rice, ๐Ÿ› Curry Rice, ๐Ÿœ Steaming Bowl, ๐Ÿ Spaghetti, ๐Ÿ  Roasted Sweet Potato, ๐Ÿข Oden, ๐Ÿฃ Sushi, ๐Ÿค Fried Shrimp, ๐Ÿฅ Fish Cake with Swirl, ๐Ÿฅฎ Moon Cake, ๐Ÿก Dango, ๐ŸฅŸ Dumpling, ๐Ÿฅ  Fortune Cookie, ๐Ÿฅก Takeout Box, ๐Ÿฆช Oyster, ๐Ÿฆ Soft Ice Cream, ๐Ÿง Shaved Ice, ๐Ÿจ Ice Cream, ๐Ÿฉ Doughnut, ๐Ÿช Cookie, ๐ŸŽ‚ Birthday Cake, ๐Ÿฐ Shortcake, ๐Ÿง Cupcake, ๐Ÿฅง Pie, ๐Ÿซ Chocolate Bar, ๐Ÿฌ Candy, ๐Ÿญ Lollipop, ๐Ÿฎ Custard, ๐Ÿฏ Honey Pot, ๐Ÿผ Baby Bottle, ๐Ÿฅ› Glass of Milk, โ˜• Hot Beverage, ๐Ÿซ– Teapot, ๐Ÿต Teacup Without Handle, ๐Ÿถ Sake, ๐Ÿพ Bottle with Popping Cork, ๐Ÿท Wine Glass, ๐Ÿธ Cocktail Glass, ๐Ÿน Tropical Drink, ๐Ÿบ Beer Mug, ๐Ÿป Clinking Beer Mugs, ๐Ÿฅ‚ Clinking Glasses, ๐Ÿฅƒ Tumbler Glass, ๐Ÿซ— Pouring Liquid, ๐Ÿฅค Cup with Straw, ๐Ÿง‹ Bubble Tea, ๐Ÿงƒ Beverage Box, ๐Ÿง‰ Mate, ๐ŸงŠ Ice, ๐Ÿฅข Chopsticks, ๐Ÿฝ๏ธ Fork and Knife with Plate, ๐Ÿด Fork and Knife, ๐Ÿฅ„ Spoon, ๐Ÿซ™ Jar")
 
68
 
69
  return bonus_match
70
 
71
+ def display_dice_roll_results():
72
+ download_history = st.checkbox('๐Ÿ“ฅ Download Roll History', value=False)
73
+
74
+ if download_history:
75
+ csv_filename = f'dice_roll_history_{st.session_state.username}.csv'
76
+ st.markdown(f'๐Ÿ“ฅ [Download roll history]({csv_filename})')
77
+ dice_roll_history = st.session_state.dice_roll_history[['Roll', 'Count', 'DiceNumberOfSides']]
78
+ if st.checkbox('๐ŸŽ‰ Show Bonus Matches', value=True):
79
+ dice_roll_history = dice_roll_history.join(
80
+ st.session_state.dice_roll_history[['BonusMatchToDiceName', 'BonusMatchToDiceEmoji']])
81
+ if st.checkbox('๐Ÿ‘ค Show Username', value=True):
82
+ dice_roll_history['Username'] = st.session_state.dice_roll_history['Username']
83
+ dice_roll_history.to_csv(csv_filename, index=False)
84
+
85
+ dice_roll_history_files = [f for f in os.listdir() if f.startswith('dice_roll_history_') and f.endswith('.csv')]
86
+ if len(dice_roll_history_files) > 0:
87
+ st.write('๐Ÿ“š Roll History Files:')
88
+ for history_file in dice_roll_history_files:
89
+ st.markdown(f'[Download {history_file}]({history_file})')
90
+
91
+ st.sidebar.title('๐Ÿ”ง Settings')
92
+ username_input()
93
+
94
+ if st.button('๐ŸŽฒ Roll Dice'):
95
+ dice_type, rolls = display_dice_roll_distribution()
96
+ display_bonus_match(update_dice_roll_history(dice_type, rolls), dice_type['name'], dice_type['emoji'])
97
+
98
+ display_dice_roll_results()
99
+
100
+
101
+
102
+
103
+
104
  st.write("""
105
 
106
  ๐Ÿž Bread, ๐Ÿฅ Croissant, ๐Ÿฅ– Baguette Bread, ๐Ÿซ“ Flatbread, ๐Ÿฅจ Pretzel, ๐Ÿฅฏ Bagel, ๐Ÿฅž Pancakes, ๐Ÿง‡ Waffle, ๐Ÿง€ Cheese Wedge, ๐Ÿ– Meat on Bone, ๐Ÿ— Poultry Leg, ๐Ÿฅฉ Cut of Meat, ๐Ÿฅ“ Bacon, ๐Ÿ” Hamburger, ๐ŸŸ French Fries, ๐Ÿ• Pizza, ๐ŸŒญ Hot Dog, ๐Ÿฅช Sandwich, ๐ŸŒฎ Taco, ๐ŸŒฏ Burrito, ๐Ÿซ” Tamale, ๐Ÿฅ™ Stuffed Flatbread, ๐Ÿง† Falafel, ๐Ÿฅš Egg, ๐Ÿณ Cooking, ๐Ÿฅ˜ Shallow Pan of Food, ๐Ÿฒ Pot of Food, ๐Ÿซ• Fondue, ๐Ÿฅฃ Bowl with Spoon, ๐Ÿฅ— Green Salad, ๐Ÿฟ Popcorn, ๐Ÿงˆ Butter, ๐Ÿง‚ Salt, ๐Ÿฅซ Canned Food, ๐Ÿฑ Bento Box, ๐Ÿ˜ Rice Cracker, ๐Ÿ™ Rice Ball, ๐Ÿš Cooked Rice, ๐Ÿ› Curry Rice, ๐Ÿœ Steaming Bowl, ๐Ÿ Spaghetti, ๐Ÿ  Roasted Sweet Potato, ๐Ÿข Oden, ๐Ÿฃ Sushi, ๐Ÿค Fried Shrimp, ๐Ÿฅ Fish Cake with Swirl, ๐Ÿฅฎ Moon Cake, ๐Ÿก Dango, ๐ŸฅŸ Dumpling, ๐Ÿฅ  Fortune Cookie, ๐Ÿฅก Takeout Box, ๐Ÿฆช Oyster, ๐Ÿฆ Soft Ice Cream, ๐Ÿง Shaved Ice, ๐Ÿจ Ice Cream, ๐Ÿฉ Doughnut, ๐Ÿช Cookie, ๐ŸŽ‚ Birthday Cake, ๐Ÿฐ Shortcake, ๐Ÿง Cupcake, ๐Ÿฅง Pie, ๐Ÿซ Chocolate Bar, ๐Ÿฌ Candy, ๐Ÿญ Lollipop, ๐Ÿฎ Custard, ๐Ÿฏ Honey Pot, ๐Ÿผ Baby Bottle, ๐Ÿฅ› Glass of Milk, โ˜• Hot Beverage, ๐Ÿซ– Teapot, ๐Ÿต Teacup Without Handle, ๐Ÿถ Sake, ๐Ÿพ Bottle with Popping Cork, ๐Ÿท Wine Glass, ๐Ÿธ Cocktail Glass, ๐Ÿน Tropical Drink, ๐Ÿบ Beer Mug, ๐Ÿป Clinking Beer Mugs, ๐Ÿฅ‚ Clinking Glasses, ๐Ÿฅƒ Tumbler Glass, ๐Ÿซ— Pouring Liquid, ๐Ÿฅค Cup with Straw, ๐Ÿง‹ Bubble Tea, ๐Ÿงƒ Beverage Box, ๐Ÿง‰ Mate, ๐ŸงŠ Ice, ๐Ÿฅข Chopsticks, ๐Ÿฝ๏ธ Fork and Knife with Plate, ๐Ÿด Fork and Knife, ๐Ÿฅ„ Spoon, ๐Ÿซ™ Jar")