// console.log("script.js loaded"); function play(){ console.log("joining a public room is not supported yet"); } function createPrivateRoom() { // console.log("createPrivateRoom"); // Get the user's name from the input field const username = document.getElementById('username').value; // Validate that the username is not empty if (username.trim() === "") { alert("Please enter your name."); return; } // Save the username to sessionStorage sessionStorage.setItem('username', username); // Double-check that the username was successfully saved if (sessionStorage.getItem('username') === username) { // console.log("Username saved to sessionStorage:", username); // Redirect to the create game page after saving the username window.location.href = 'create_game.html'; } else { console.error("Failed to save username to sessionStorage"); } }