import streamlit as st import streamlit.components.v1 as components st.set_page_config(page_title="Galaxian Snake 3D", layout="wide") st.title("Galaxian Snake 3D") st.write("Navigate a 3D city as a snake, eating food and avoiding obstacles!") # Sliders for container size with initial 3:4 aspect ratio max_width = min(1200, st.session_state.get('window_width', 1200)) max_height = min(1600, st.session_state.get('window_height', 1600)) col1, col2 = st.columns(2) with col1: container_width = st.slider("Container Width (px)", 300, max_width, 768, step=50) with col2: container_height = st.slider("Container Height (px)", 400, max_height, 1024, step=50) # Player name input player_name = st.sidebar.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" html_code = f"""
Controls: W/A/S/D or Arrow Keys to move, R to reset
Eat yellow cubes to grow and score points!