Muthuraja18 commited on
Commit
c628f8e
·
verified ·
1 Parent(s): 7c3bf03

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -0
app.py CHANGED
@@ -775,6 +775,16 @@ def home_page():
775
 
776
  # ----------------------------
777
  # Play Page
 
 
 
 
 
 
 
 
 
 
778
  def play_page():
779
  # Get active game and username
780
  gid = st.session_state.get('active_game')
 
775
 
776
  # ----------------------------
777
  # Play Page
778
+ if 'active_game' not in st.session_state:
779
+ games = unified_get("games") or {}
780
+ if games:
781
+ first_game = list(games.keys())[0]
782
+ st.session_state['active_game'] = first_game
783
+ else:
784
+ st.warning("No games exist yet. Please create a game first.")
785
+
786
+ if 'username' not in st.session_state:
787
+ st.session_state['username'] = "Guest" # temporary default username
788
  def play_page():
789
  # Get active game and username
790
  gid = st.session_state.get('active_game')