# 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(""" """, unsafe_allow_html=True) # Header st.markdown("
Challenge the Computer and Win the Game!
", 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"👤 Your Choice: {user_choice}
", unsafe_allow_html=True) st.markdown(f"🤖 Computer's Choice: {computer_choice}
", unsafe_allow_html=True) st.markdown(f"{result}
", unsafe_allow_html=True) # Footer st.markdown(" ", unsafe_allow_html=True)