Skip to content

Commit

Permalink
e
Browse files Browse the repository at this point in the history
  • Loading branch information
EhabElasam committed Apr 24, 2024
1 parent 3d0565c commit 6e5d8cd
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions srcs/frontend/js/tournament.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 6e5d8cd

Please sign in to comment.