awacke1 commited on
Commit
6e392f5
β€’
1 Parent(s): a506cf7

Create backup-app.py

Browse files
Files changed (1) hide show
  1. backup-app.py +172 -0
backup-app.py ADDED
@@ -0,0 +1,172 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import streamlit as st
2
+ import random
3
+ import pandas as pd
4
+ from datetime import datetime
5
+
6
+ # Define the game mechanics
7
+
8
+ def generate_scenario():
9
+ scenarios = ['🦸 You are a superhero saving the world from a meteorite',
10
+ 'πŸ΄β€β˜ οΈ You are a pirate searching for treasure on a deserted island',
11
+ 'πŸ‘¨β€πŸ³ You are a chef trying to win a cooking competition',
12
+ 'πŸ•΅οΈ You are a detective solving a murder case']
13
+ return random.choice(scenarios)
14
+
15
+ def calculate_score(slider_values):
16
+ bluffing_score, deduction_score, humor_score, memory_score, roleplay_score = slider_values
17
+
18
+ total_score = bluffing_score + deduction_score + humor_score + memory_score + roleplay_score
19
+ return total_score
20
+
21
+ def play_game(slider_values):
22
+ scenario = generate_scenario()
23
+ st.write('🎭 Act out the following scenario: ' + scenario)
24
+ total_score = calculate_score(slider_values)
25
+ st.write('🎯 Your total score is: ' + str(total_score))
26
+
27
+ # Save game history to a dataframe
28
+ game_history_df = pd.DataFrame({'Scenario': [scenario],
29
+ 'Bluffing': [slider_values[0]],
30
+ 'Deduction': [slider_values[1]],
31
+ 'Humor': [slider_values[2]],
32
+ 'Memory': [slider_values[3]],
33
+ 'Roleplay': [slider_values[4]],
34
+ 'Total Score': [total_score]})
35
+
36
+ # Append to existing game history
37
+ try:
38
+ existing_game_history = pd.read_csv('game_history.csv')
39
+ game_history_df = pd.concat([existing_game_history, game_history_df], ignore_index=True)
40
+ except:
41
+ pass
42
+
43
+ return game_history_df
44
+
45
+ def save_game_history(game_history_df):
46
+ game_history_df.to_csv('game_history.csv', index=False)
47
+ st.write('πŸ“ Game history saved!')
48
+ st.write(game_history_df)
49
+
50
+ def save_simulation_results(simulation_results_df):
51
+ filename = datetime.now().strftime('%Y-%m-%d %H-%M-%S') + '.csv'
52
+ simulation_results_df.to_csv(filename, index=False)
53
+ st.write('πŸ“ Simulation results saved!')
54
+ st.write(simulation_results_df)
55
+
56
+ def run_simulations(num_simulations):
57
+ total_scores = []
58
+ simulation_results_df = pd.DataFrame(columns=['Scenario', 'Bluffing', 'Deduction', 'Humor', 'Memory', 'Roleplay', 'Total Score'])
59
+ for i in range(num_simulations):
60
+ slider_values = [random.randint(1, 10) for i in range(5)]
61
+ total_score = calculate_score(slider_values)
62
+ total_scores.append(total_score)
63
+ scenario = generate_scenario()
64
+ simulation_results_df = simulation_results_df.append({'Scenario': scenario,
65
+ 'Bluffing': slider_values[0],
66
+ 'Deduction': slider_values[1],
67
+ 'Humor': slider_values[2],
68
+ 'Memory': slider_values[3],
69
+ 'Roleplay': slider_values[4],
70
+ 'Total Score': total_score}, ignore_index=True)
71
+ st.write('🎲 Average score from ' + str(num_simulations) + ' simulations: ' + str(sum(total_scores)/len(total_scores)))
72
+ st.write(simulation_results_df)
73
+ save_simulation_results(simulation_results_df)
74
+
75
+
76
+ # Define the Streamlit app
77
+
78
+ st.title('🎭 Acting Game Mechanics')
79
+ 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.')
80
+
81
+ slider_values = [st.slider('πŸƒ Bluffing', 1, 10, 5),
82
+ st.slider('πŸ•΅οΈ Deduction', 1, 10, 5),
83
+ st.slider('πŸ˜‚ Humor', 1, 10, 5),
84
+ st.slider('🧠 Memory', 1, 10, 5),
85
+ st.slider('πŸ‘₯ Roleplay', 1, 10, 5)]
86
+
87
+ if st.button('🎭 Play'):
88
+ game_history_df = play_game(slider_values)
89
+ save_game_history(game_history_df)
90
+
91
+ if st.button('🎲 Run simulations'):
92
+ num_simulations = st.slider('πŸ” Number of simulations', 1, 100000, 1000)
93
+ run_simulations(num_simulations)
94
+
95
+ if st.button('πŸ“ Show all game history'):
96
+ try:
97
+ game_history_df = pd.read_csv('game_history.csv')
98
+ st.write(game_history_df)
99
+ except:
100
+ st.write('No game history found')
101
+
102
+ if st.button('πŸ“ Download game history'):
103
+ try:
104
+ game_history_df = pd.read_csv('game_history.csv')
105
+ filename = 'game_history_' + datetime.now().strftime('%Y-%m-%d %H-%M-%S') + '.csv'
106
+ game_history_df.to_csv(filename, index=False)
107
+ st.write('πŸ“ Game history downloaded!')
108
+ st.write(game_history_df)
109
+ except:
110
+ st.write('No game history found')
111
+
112
+ if st.button('πŸ“ Download simulation results'):
113
+ try:
114
+ simulation_results_df = pd.read_csv('simulation_results.csv')
115
+ filename = 'simulation_results_' + datetime.now().strftime('%Y-%m-%d %H-%M-%S') + '.csv'
116
+ simulation_results_df.to_csv(filename, index=False)
117
+ st.write('πŸ“ Simulation results downloaded!')
118
+ st.write(simulation_results_df)
119
+ except:
120
+ st.write('No simulation results found')
121
+
122
+ st.markdown("""
123
+ 🎭 Acting Game Mechanics
124
+ πŸŽ―πŸƒ Bluffing
125
+ πŸ•΅οΈ Deduction
126
+ πŸ˜‚ Humor
127
+ 🧠 Memory
128
+ πŸ‘₯ Roleplay
129
+
130
+ 🎭 Acting Game Mechanics:
131
+
132
+ Characterization: Act out your character's traits, emotions, and personality.
133
+ Improvisation: Think on your feet and come up with responses to unexpected situations.
134
+ Scripted Dialogue: Deliver lines from a pre-written script or engage in scripted conversations.
135
+ For more information on Acting Game Mechanics, you can visit the Wikipedia page on Role-playing game mechanics: https://en.wikipedia.org/wiki/Acting
136
+
137
+ πŸŽ―πŸƒ Bluffing:
138
+
139
+ Lying: Convince others that your false information is true.
140
+ Concealment: Hide your true intentions or actions.
141
+ Misdirection: Lead others to believe something different from what you are doing.
142
+ For more information on Bluffing, you can visit the Wikipedia page on Bluff (poker): https://en.wikipedia.org/wiki/Bluff_(poker)
143
+
144
+ πŸ•΅οΈ Deduction:
145
+
146
+ Clue Analysis: Examine clues to draw conclusions about a mystery.
147
+ Logical Reasoning: Use deductive reasoning to arrive at the correct solution.
148
+ Pattern Recognition: Recognize and match patterns to uncover hidden information.
149
+ For more information on Deduction, you can visit the Wikipedia page on Deduction game: https://en.wikipedia.org/wiki/Deduction
150
+
151
+ πŸ˜‚ Humor:
152
+
153
+ Parody: Use humorous exaggeration or imitation to make fun of a subject.
154
+ Puns: Play with words to create humorous meanings.
155
+ Satire: Use irony, sarcasm, and ridicule to critique a topic or individual.
156
+ For more information on Humor, you can visit the Wikipedia page on Humor: https://en.wikipedia.org/wiki/Humor
157
+
158
+ 🧠 Memory:
159
+
160
+ Recall: Remember information from previous events or interactions.
161
+ Recognition: Identify information you have seen or heard before.
162
+ Memorization: Commit information to memory for future use.
163
+ For more information on Memory, you can visit the Wikipedia page on Memory game: https://en.wikipedia.org/wiki/Memory
164
+
165
+ πŸ‘₯ Roleplay:
166
+
167
+ Character Creation: Develop a unique character with specific traits and abilities.
168
+ Storytelling: Create a narrative with the characters and the world they inhabit.
169
+ Collaborative Play: Work with others to create an immersive experience.
170
+ For more information on Roleplay, you can visit the Wikipedia page on Role-playing game: https://en.wikipedia.org/wiki/Role-playing_game
171
+
172
+ """)