File tree Expand file tree Collapse file tree 1 file changed +5
-1
lines changed
Expand file tree Collapse file tree 1 file changed +5
-1
lines changed Original file line number Diff line number Diff line change @@ -59,7 +59,10 @@ const game = () => {
5959 Math . max ( guess , 1 ) / Math . max ( secret , 1 ) ,
6060 Math . max ( secret , 1 ) / Math . max ( guess , 1 ) ,
6161 ) *
62- ( 1 - Math . abs ( secret - guess ) / maxGuess ) ; //increase level score
62+ ( 1 - Math . abs ( secret - guess ) / maxGuess ) *
63+ ( guess < secret
64+ ? guess / secret
65+ : ( maxGuess - guess + 1 ) / ( maxGuess - secret + 1 ) ) ; //increase level score
6366 attempts ++ ;
6467 if ( attempts >= maxAttempts ) {
6568 //if all attempts used reset game to initial state
@@ -85,6 +88,7 @@ const game = () => {
8588 //if guess is equal to secret number
8689 feedbackText . textContent =
8790 "You guessed correctly! +" + levelScore + " points!" ;
91+ levelScore += maxGuess ;
8892 score += Math . round (
8993 ( ( levelScore * ( maxAttempts - attempts + 1 ) ) / ( attempts + 1 ) ) *
9094 maxAttempts ,
You can’t perform that action at this time.
0 commit comments