Skip to content

Commit 1b6e639

Browse files
committed
Fix some code
1 parent 1cf4df9 commit 1b6e639

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

app.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ const game = () => {
99
attempts = 0; //set attempts to 0
1010
score = 0; //set score to 0
1111
levelScore = 0; //set level score to 0
12-
maxAttempts = Math.max(Math.round(level * difficultyMultiplier)); //set max attempts based on level and difficulty
12+
maxAttempts = Math.max(Math.ceil(level * difficultyMultiplier)); //set max attempts based on level and difficulty
1313
guess = 0; //set initial guess value to 0
1414
maxGuess = 2 ** level; //set max guess value to 2 raised to level
1515
secret = randomInt(1, maxGuess); //set secret value to random integer between 1 and max guess value
@@ -54,7 +54,7 @@ const game = () => {
5454
attempts = 0;
5555
score = 0;
5656
levelScore = 0; //set level score to 0
57-
maxAttempts = Math.max(Math.round(level * difficultyMultiplier)); //set max attempts based on level and difficulty
57+
maxAttempts = Math.max(Math.ceil(level * difficultyMultiplier)); //set max attempts based on level and difficulty
5858
guess = 0;
5959
maxGuess = 2 ** level;
6060
secret = randomInt(1, maxGuess);
@@ -84,7 +84,7 @@ const game = () => {
8484
level++; //increase level by 1
8585
levelScore = 0; //set level score to 0
8686
attempts = 0; //set attempts to 0
87-
maxAttempts = Math.round(level * 0.5); //increase max attempts by 0.5
87+
maxAttempts = Math.max(Math.ceil(level * difficultyMultiplier)); //set max attempts based on level and difficulty
8888
maxGuess = 2 ** level; //increase max guess number by double
8989
secret = randomInt(1, maxGuess); //get random secret guess number
9090
maxText.textContent = maxGuess;
@@ -99,7 +99,7 @@ const game = () => {
9999
let attempts = 0; //set attempts to 0
100100
let score = 0; //set score to 0
101101
let levelScore = 0; //set level score to 0
102-
let maxAttempts = Math.max(Math.round(level * difficultyMultiplier), 1); //set max attempts based on level and difficulty
102+
let maxAttempts = Math.max(Math.ceil(level * difficultyMultiplier), 1); //set max attempts based on level and difficulty
103103
let guess = 0; //set initial guess value to 0
104104
let maxGuess = 2 ** level; //set max guess value to 2 raised to level
105105
let secret = randomInt(1, maxGuess); //set secret value to random integer between 1 and max guess value

0 commit comments

Comments
 (0)