File size: 2,485 Bytes
adcb836
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
import streamlit as st
import random

# Define the player cards
player_cards = {
    "Player 1": {
        "name": "Player 1",
        "sketch": "πŸ‘©",
        "score": 0,
        "mime": ""
    },
    "Player 2": {
        "name": "Player 2",
        "sketch": "πŸ‘¨",
        "score": 0,
        "mime": ""
    }
}

# Define the game settings
num_rounds = 5

# Define the possible actions
actions = ["jump", "dance", "sing", "sleep", "laugh", "cry", "eat", "drink", "run", "swim"]

# Define the Streamlit app
def app():
    st.set_page_config(page_title="Mime Game", page_icon="🎭", layout="wide")
    st.title("Mime Game")
    st.sidebar.write("# Player Cards")
    for player, attributes in player_cards.items():
        st.sidebar.write(f"## {player}")
        st.sidebar.write(f"Name: {attributes['name']}")
        st.sidebar.write(f"Sketch: {attributes['sketch']}")
        st.sidebar.write(f"Score: {attributes['score']}")
    st.sidebar.write("# Game Settings")
    num_rounds = st.sidebar.slider("Number of rounds to play", 1, 10, 5)
    # Start the game when the user clicks the "Play Game" button
    if st.button("Play Game"):
        # Play the game for the specified number of rounds
        for i in range(num_rounds):
            st.write(f"Round {i+1}")
            for player, attributes in player_cards.items():
                # Ask the player to perform an action using mime or mimicry
                st.write(f"{attributes['sketch']} {attributes['name']}, it's your turn to perform an action using mime or mimicry.")
                mime = st.text_input("Enter your mime/mimicry")
                attributes["mime"] = mime
            # Randomly select an action and ask the other player to guess it
            action = random.choice(actions)
            st.write(f"The action is: {action}")
            for player, attributes in player_cards.items():
                if attributes["mime"] == action:
                    attributes["score"] += 1
                    st.write(f"{attributes['sketch']} {attributes['name']} guessed the action correctly! πŸŽ‰")
                else:
                    st.write(f"{attributes['sketch']} {attributes['name']} failed to guess the action.")
        # Display the final scores
        st.write("# Final Scores")
        for player, attributes in player_cards.items():
            st.write(f"{attributes['sketch']} {attributes['name']}: {attributes['score']} points")
        

if __name__ == "__main__":
    app()