awacke1 commited on
Commit
a11f0c6
ยท
1 Parent(s): f360d45

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -4
app.py CHANGED
@@ -15,10 +15,12 @@ def roll_dice(num_rolls, dice_type):
15
 
16
  def plot_tokens(health_tokens, coin_tokens):
17
  fig = go.Figure()
18
- health_foods = [FOOD_LIST[i] for i in health_tokens]
19
- coin_foods = [FOOD_LIST[i] for i in coin_tokens]
20
- fig.add_trace(go.Scatter(x=list(range(1, len(health_foods) + 1)), y=health_foods, name="๐Ÿ’– Health"))
21
- fig.add_trace(go.Scatter(x=list(range(1, len(coin_foods) + 1)), y=coin_foods, name="๐Ÿ’ฐ Coins"))
 
 
22
  fig.update_layout(title="Token Accumulation", xaxis_title="Rolls", yaxis_title="Tokens")
23
  st.plotly_chart(fig)
24
 
 
15
 
16
  def plot_tokens(health_tokens, coin_tokens):
17
  fig = go.Figure()
18
+ if len(health_tokens) > 0:
19
+ health_foods = [FOOD_LIST[i] for i in health_tokens]
20
+ fig.add_trace(go.Scatter(x=list(range(1, len(health_foods) + 1)), y=health_foods, name="๐Ÿ’– Health"))
21
+ if len(coin_tokens) > 0:
22
+ coin_foods = [FOOD_LIST[i] for i in coin_tokens]
23
+ fig.add_trace(go.Scatter(x=list(range(1, len(coin_foods) + 1)), y=coin_foods, name="๐Ÿ’ฐ Coins"))
24
  fig.update_layout(title="Token Accumulation", xaxis_title="Rolls", yaxis_title="Tokens")
25
  st.plotly_chart(fig)
26