Spaces:
Runtime error
Runtime error
generalize team simulation
Browse files
app.py
CHANGED
@@ -273,6 +273,8 @@ if genre == ':rainbow[Heroes Explorer]':
|
|
273 |
## Program 2 "Team Simulation"
|
274 |
elif genre == "Team Simulation":
|
275 |
|
|
|
|
|
276 |
def choose_hero(key="Hero1"):
|
277 |
name_choice = st.selectbox(label='Hero Name:', options=all_name_extra, index=0, key=key+"_name")
|
278 |
costume_list = return_costume_list(df_extra, name_choice)
|
@@ -294,27 +296,42 @@ elif genre == "Team Simulation":
|
|
294 |
st.write(f'Class: {df_hero["class"].values[0]}')
|
295 |
st.write(f'Types: {df_hero["types"].values[0]}')
|
296 |
|
297 |
-
|
298 |
-
|
299 |
-
|
300 |
-
|
301 |
-
|
302 |
-
|
303 |
-
|
304 |
-
|
305 |
-
|
306 |
-
|
307 |
-
with
|
308 |
-
|
309 |
-
|
310 |
-
|
311 |
-
|
312 |
-
|
313 |
-
with
|
314 |
-
|
315 |
-
|
316 |
-
|
317 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
318 |
st.write(f'======================')
|
319 |
st.write(f'### Total power = {total_power}')
|
320 |
st.write(f'======================')
|
|
|
273 |
## Program 2 "Team Simulation"
|
274 |
elif genre == "Team Simulation":
|
275 |
|
276 |
+
nheroes_choice = st.selectbox(label='Number of Heroes:', options=[2,3,4,5], index=-1)
|
277 |
+
|
278 |
def choose_hero(key="Hero1"):
|
279 |
name_choice = st.selectbox(label='Hero Name:', options=all_name_extra, index=0, key=key+"_name")
|
280 |
costume_list = return_costume_list(df_extra, name_choice)
|
|
|
296 |
st.write(f'Class: {df_hero["class"].values[0]}')
|
297 |
st.write(f'Types: {df_hero["types"].values[0]}')
|
298 |
|
299 |
+
|
300 |
+
col_list = st.columns(nheroes_choice+1)
|
301 |
+
df_hero_list = []
|
302 |
+
total_power = 0
|
303 |
+
for ii in range(nheroes_choice):
|
304 |
+
with col_list[ii]:
|
305 |
+
df_hero_list.append(choose_hero(key=f"Hero{ii+1}")) # 'key' in st.selectbox to differentiate widgets
|
306 |
+
write_short_description(df_hero_list[-1])
|
307 |
+
total_power += df_hero_list[ii]['power'].values[0]
|
308 |
+
|
309 |
+
with col_list[-1]:
|
310 |
+
txt = st.text_area("Write your note about team synergy", max_chars=1000, height = 480)
|
311 |
+
|
312 |
+
df_hero_all5 = pd.concat(df_hero_list)
|
313 |
+
|
314 |
+
# col1, col2, col3, col4, col5, col6 = st.columns(6)
|
315 |
+
# with col1:
|
316 |
+
# df_hero1 = choose_hero(key="Hero1") # 'key' in st.selectbox to differentiate widgets
|
317 |
+
# write_short_description(df_hero1)
|
318 |
+
# with col2:
|
319 |
+
# df_hero2 = choose_hero(key="Hero2")
|
320 |
+
# write_short_description(df_hero2)
|
321 |
+
# with col3:
|
322 |
+
# df_hero3 = choose_hero(key="Hero3")
|
323 |
+
# write_short_description(df_hero3)
|
324 |
+
# with col4:
|
325 |
+
# df_hero4 = choose_hero(key="Hero4")
|
326 |
+
# write_short_description(df_hero4)
|
327 |
+
# with col5:
|
328 |
+
# df_hero5 = choose_hero(key="Hero5")
|
329 |
+
# write_short_description(df_hero5)
|
330 |
+
# with col6:
|
331 |
+
# txt = st.text_area("Write your note about team synergy", max_chars=1000)
|
332 |
+
|
333 |
+
# df_hero_all5 = pd.concat([df_hero1, df_hero2, df_hero3, df_hero4, df_hero5])
|
334 |
+
# total_power = df_hero1['power'].values[0]+ df_hero2['power'].values[0]+ df_hero3['power'].values[0]+ df_hero4['power'].values[0]+ df_hero5['power'].values[0]
|
335 |
st.write(f'======================')
|
336 |
st.write(f'### Total power = {total_power}')
|
337 |
st.write(f'======================')
|