import streamlit as st import random st.set_page_config(page_title="Mini Game Arcade", layout="wide") st.markdown("", unsafe_allow_html=True) # Inject CSS to style left column st.markdown(""" """, unsafe_allow_html=True) st.markdown("## 🎮 Mini Game Arcade") # --- Game Titles --- game_list = [ "Rock Paper Scissors", "Guess the Number", "Word Scramble", "Emoji Quiz", "Score Tracker", "Dice Roller", "Coin Toss", "Math Quiz", "Hangman", "Color Guess" ] # --- Layout Columns --- left_col, right_col = st.columns([1, 2]) selected_game = None # --- Left: Game Selection (with background) --- with left_col: st.markdown('
', unsafe_allow_html=True) st.subheader("đŸ•šī¸ Choose a Game") for game_name in game_list: if st.button(game_name, key=game_name): selected_game = game_name st.session_state["selected_game"] = selected_game st.markdown('
', unsafe_allow_html=True) # Keep selection across reruns if "selected_game" in st.session_state: selected_game = st.session_state["selected_game"] # --- Right: Game Area --- with right_col: if not selected_game: st.info("👈 Select a game from the left to start playing.") elif selected_game == "Rock Paper Scissors": st.header("đŸĒ¨đŸ“„âœ‚ī¸ Rock Paper Scissors") options = ["Rock", "Paper", "Scissors"] user_choice = st.selectbox("Choose your move:", options) if st.button("Play"): ai_choice = random.choice(options) st.write(f"Computer chose: {ai_choice}") if user_choice == ai_choice: st.success("It's a tie!") elif (user_choice == "Rock" and ai_choice == "Scissors") or \ (user_choice == "Paper" and ai_choice == "Rock") or \ (user_choice == "Scissors" and ai_choice == "Paper"): st.success("You win!") else: st.error("You lose!") # Add remaining games here as before... # (Guess the Number, Word Scramble, etc. — same logic as before)