Skip to content

Commit

Permalink
Fix and test rounds condition in playGame function
Browse files Browse the repository at this point in the history
gitclonehama committed Jun 26, 2024

Unverified

This user has not yet uploaded their public signing key.
1 parent 2896320 commit b3cc2f3
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions script.js
Original file line number Diff line number Diff line change
@@ -59,7 +59,7 @@ function playGame() {
let computerScore = 0;

let rounds = 5;
while (rounds > 0 && rounds <= 5){
while (rounds >= 1 && rounds <= 5){
let humanSelection = getHumanChoice();
let computerSelection = getComputerChoice();
let winner = playRound(humanSelection, computerSelection);
@@ -68,6 +68,7 @@ function playGame() {
}else if (winner === 'computer'){
computerScore++;
}
rounds--;
}
if (humanScore != computerScore) {
(humanScore > computerScore) ?
@@ -76,7 +77,7 @@ function playGame() {
}
}


playGame();



0 comments on commit b3cc2f3

Please sign in to comment.