@@ -12,7 +12,7 @@ const game = () => {
1212 maxAttempts =
1313 modeButton . value === "attempts"
1414 ? attemptsLimit
15- : Math . max ( Math . ceil ( level * difficultyMultiplier ) ) ; //set max attempts based on level and difficulty
15+ : Math . max ( Math . ceil ( level * difficultyMultiplier ) , 1 ) ; //set max attempts based on level and difficulty
1616 guess = 0 ; //set initial guess value to 0
1717 maxGuess = 2 ** level ; //set max guess value to 2 raised to level
1818 secret = randomInt ( 1 , maxGuess ) ; //set secret value to random integer between 1 and max guess value
@@ -61,7 +61,7 @@ const game = () => {
6161 maxAttempts =
6262 modeButton . value === "attempts"
6363 ? attemptsLimit
64- : Math . max ( Math . ceil ( level * difficultyMultiplier ) ) ; //set max attempts based on level and difficulty
64+ : Math . max ( Math . ceil ( level * difficultyMultiplier ) , 1 ) ; //set max attempts based on level and difficulty
6565 guess = 0 ;
6666 maxGuess = 2 ** level ;
6767 secret = randomInt ( 1 , maxGuess ) ;
@@ -94,7 +94,7 @@ const game = () => {
9494 maxAttempts =
9595 modeButton . value === "attempts"
9696 ? attemptsLimit
97- : Math . max ( Math . ceil ( level * difficultyMultiplier ) ) ; //set max attempts based on level and difficulty
97+ : Math . max ( Math . ceil ( level * difficultyMultiplier ) , 1 ) ; //set max attempts based on level and difficulty
9898 maxGuess = 2 ** level ; //increase max guess number by double
9999 secret = randomInt ( 1 , maxGuess ) ; //get random secret guess number
100100 maxText . textContent = maxGuess ;
0 commit comments