Spaces:
Runtime error
Runtime error
Delete app.py
Browse files
app.py
DELETED
@@ -1,51 +0,0 @@
|
|
1 |
-
import streamlit as st
|
2 |
-
import plotly.express as px
|
3 |
-
import pandas as pd
|
4 |
-
import numpy as np
|
5 |
-
|
6 |
-
# Define the list of game mechanics
|
7 |
-
game_mechanics = ["Action Queue โฑ๏ธ", "Action Retrieval ๐", "Campaign / Battle Card Driven ๐๏ธ",
|
8 |
-
"Card Play Conflict Resolution ๐ณ๐ค", "Communication Limits ๐",
|
9 |
-
"Cooperative Game ๐ค๐ฅ", "Critical Hits and Failures ๐ฅ๐", "Deck Construction ๐ด๐ ๏ธ",
|
10 |
-
"Grid Movement ๐บ๏ธ", "Hand Management ๐๏ธ๐", "Hexagon Grid ๐ณ", "Legacy Game ๐๐ฎ",
|
11 |
-
"Line of Sight ๐", "Modular Board ๐งฉ", "Once-Per-Game Abilities ๐", "Role Playing ๐ญ",
|
12 |
-
"Scenario / Mission / Campaign Game ๐ฏ", "Simultaneous Action Selection ๐ค๐ค",
|
13 |
-
"Solo / Solitaire Game ๐บ", "Storytelling ๐", "Variable Player Powers ๐ฆธโโ๏ธ๐ฆนโโ๏ธ"]
|
14 |
-
|
15 |
-
# Define a function to generate random values for each game mechanic
|
16 |
-
def generate_values(n):
|
17 |
-
health_points = np.random.randint(50, 100, size=n)
|
18 |
-
coins = np.random.randint(10, 50, size=n)
|
19 |
-
return {"HealthPoints": health_points, "Coins": coins}
|
20 |
-
|
21 |
-
# Define the Streamlit app
|
22 |
-
def app():
|
23 |
-
st.title("Game Mechanics Treemap Chart")
|
24 |
-
st.write("This app displays a Treemap chart of game mechanics.")
|
25 |
-
|
26 |
-
# Generate the data for the chart
|
27 |
-
n = len(game_mechanics)
|
28 |
-
values = generate_values(n)
|
29 |
-
data = pd.DataFrame({
|
30 |
-
"category": ["Category 1"] * n,
|
31 |
-
"mechanic": game_mechanics,
|
32 |
-
"value": list(values.values()),
|
33 |
-
"HealthPoints": values["HealthPoints"],
|
34 |
-
"Coins": values["Coins"],
|
35 |
-
"description": ["Description"] * n
|
36 |
-
})
|
37 |
-
data["value"] = data["value"].apply(lambda x: sum(x))
|
38 |
-
|
39 |
-
# Draw the chart
|
40 |
-
fig = px.treemap(data, path=["category", "mechanic"], values="value",
|
41 |
-
color="HealthPoints", hover_data=["Coins"])
|
42 |
-
st.plotly_chart(fig)
|
43 |
-
|
44 |
-
# Display a download link for the data
|
45 |
-
csv = data.to_csv(index=False)
|
46 |
-
b64 = base64.b64encode(csv.encode()).decode()
|
47 |
-
href = f'<a href="data:file/csv;base64,{b64}" download="game_mechanics.csv">Download CSV</a>'
|
48 |
-
st.markdown(href, unsafe_allow_html=True)
|
49 |
-
|
50 |
-
if __name__ == '__main__':
|
51 |
-
app()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|