File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -67,6 +67,7 @@ let statGuessActive = false;
6767// Initialize stat guess mode toggle
6868statModeToggle . checked = localStorage . getItem ( "statGuessMode" ) === "true" ;
6969isStatGuessMode = statModeToggle . checked ;
70+ setupGame ( ) ;
7071
7172// Add event listener for stat mode toggle
7273statModeToggle . addEventListener ( "change" , ( ) => {
@@ -424,8 +425,11 @@ function updateStats(isWin, attempts) {
424425 stats . currentStreak ++ ;
425426 stats . maxStreak = Math . max ( stats . maxStreak , stats . currentStreak ) ;
426427 stats . guessDistribution [ attempts - 1 ] ++ ;
427- } else {
428+ } else { // Player lost
428429 stats . currentStreak = 0 ;
430+ // Add this line to record the loss in the guess distribution
431+ // 'attempts' will be maxAttempts when isWin is false, as per the calling context in submitGuess
432+ stats . guessDistribution [ attempts - 1 ] ++ ;
429433 }
430434 localStorage . setItem ( "stats" , JSON . stringify ( stats ) ) ;
431435 displayStats ( ) ;
You can’t perform that action at this time.
0 commit comments