diff --git a/srcs/frontend/js/tournament.js b/srcs/frontend/js/tournament.js index 8b292c7..6f0755f 100644 --- a/srcs/frontend/js/tournament.js +++ b/srcs/frontend/js/tournament.js @@ -45,8 +45,9 @@ function startTournament(playerCount) { const players = []; for (let i = 1; i <= playerCount; i++) { let playerName = prompt(`Enter name for Player ${i}:`); - playerName = playerName.replace(/[^a-z0-9]/gi, '').substring(0, 7); - players.push(playerName || `Player ${i}`); + if (playerName) + playerName = playerName.replace(/[^a-z0-9]/gi, '').substring(0, 7); + players.push(playerName || `X ${i}`); } shuffleArray(players); showTournament(players, playerCount);