import streamlit as st import random # Page config (wide layout + nicer title) st.set_page_config(page_title="🎮 Rock Paper Scissors", layout="wide") # Custom CSS for buttons st.markdown(""" """, unsafe_allow_html=True) st.title("🪨📄✂️ Rock Paper Scissors") # Show choices as images (you can replace URLs with your own hosted images) col1, col2, col3 = st.columns(3) with col1: if st.button("🪨 Rock", key="rock"): user_choice = "Rock" with col2: if st.button("📄 Paper", key="paper"): user_choice = "Paper" with col3: if st.button("✂️ Scissors", key="scissors"): user_choice = "Scissors" try: user_choice except NameError: st.write("👉 **Choose Rock, Paper, or Scissors to start!**") else: # Computer move computer_choice = random.choice(["Rock", "Paper", "Scissors"]) # Display choices st.markdown(f"💡 **You chose:** {user_choice}") st.markdown(f"🤖 **Computer chose:** {computer_choice}") # Result logic if user_choice == computer_choice: st.info("🤝 It's a 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") ): st.balloons() st.success("🎉 You win!") else: st.error("😢 You lose!")