we already know that everyone doesn't have the...

same score so we can stop iterating.
This commit is contained in:
Holly Stubbs 2021-09-03 21:26:49 +01:00
parent b955d19811
commit 1dc1742fa0

View file

@ -17,7 +17,10 @@ module.exports = class {
let everyoneHasTheSameScore = true; let everyoneHasTheSameScore = true;
for (let i = 0; i < playerScores.length; i++) { for (let i = 0; i < playerScores.length; i++) {
if (playerScores[i].score != lowestScore) everyoneHasTheSameScore = false; if (playerScores[i].score != lowestScore) {
everyoneHasTheSameScore = false;
break;
}
} }
// Everyone has the same score, we don't need to kick anyone // Everyone has the same score, we don't need to kick anyone