import streamlit as st st.set_page_config(page_title="Enigma Escape", page_icon="🔐") from new_api import auth, add_points, get_points, levels_done from levels import levels from nemo import EnigmaEscape st.title("Enigma Escape") st.subheader("Embark on a linguistic adventure.") st.session_state["user"] = st.session_state.get("user", None) if st.session_state["user"] is None: with st.form("login"): teamname = st.text_input("Team Name") password = st.text_input("Password", type="password") if st.form_submit_button("Login"): user = auth(teamname, password) if user is not None: st.session_state["user"] = user st.rerun() else: st.error("Invalid credentials") st.stop() st.write( "The game where you guide Bot to say specific phrases with your own cleverly tweaked instructions." "Keep it short and smart – change up the words just enough to pass the test and hit the target phrase." "Ready, set, twist!" ) @st.cache_resource def get_ee(): return EnigmaEscape(levels) with get_ee() as bot: done_levels = levels_done(st.session_state["user"], [lev.name for lev in bot.levels]) with st.expander("Choose Level >"): bot.set_level(st.radio("Level", options=range(len(levels)), format_func=lambda x: f"{levels[x].name}: {levels[x].points} points {'✅' if done_levels[x] else '❌'}")) st.markdown(f"""