From 55f88affa5d1bdffa1d5f14ef846b0af650e5563 Mon Sep 17 00:00:00 2001 From: Chime-txt <122952454+Chime-txt@users.noreply.github.com> Date: Tue, 30 Apr 2024 01:41:02 +0000 Subject: [PATCH] Chime's Commit #10 - Hopefully added a fix to the ready queue in index.html - Added more values in the PlayerType to have the option to have more than 2 players --- html/index.html | 3 ++- src/main/java/uta/cse3310/PlayerType.java | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/html/index.html b/html/index.html index 41e1b13..e8c524c 100644 --- a/html/index.html +++ b/html/index.html @@ -353,7 +353,7 @@

Player 2 Name

function readyqueue() { var playerDoesExist = 0; const playerName = document.getElementById("playerName").value.trim(); // Get the player's name from the input field - for(i = 0; i < playerNames.length; i++) { + for(i = 0; i <= playerNames.length; i++) { if ((playerName!=playerNames[i]) && (i == playerNames.length)) { const playerQueue = document.getElementById('playerQueue'); const li = document.createElement('li'); @@ -364,6 +364,7 @@

Player 2 Name

break; } else if (playerName==playerNames[i]) { console.error('Player name already in the ready queue.'); + playerDoesExist = 1; break; } } diff --git a/src/main/java/uta/cse3310/PlayerType.java b/src/main/java/uta/cse3310/PlayerType.java index 87619ae..fc1370a 100644 --- a/src/main/java/uta/cse3310/PlayerType.java +++ b/src/main/java/uta/cse3310/PlayerType.java @@ -3,6 +3,6 @@ // A player can be an X or an O public enum PlayerType { - NOPLAYER, XPLAYER, OPLAYER + NOPLAYER, XPLAYER, OPLAYER, PLAYER1, PLAYER2, PLAYER3, PLAYER4 }