awacke1 commited on
Commit
c8948d1
β€’
1 Parent(s): b430856

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +73 -30
app.py CHANGED
@@ -1,45 +1,80 @@
 
 
1
  import streamlit as st
2
  import random
 
 
 
 
 
 
 
 
 
 
 
 
 
3
 
4
- # Define a function to roll dice and return a random emoji based on the result
5
  def roll_dice():
6
- result = random.randint(1, 6)
7
- dice_emojis = ['βš€', '⚁', 'βš‚', 'βšƒ', 'βš„', 'βš…']
8
- return dice_emojis[result - 1]
9
 
10
  # Function to handle character creation
11
  def create_character():
12
  with st.form("Character Creation"):
13
  name = st.text_input("Character Name")
14
- trait = st.selectbox("Select a Trait", ["Brave", "Clever", "Kind"])
15
- desire = st.text_input("What is your character's desire?")
16
  submitted = st.form_submit_button("Create Character")
17
  if submitted:
18
- st.session_state.character = {'name': name, 'trait': trait, 'desire': desire}
 
19
  st.success(f"Character {name} created successfully!")
20
 
21
- # Function to start the quest
22
  def start_quest():
23
  st.markdown("## πŸš€ The Quest Begins")
24
- st.write("You embark on your journey to find the carousel. Along the way, you encounter various challenges.")
25
- challenge = st.button("Face a Challenge")
26
- if challenge:
27
- st.write(f"You faced a challenge and your path changes. Roll a dice to see the outcome.")
28
- dice_result = roll_dice()
29
- st.write(f"Dice Roll Result: {dice_result}")
30
- # Update the path based on the dice roll if needed
31
- # This is where you can add logic to alter the player's path or story based on the dice roll.
32
-
33
- # Function to encounter the carousel
 
 
 
 
 
 
 
 
 
 
34
  def carousel_encounter():
35
  st.markdown("## 🎠 Carousel Encounter")
36
- st.write("You've found the carousel! It's time to experience its magic.")
37
- ride = st.button("Ride the Carousel")
38
- if ride:
39
- st.write("The carousel starts spinning and you're engulfed in a whirlwind of colors and sounds.")
40
- # This is where you can add logic for the carousel encounter outcomes.
41
 
42
- # Function to display the climactic choices and resolution
 
 
 
 
 
 
 
 
 
 
 
 
43
  def climactic_choices():
44
  st.markdown("## βš–οΈ Climactic Choices")
45
  choice = st.radio("What choice will you make?", ["Embrace the change", "Resist the change"])
@@ -51,6 +86,16 @@ def climactic_choices():
51
  st.markdown("## πŸ¦‹ Resolution and Transformation")
52
  st.write("Resisting the change keeps the world as it was, but you wonder what could have been.")
53
 
 
 
 
 
 
 
 
 
 
 
54
  # Main app function
55
  def main():
56
  st.title("πŸ“– The Carousel Paper Cutout World Adventure")
@@ -59,7 +104,7 @@ def main():
59
  if 'character' not in st.session_state:
60
  st.session_state.character = None
61
 
62
- # Display the story outline
63
  with st.expander("Story Outline and Rules"):
64
  st.markdown("""
65
  ### πŸ“– Story Outline: The Carousel Paper Cutout World
@@ -68,16 +113,14 @@ def main():
68
  - **Setting:** A vibrant paper cutout world with a central carousel.
69
  """)
70
 
71
- # Character creation step
72
  if st.session_state.character is None:
73
  create_character()
74
  else:
75
- st.write(f"Welcome, {st.session_state.character['name']}!")
76
-
77
- # Game steps
78
  start_quest()
79
  carousel_encounter()
80
  climactic_choices()
81
 
82
  if __name__ == "__main__":
83
- main()
 
1
+ # pROMPT eVOLUTION IS IN dISCUSSIONS/cOMMUNITY TO SEE PROMPTS AND HOW IT IS MADE.
2
+
3
  import streamlit as st
4
  import random
5
+ import pandas as pd
6
+
7
+ # Define possible traits, desires, and challenges
8
+ traits = ["Brave", "Clever", "Kind", "Curious", "Resourceful", "Timid"]
9
+ desires = ["Find a lost paper artifact", "Become a real-life figure", "Uncover the deepest secret of the carousel"]
10
+ challenges = [
11
+ {"name": "Puzzle of the Lost Scroll", "requirement": "Clever", "effect": "gain_item"},
12
+ {"name": "The Mysterious Shadow", "requirement": "Brave", "effect": "path_change"},
13
+ {"name": "The Forgotten Message", "requirement": "Curious", "effect": "reveal_info"}
14
+ ]
15
+
16
+ # Define items that can be found or earned
17
+ items = ["Golden Scissors", "Enchanted Glue", "Mystical Parchment"]
18
 
19
+ # Helper function to roll dice
20
  def roll_dice():
21
+ return random.choice(['βš€', '⚁', 'βš‚', 'βšƒ', 'βš„', 'βš…'])
 
 
22
 
23
  # Function to handle character creation
24
  def create_character():
25
  with st.form("Character Creation"):
26
  name = st.text_input("Character Name")
27
+ trait = st.selectbox("Select a Trait", traits)
28
+ desire = st.selectbox("What is your character's desire?", desires)
29
  submitted = st.form_submit_button("Create Character")
30
  if submitted:
31
+ character = {'name': name, 'trait': trait, 'desire': desire, 'items': []}
32
+ st.session_state.character = character
33
  st.success(f"Character {name} created successfully!")
34
 
35
+ # Function to start the quest with dynamic challenges
36
  def start_quest():
37
  st.markdown("## πŸš€ The Quest Begins")
38
+ if st.button("Encounter a Challenge"):
39
+ challenge = random.choice(challenges)
40
+ st.write(f"You've encountered: {challenge['name']}.")
41
+ handle_challenge(challenge)
42
+
43
+ # Function to handle challenges
44
+ def handle_challenge(challenge):
45
+ if challenge['requirement'] == st.session_state.character['trait']:
46
+ if challenge['effect'] == "gain_item":
47
+ item = random.choice(items)
48
+ st.session_state.character['items'].append(item)
49
+ st.write(f"Successfully overcome! You found an item: {item}.")
50
+ elif challenge['effect'] == "path_change":
51
+ st.write("Successfully overcome! Your path changes, leading to new discoveries.")
52
+ elif challenge['effect'] == "reveal_info":
53
+ st.write("Successfully overcome! You uncover important information about the carousel.")
54
+ else:
55
+ st.write("Challenge not overcome. Consider trying different approaches or finding items that might help.")
56
+
57
+ # Function for carousel encounter with randomized outcomes
58
  def carousel_encounter():
59
  st.markdown("## 🎠 Carousel Encounter")
60
+ if st.button("Ride the Carousel"):
61
+ st.write("The carousel spins, enveloping you in a whirlwind of colors and sounds.")
62
+ outcome = roll_dice()
63
+ handle_carousel_outcome(outcome)
 
64
 
65
+ # Function to handle carousel outcomes
66
+ def handle_carousel_outcome(outcome):
67
+ # Example outcome handling
68
+ if outcome in ['βš€', '⚁']:
69
+ st.write("You receive a vision of a possible future, inspiring you with new determination.")
70
+ elif outcome in ['βš‚', 'βšƒ']:
71
+ item = random.choice(items)
72
+ st.session_state.character['items'].append(item)
73
+ st.write(f"The carousel's magic grants you an item: {item}.")
74
+ else:
75
+ st.write("The ride offers you a glimpse of the world's deepest secrets, changing your perspective.")
76
+
77
+ # Function to display climactic choices and resolution
78
  def climactic_choices():
79
  st.markdown("## βš–οΈ Climactic Choices")
80
  choice = st.radio("What choice will you make?", ["Embrace the change", "Resist the change"])
 
86
  st.markdown("## πŸ¦‹ Resolution and Transformation")
87
  st.write("Resisting the change keeps the world as it was, but you wonder what could have been.")
88
 
89
+ # Function to display character and inventory information
90
+ def display_character_info():
91
+ if 'character' in st.session_state:
92
+ char = st.session_state.character
93
+ st.write(f"Character: {char['name']}, Trait: {char['trait']}, Desire: {char['desire']}")
94
+ if char['items']:
95
+ st.write("Inventory:", ", ".join(char['items']))
96
+ else:
97
+ st.write("Inventory is empty.")
98
+
99
  # Main app function
100
  def main():
101
  st.title("πŸ“– The Carousel Paper Cutout World Adventure")
 
104
  if 'character' not in st.session_state:
105
  st.session_state.character = None
106
 
107
+ # Display the story outline and rules using Streamlit markdown
108
  with st.expander("Story Outline and Rules"):
109
  st.markdown("""
110
  ### πŸ“– Story Outline: The Carousel Paper Cutout World
 
113
  - **Setting:** A vibrant paper cutout world with a central carousel.
114
  """)
115
 
116
+ # Character creation and game progression
117
  if st.session_state.character is None:
118
  create_character()
119
  else:
120
+ display_character_info()
 
 
121
  start_quest()
122
  carousel_encounter()
123
  climactic_choices()
124
 
125
  if __name__ == "__main__":
126
+ main()