awacke1 commited on
Commit
e08561c
Β·
1 Parent(s): 2ca74ac

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +64 -0
app.py ADDED
@@ -0,0 +1,64 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import streamlit as st
2
+ import random
3
+
4
+ # Define the player cards
5
+ player_cards = {
6
+ "Player 1": {
7
+ "name": "Player 1",
8
+ "sketch": "πŸ‘©",
9
+ "score": 0,
10
+ "mime": ""
11
+ },
12
+ "Player 2": {
13
+ "name": "Player 2",
14
+ "sketch": "πŸ‘¨",
15
+ "score": 0,
16
+ "mime": ""
17
+ }
18
+ }
19
+
20
+ # Define the game settings
21
+ num_rounds = 5
22
+
23
+ # Define the possible actions
24
+ actions = ["jump", "dance", "sing", "sleep", "laugh", "cry", "eat", "drink", "run", "swim"]
25
+
26
+ # Define the Streamlit app
27
+ def app():
28
+ st.set_page_config(page_title="Mime Game", page_icon="🎭", layout="wide")
29
+ st.title("Mime Game")
30
+ st.sidebar.write("# Player Cards")
31
+ for player, attributes in player_cards.items():
32
+ st.sidebar.write(f"## {player}")
33
+ st.sidebar.write(f"Name: {attributes['name']}")
34
+ st.sidebar.write(f"Sketch: {attributes['sketch']}")
35
+ st.sidebar.write(f"Score: {attributes['score']}")
36
+ st.sidebar.write("# Game Settings")
37
+ num_rounds = st.sidebar.slider("Number of rounds to play", 1, 10, 5)
38
+ # Start the game when the user clicks the "Play Game" button
39
+ if st.button("Play Game"):
40
+ # Play the game for the specified number of rounds
41
+ for i in range(num_rounds):
42
+ st.write(f"Round {i+1}")
43
+ for player, attributes in player_cards.items():
44
+ # Ask the player to perform an action using mime or mimicry
45
+ st.write(f"{attributes['sketch']} {attributes['name']}, it's your turn to perform an action using mime or mimicry.")
46
+ mime = st.text_input("Enter your mime/mimicry")
47
+ attributes["mime"] = mime
48
+ # Randomly select an action and ask the other player to guess it
49
+ action = random.choice(actions)
50
+ st.write(f"The action is: {action}")
51
+ for player, attributes in player_cards.items():
52
+ if attributes["mime"] == action:
53
+ attributes["score"] += 1
54
+ st.write(f"{attributes['sketch']} {attributes['name']} guessed the action correctly! πŸŽ‰")
55
+ else:
56
+ st.write(f"{attributes['sketch']} {attributes['name']} failed to guess the action.")
57
+ # Display the final scores
58
+ st.write("# Final Scores")
59
+ for player, attributes in player_cards.items():
60
+ st.write(f"{attributes['sketch']} {attributes['name']}: {attributes['score']} points")
61
+
62
+
63
+ if __name__ == "__main__":
64
+ app()