-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdiceroller.py
28 lines (25 loc) · 1.05 KB
/
diceroller.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
import streamlit as st
import random
result_to_pic = {"Esprit":"exprit.png", "Hex":"hex.png", "Janus":"janus.png"}
st.title('Diceroller')
hexdice = st.text_input("Anzahl Hexxen-Würfel", value=5)
jandice = st.text_input("Bonus/Malus", value=0)
last_hex_results = []
last_jan_results = []
if st.button('Würfeln'):
hexresults = [random.choice(["Leer", "Leer", "leer", "Esprit", "Hex", "Hex"]) for i in range(int(hexdice))]
for r in hexresults:
if r.lower() != "leer":
st.image(result_to_pic[r], width=30)
janresults = [random.choice(["Leer", "Janus"]) for i in range(int(jandice))]
for r in janresults:
if r.lower() != "leer":
st.image(result_to_pic[r], width=30)
last_hex_results = hexresults
last_jan_results = janresults
with st.expander("Vollständiges Würfelergebnis"):
st.write("Hexxen-Würfel Ergebnisse:")
st.write(hexresults)
st.write("Janus-Würfel Ergebnisse:")
st.write(janresults)
st.text("Icons Credit: Raven - Freepik, Zeus - Eucalyp, Star - Freepik")