awacke1's picture
Update app.py
162d595 verified
# pROMPT eVOLUTION IS IN dISCUSSIONS/cOMMUNITY TO SEE PROMPTS AND HOW IT IS MADE.
import streamlit as st
import random
import pandas as pd
st.video('The Carousel Paper Cutout World.mp4')
# Define possible traits, desires, and challenges
traits = ["Brave", "Clever", "Kind", "Curious", "Resourceful", "Timid"]
desires = ["Find a lost paper artifact", "Become a real-life figure", "Uncover the deepest secret of the carousel"]
challenges = [
{"name": "Puzzle of the Lost Scroll", "requirement": "Clever", "effect": "gain_item"},
{"name": "The Mysterious Shadow", "requirement": "Brave", "effect": "path_change"},
{"name": "The Forgotten Message", "requirement": "Curious", "effect": "reveal_info"}
]
# Define items that can be found or earned
items = ["Golden Scissors", "Enchanted Glue", "Mystical Parchment"]
# Helper function to roll dice
def roll_dice():
return random.choice(['βš€', '⚁', 'βš‚', 'βšƒ', 'βš„', 'βš…'])
# Function to handle character creation
def create_character():
with st.form("Character Creation"):
name = st.text_input("Character Name")
trait = st.selectbox("Select a Trait", traits)
desire = st.selectbox("What is your character's desire?", desires)
submitted = st.form_submit_button("Create Character")
if submitted:
character = {'name': name, 'trait': trait, 'desire': desire, 'items': []}
st.session_state.character = character
st.success(f"Character {name} created successfully!")
# Function to start the quest with dynamic challenges
def start_quest():
st.markdown("## πŸš€ The Quest Begins")
if st.button("Encounter a Challenge"):
challenge = random.choice(challenges)
st.write(f"You've encountered: {challenge['name']}.")
handle_challenge(challenge)
# Function to handle challenges
def handle_challenge(challenge):
if challenge['requirement'] == st.session_state.character['trait']:
if challenge['effect'] == "gain_item":
item = random.choice(items)
st.session_state.character['items'].append(item)
st.write(f"Successfully overcome! You found an item: {item}.")
elif challenge['effect'] == "path_change":
st.write("Successfully overcome! Your path changes, leading to new discoveries.")
elif challenge['effect'] == "reveal_info":
st.write("Successfully overcome! You uncover important information about the carousel.")
else:
st.write("Challenge not overcome. Consider trying different approaches or finding items that might help.")
# Function for carousel encounter with randomized outcomes
def carousel_encounter():
st.markdown("## 🎠 Carousel Encounter")
if st.button("Ride the Carousel"):
st.write("The carousel spins, enveloping you in a whirlwind of colors and sounds.")
outcome = roll_dice()
handle_carousel_outcome(outcome)
# Function to handle carousel outcomes
def handle_carousel_outcome(outcome):
# Example outcome handling
if outcome in ['βš€', '⚁']:
st.write("You receive a vision of a possible future, inspiring you with new determination.")
elif outcome in ['βš‚', 'βšƒ']:
item = random.choice(items)
st.session_state.character['items'].append(item)
st.write(f"The carousel's magic grants you an item: {item}.")
else:
st.write("The ride offers you a glimpse of the world's deepest secrets, changing your perspective.")
# Function to display climactic choices and resolution
def climactic_choices():
st.markdown("## βš–οΈ Climactic Choices")
choice = st.radio("What choice will you make?", ["Embrace the change", "Resist the change"])
if st.button("Make Choice"):
if choice == "Embrace the change":
st.markdown("## πŸ¦‹ Resolution and Transformation")
st.write("Your choice leads to a beautiful transformation of the world and yourself.")
else:
st.markdown("## πŸ¦‹ Resolution and Transformation")
st.write("Resisting the change keeps the world as it was, but you wonder what could have been.")
# Function to display character and inventory information
def display_character_info():
if 'character' in st.session_state:
char = st.session_state.character
st.write(f"Character: {char['name']}, Trait: {char['trait']}, Desire: {char['desire']}")
if char['items']:
st.write("Inventory:", ", ".join(char['items']))
else:
st.write("Inventory is empty.")
# Main app function
def main():
st.title("πŸ“– The Carousel Paper Cutout World Adventure")
# Initialize session state variables if not already present
if 'character' not in st.session_state:
st.session_state.character = None
# Display the story outline and rules using Streamlit markdown
with st.expander("Story Outline and Rules"):
st.markdown("""
### πŸ“– Story Outline: The Carousel Paper Cutout World
- **Objective:** To create a captivating graphic novel set in a magical paper cutout world.
- **Theme:** Cycles, changes, and the impact of choices.
- **Setting:** A vibrant paper cutout world with a central carousel.
""")
# Character creation and game progression
if st.session_state.character is None:
create_character()
else:
display_character_info()
start_quest()
carousel_encounter()
climactic_choices()
if __name__ == "__main__":
main()