Update app.py
Browse files
app.py
CHANGED
@@ -17,7 +17,7 @@ def fib_sequence(n):
|
|
17 |
return fib_seq[2:] # Exclude first two numbers for this use case
|
18 |
|
19 |
# Expanded set of emojis for landscape elements
|
20 |
-
emoji_set = ["π²", "π³", "π", "π²", "πΏ", "π", "π ", "π°", "πΌ", "π€οΈ", "π", "ποΈ", "π", "πΎ", "ποΈ", "ποΈ", "π", "π€οΈ", "π£οΈ", "ποΈ", "π", "β°οΈ", "π§±", "π΅", "π", "πΌ", "π»", "πΊ", "π‘", "πΊοΈ"]
|
21 |
|
22 |
# Locations and emoji grid maps initialization
|
23 |
def initialize_locations(size):
|
@@ -28,7 +28,9 @@ def initialize_locations(size):
|
|
28 |
locations = {
|
29 |
'forest edge': np.random.choice(emoji_set, (size, size)),
|
30 |
'deep forest': np.random.choice(emoji_set, (size, size)),
|
31 |
-
|
|
|
|
|
32 |
}
|
33 |
return locations
|
34 |
|
@@ -47,18 +49,32 @@ def main():
|
|
47 |
st.title("Explore the Emoji World")
|
48 |
|
49 |
size = st.sidebar.slider("Grid Size", 5, 40, 10)
|
|
|
50 |
if 'locations' not in st.session_state:
|
51 |
st.session_state.locations = initialize_locations(size)
|
52 |
-
|
|
|
|
|
53 |
current_location = st.sidebar.selectbox("Select location", options=list(st.session_state.locations.keys()))
|
|
|
54 |
emoji_map = st.session_state.locations[current_location]
|
55 |
map_str = "\n".join(["".join(row) for row in emoji_map])
|
56 |
st.text(map_str)
|
57 |
|
58 |
-
|
59 |
-
|
60 |
-
st.
|
61 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
62 |
|
63 |
if __name__ == "__main__":
|
64 |
main()
|
|
|
17 |
return fib_seq[2:] # Exclude first two numbers for this use case
|
18 |
|
19 |
# Expanded set of emojis for landscape elements
|
20 |
+
emoji_set = ["π²", "π³", "π", "π²", "πΏ", "π", "π ", "π°", "πΌ", "π€οΈ", "π", "ποΈ", "π", "πΎ", "ποΈ", "ποΈ", "π", "π€οΈ", "π£οΈ", "ποΈ", "π", "β°οΈ", "π§±", "π΅", "π", "πΌ", "π»", "πΊ", "π‘", "πΊοΈ", "π
", "π", "ποΈ", "ποΈ", "π»", "ποΈ", "ποΈ", "π―", "ποΈ", "π", "π", "π", "ποΈ"]
|
21 |
|
22 |
# Locations and emoji grid maps initialization
|
23 |
def initialize_locations(size):
|
|
|
28 |
locations = {
|
29 |
'forest edge': np.random.choice(emoji_set, (size, size)),
|
30 |
'deep forest': np.random.choice(emoji_set, (size, size)),
|
31 |
+
'mountain range': np.random.choice(emoji_set, (size, size)),
|
32 |
+
'coastal town': np.random.choice(emoji_set, (size, size)),
|
33 |
+
'desert oasis': np.random.choice(emoji_set, (size, size)),
|
34 |
}
|
35 |
return locations
|
36 |
|
|
|
49 |
st.title("Explore the Emoji World")
|
50 |
|
51 |
size = st.sidebar.slider("Grid Size", 5, 40, 10)
|
52 |
+
|
53 |
if 'locations' not in st.session_state:
|
54 |
st.session_state.locations = initialize_locations(size)
|
55 |
+
else:
|
56 |
+
st.session_state.locations = initialize_locations(size)
|
57 |
+
|
58 |
current_location = st.sidebar.selectbox("Select location", options=list(st.session_state.locations.keys()))
|
59 |
+
|
60 |
emoji_map = st.session_state.locations[current_location]
|
61 |
map_str = "\n".join(["".join(row) for row in emoji_map])
|
62 |
st.text(map_str)
|
63 |
|
64 |
+
col1, col2, col3 = st.columns(3)
|
65 |
+
with col1:
|
66 |
+
if st.button("West"):
|
67 |
+
st.session_state.locations = move_emojis(st.session_state.locations, current_location, "West")
|
68 |
+
with col2:
|
69 |
+
if st.button("North"):
|
70 |
+
st.session_state.locations = move_emojis(st.session_state.locations, current_location, "North")
|
71 |
+
if st.button("Stop"):
|
72 |
+
pass
|
73 |
+
if st.button("South"):
|
74 |
+
st.session_state.locations = move_emojis(st.session_state.locations, current_location, "South")
|
75 |
+
with col3:
|
76 |
+
if st.button("East"):
|
77 |
+
st.session_state.locations = move_emojis(st.session_state.locations, current_location, "East")
|
78 |
|
79 |
if __name__ == "__main__":
|
80 |
main()
|