awacke1 commited on
Commit
571e8a6
Β·
verified Β·
1 Parent(s): beed96a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +36 -23
app.py CHANGED
@@ -1,37 +1,45 @@
1
  import streamlit as st
2
 
3
- # Story content structured as a list of dictionaries
4
  story_content = [
5
  {"id": "start",
6
  "text": "Essie grows fascinated with faeries and leprechauns, following her grandmother's tales. 🧚",
7
- "choices": [("Continue", "choice_a")]
8
  },
9
  {"id": "choice_a",
10
- "text": "Does Essie leave gifts for the leprechauns or ignore the traditions? 🎁",
11
- "choices": [("Leave gifts", "choice_b1"), ("Ignore", "end_ignore")]
12
  },
13
- {"id": "choice_b1",
14
- "text": "Essie decides to steal bread and leave it out for the leprechauns. 🍞",
15
- "choices": [("Continue", "outcome_b1")]
16
  },
17
- {"id": "outcome_b1",
18
- "text": "Her offering attracts Mad Sweeney, marking the beginning of her intertwined fate with the leprechaun. πŸ€",
19
- "choices": [("Continue", "choice_c")]
20
  },
21
- {"id": "choice_c",
22
- "text": "After returning to London, does Essie continue her life of crime or attempt to live honestly? πŸ”‘",
23
- "choices": [("Live a life of crime", "outcome_c1"), ("Live honestly", "end_honest")]
24
  },
25
- {"id": "outcome_c1",
26
- "text": "In her old age, Essie is visited by Mad Sweeney, who thanks her for bringing him to the New World. πŸ‘΅",
27
- "choices": [("Restart", "start")]
 
 
 
 
 
 
 
 
28
  },
29
- {"id": "end_ignore",
30
- "text": "Ignoring the traditions, Essie's life takes a different turn, far from the mystical encounters of her youth. πŸšΆβ€β™€οΈ",
31
  "choices": [("Restart", "start")]
32
  },
33
- {"id": "end_honest",
34
- "text": "Attempting to live honestly, Essie finds peace in a simpler life, though she occasionally misses the thrill of her past. πŸŒ…",
35
  "choices": [("Restart", "start")]
36
  }
37
  ]
@@ -42,8 +50,13 @@ def render_story_point(story_id):
42
  st.write(story_point["text"])
43
  for choice_text, next_id in story_point["choices"]:
44
  if st.button(choice_text):
45
- render_story_point(next_id)
46
  break
47
 
48
- st.title("Choose Your Own Adventure: Essie's Tale")
49
- render_story_point("start")
 
 
 
 
 
 
1
  import streamlit as st
2
 
3
+ # Expanded story content with directions
4
  story_content = [
5
  {"id": "start",
6
  "text": "Essie grows fascinated with faeries and leprechauns, following her grandmother's tales. 🧚",
7
+ "choices": [("Explore", "choice_a")]
8
  },
9
  {"id": "choice_a",
10
+ "text": "Which direction does Essie explore? 🧭",
11
+ "choices": [("North", "north_discovery"), ("South", "south_discovery"), ("East", "east_discovery"), ("West", "west_discovery")]
12
  },
13
+ {"id": "north_discovery",
14
+ "text": "Essie discovers a hidden glen, alive with faerie lights. 🌌",
15
+ "choices": [("Perform a ritual", "ritual_outcome"), ("Explore cautiously", "explore_outcome")]
16
  },
17
+ {"id": "south_discovery",
18
+ "text": "Essie finds a mystical lake reflecting the moon's glow. πŸŒ•",
19
+ "choices": [("Perform a ritual", "ritual_outcome"), ("Explore cautiously", "explore_outcome")]
20
  },
21
+ {"id": "east_discovery",
22
+ "text": "Essie encounters a grove with a mysterious faerie circle. πŸ„",
23
+ "choices": [("Perform a ritual", "ritual_outcome"), ("Explore cautiously", "explore_outcome")]
24
  },
25
+ {"id": "west_discovery",
26
+ "text": "Essie stumbles upon an ancient tree, rumored to be a portal to the Otherworld. 🌳",
27
+ "choices": [("Perform a ritual", "ritual_outcome"), ("Explore cautiously", "explore_outcome")]
28
+ },
29
+ {"id": "ritual_outcome",
30
+ "text": "The ritual connects Essie with the faerie realm, leading to a magical encounter. ✨",
31
+ "choices": [("Use knowledge to preserve tradition", "preserve_tradition"), ("Use gift for personal gain", "personal_gain")]
32
+ },
33
+ {"id": "explore_outcome",
34
+ "text": "Cautious exploration reveals hidden truths of the mystical world. πŸ”",
35
+ "choices": [("Use knowledge to preserve tradition", "preserve_tradition"), ("Use gift for personal gain", "personal_gain")]
36
  },
37
+ {"id": "preserve_tradition",
38
+ "text": "Essie returns home, enriched with stories and traditions to pass down. πŸ“š",
39
  "choices": [("Restart", "start")]
40
  },
41
+ {"id": "personal_gain",
42
+ "text": "Using her new-found knowledge/gift, Essie seeks to benefit herself, changing her destiny. πŸ’°",
43
  "choices": [("Restart", "start")]
44
  }
45
  ]
 
50
  st.write(story_point["text"])
51
  for choice_text, next_id in story_point["choices"]:
52
  if st.button(choice_text):
53
+ st.session_state['current_id'] = next_id # Update the current story ID in session state
54
  break
55
 
56
+ st.title("Choose Your Own Adventure: Essie's Journey")
57
+
58
+ # Initialize or update current story ID in session state
59
+ if 'current_id' not in st.session_state:
60
+ st.session_state['current_id'] = "start"
61
+
62
+ render_story_point(st.session_state['current_id'])