awacke1 commited on
Commit
2f3379a
Β·
verified Β·
1 Parent(s): 6a9e178

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +23 -7
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
- # Additional locations can be added here
 
 
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
- direction = st.sidebar.selectbox("Move direction", ["None", "North", "South", "East", "West"])
59
- if direction != "None":
60
- st.session_state.locations = move_emojis(st.session_state.locations, current_location, direction)
61
- st.experimental_rerun()
 
 
 
 
 
 
 
 
 
 
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()