File size: 3,015 Bytes
58aa986
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
# app.py
import streamlit as st
import random

# Page Configuration
st.set_page_config(
    page_title="๐ŸŽฎ Rock Paper Scissors",
    page_icon="โœŒ๏ธ",
    layout="centered"
)

# Custom CSS for Funky Styling
st.markdown("""
    <style>
        .title {
            text-align: center;
            font-size: 3em;
            font-weight: bold;
            color: #FF6F61;
            text-shadow: 2px 2px #FFE156;
        }
        .subtitle {
            text-align: center;
            font-size: 1.5em;
            color: #4CAF50;
        }
        .choice {
            font-size: 1.2em;
            font-weight: bold;
            color: #2196F3;
            text-align: center;
        }
        .result {
            text-align: center;
            font-size: 1.5em;
            font-weight: bold;
            margin-top: 20px;
        }
        .win {
            color: #4CAF50;
        }
        .lose {
            color: #F44336;
        }
        .tie {
            color: #FF9800;
        }
        .footer {
            text-align: center;
            margin-top: 50px;
            font-size: 0.9em;
            color: #777;
        }
        .play-button {
            display: block;
            margin: 20px auto;
            padding: 10px 30px;
            background: linear-gradient(135deg, #FF6F61, #FFE156);
            border: none;
            border-radius: 10px;
            font-size: 1.2em;
            font-weight: bold;
            color: #fff;
            cursor: pointer;
            box-shadow: 2px 2px 5px #aaa;
        }
    </style>
""", unsafe_allow_html=True)

# Header
st.markdown("<h1 class='title'>๐ŸŽฎ Rock Paper Scissors</h1>", unsafe_allow_html=True)
st.markdown("<p class='subtitle'>Challenge the Computer and Win the Game!</p>", unsafe_allow_html=True)

# Choices
choices = ["๐Ÿชจ Rock", "๐Ÿ“„ Paper", "โœ‚๏ธ Scissors"]

# User Input
user_choice = st.selectbox("๐Ÿค” Make Your Move:", choices)
play_button = st.button("๐Ÿ”ฅ Play Now")

# Game Logic
if play_button:
    computer_choice = random.choice(choices)

    # Determine Winner
    if user_choice == computer_choice:
        result = "๐Ÿค It's a Tie!"
        result_class = "tie"
    elif (
        (user_choice == "๐Ÿชจ Rock" and computer_choice == "โœ‚๏ธ Scissors") or
        (user_choice == "๐Ÿ“„ Paper" and computer_choice == "๐Ÿชจ Rock") or
        (user_choice == "โœ‚๏ธ Scissors" and computer_choice == "๐Ÿ“„ Paper")
    ):
        result = "๐ŸŽ‰ You Win!"
        result_class = "win"
    else:
        result = "๐Ÿ˜ข You Lose!"
        result_class = "lose"

    # Display Results
    st.markdown(f"<p class='choice'>๐Ÿ‘ค <b>Your Choice:</b> {user_choice}</p>", unsafe_allow_html=True)
    st.markdown(f"<p class='choice'>๐Ÿค– <b>Computer's Choice:</b> {computer_choice}</p>", unsafe_allow_html=True)
    st.markdown(f"<p class='result {result_class}'>{result}</p>", unsafe_allow_html=True)

# Footer
st.markdown("<p class='footer'>๐Ÿ’ป <b>Developed by ChatGPT</b></p>", unsafe_allow_html=True)