import streamlit as st from streamlit.components.v1 import html # Set Streamlit to wide mode st.set_page_config(layout="wide", page_title="Galaxian Snake 3D") # Player name input in Streamlit with st.sidebar: st.title("Galaxian Snake 3D") player_name = st.text_input("Enter 3-letter name (e.g., ABC):", max_chars=3, value="XYZ").upper() if len(player_name) != 3 or not player_name.isalpha(): st.warning("Please enter a valid 3-letter name using A-Z.") player_name = "XYZ" # Default if invalid st.write("**Controls:**") st.write("- WASD or Arrow Keys to move") st.write("- R to reset after game over") st.write("**Objective:**") st.write("- Eat food (yellow cubes) to grow and score") st.write("- Avoid buildings and creatures") st.write("**Scoring:**") st.write("- 2 pts for doubling length") st.write("- +2 pts/sec, +4 pts/sec after 10 units") st.write("- 10 pt bonus at 10+ units") st.write("- Game ends at 5 minutes") # Define the HTML content with Three.js, injecting player_name game_html = f"""
Controls: W/A/S/D or Arrow Keys to move, R to reset
Eat yellow cubes to grow and score points!