Spaces:
Sleeping
Sleeping
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)
|