import streamlit as st import random import pandas as pd from datetime import datetime # Define the game mechanics def generate_scenario(): scenarios = ['🦸 You are a superhero saving the world from a meteorite', '🏴‍☠️ You are a pirate searching for treasure on a deserted island', '👨‍🍳 You are a chef trying to win a cooking competition', '🕵️ You are a detective solving a murder case'] return random.choice(scenarios) def calculate_score(slider_values): bluffing_score, deduction_score, humor_score, memory_score, roleplay_score = slider_values total_score = bluffing_score + deduction_score + humor_score + memory_score + roleplay_score return total_score def play_game(slider_values): scenario = generate_scenario() st.write('🎭 Act out the following scenario: ' + scenario) total_score = calculate_score(slider_values) st.write('🎯 Your total score is: ' + str(total_score)) # Save game history to a dataframe game_history_df = pd.DataFrame({'Scenario': [scenario], 'Bluffing': [slider_values[0]], 'Deduction': [slider_values[1]], 'Humor': [slider_values[2]], 'Memory': [slider_values[3]], 'Roleplay': [slider_values[4]], 'Total Score': [total_score]}) # Append to existing game history try: existing_game_history = pd.read_csv('game_history.csv') game_history_df = pd.concat([existing_game_history, game_history_df], ignore_index=True) except: pass return game_history_df def save_game_history(game_history_df): game_history_df.to_csv('game_history.csv', index=False) st.write('📝 Game history saved!') st.write(game_history_df) def save_simulation_results(simulation_results_df): filename = datetime.now().strftime('%Y-%m-%d %H-%M-%S') + '.csv' simulation_results_df.to_csv(filename, index=False) st.write('📝 Simulation results saved!') st.write(simulation_results_df) def run_simulations(num_simulations): total_scores = [] simulation_results_df = pd.DataFrame(columns=['Scenario', 'Bluffing', 'Deduction', 'Humor', 'Memory', 'Roleplay', 'Total Score']) for i in range(num_simulations): slider_values = [random.randint(1, 10) for i in range(5)] total_score = calculate_score(slider_values) total_scores.append(total_score) scenario = generate_scenario() simulation_results_df = simulation_results_df.append({'Scenario': scenario, 'Bluffing': slider_values[0], 'Deduction': slider_values[1], 'Humor': slider_values[2], 'Memory': slider_values[3], 'Roleplay': slider_values[4], 'Total Score': total_score}, ignore_index=True) st.write('🎲 Average score from ' + str(num_simulations) + ' simulations: ' + str(sum(total_scores)/len(total_scores))) st.write(simulation_results_df) save_simulation_results(simulation_results_df) # Define the Streamlit app st.set_page_config(layout="wide") st.title('🎭 Acting Game Mechanics') st.write('🎯 Welcome to the Acting Game Mechanics! This game measures your ability to bluff, deduce, use humor, remember details, and role-play. Drag the sliders to the left or right to adjust each skill, and click 🎭 Play to act out a scenario and receive a score.') with st.sidebar: slider_values = [st.slider('🃏 Bluffing', 1, 10, 5), st.slider('🕵️ Deduction', 1, 10, 5), st.slider('😂 Humor', 1, 10, 5), st.slider('🧠 Memory', 1, 10, 5), st.slider('👥 Roleplay', 1, 10, 5)] if st.button('🎭 Play'): game_history_df = play_game(slider_values) save_game_history(game_history_df) if st.button('🎲 Run simulations'): num_simulations = st.slider('🔁 Number of simulations', 1, 100000, 1000) run_simulations(num_simulations) if st.button('📝 Show all game history'): try: game_history_df = pd.read_csv('game_history.csv') st.write(game_history_df) except: st.write('No game history found') if st.button('📝 Download game history'): try: game_history_df = pd.read_csv('game_history.csv') filename = 'game_history_' + datetime.now().strftime('%Y-%m-%d %H-%M-%S') + '.csv' game_history_df.to_csv(filename, index=False) st.write('📝 Game history downloaded!') st.write(game_history_df) except: st.write('No game history found') if st.button('📝 Download simulation results'): try: simulation_results_df = pd.read_csv('simulation_results.csv') filename = 'simulation_results_' + datetime.now().strftime('%Y-%m-%d %H-%M-%S') + '.csv' simulation_results_df.to_csv(filename, index=False) st.write('📝 Simulation results downloaded!') st.write(simulation_results_df) except: st.write('No simulation results found') st.markdown(""" 🎭 Acting Game Mechanics 🎯🃏 Bluffing 🕵️ Deduction 😂 Humor 🧠 Memory 👥 Roleplay 🎭 Acting Game Mechanics: Characterization: Act out your character's traits, emotions, and personality. Improvisation: Think on your feet and come up with responses to unexpected situations. Scripted Dialogue: Deliver lines from a pre-written script or engage in scripted conversations. For more information on Acting Game Mechanics, you can visit the Wikipedia page on Role-playing game mechanics: https://en.wikipedia.org/wiki/Acting 🎯🃏 Bluffing: Lying: Convince others that your false information is true. Concealment: Hide your true intentions or actions. Misdirection: Lead others to believe something different from what you are doing. For more information on Bluffing, you can visit the Wikipedia page on Bluff (poker): https://en.wikipedia.org/wiki/Bluff_(poker) 🕵️ Deduction: Clue Analysis: Examine clues to draw conclusions about a mystery. Logical Reasoning: Use deductive reasoning to arrive at the correct solution. Pattern Recognition: Recognize and match patterns to uncover hidden information. For more information on Deduction, you can visit the Wikipedia page on Deduction game: https://en.wikipedia.org/wiki/Deduction 😂 Humor: Parody: Use humorous exaggeration or imitation to make fun of a subject. Puns: Play with words to create humorous meanings. Satire: Use irony, sarcasm, and ridicule to critique a topic or individual. For more information on Humor, you can visit the Wikipedia page on Humor: https://en.wikipedia.org/wiki/Humor 🧠 Memory: Recall: Remember information from previous events or interactions. Recognition: Identify information you have seen or heard before. Memorization: Commit information to memory for future use. For more information on Memory, you can visit the Wikipedia page on Memory game: https://en.wikipedia.org/wiki/Memory 👥 Roleplay: Character Creation: Develop a unique character with specific traits and abilities. Storytelling: Create a narrative with the characters and the world they inhabit. Collaborative Play: Work with others to create an immersive experience. For more information on Roleplay, you can visit the Wikipedia page on Role-playing game: https://en.wikipedia.org/wiki/Role-playing_game """)