feat: add 7th guess with 60s unlock and update docs
This commit is contained in:
@@ -17,6 +17,7 @@ export interface Statistics {
|
||||
solvedIn4: number;
|
||||
solvedIn5: number;
|
||||
solvedIn6: number;
|
||||
solvedIn7: number;
|
||||
failed: number;
|
||||
}
|
||||
|
||||
@@ -64,7 +65,12 @@ export function useGameState() {
|
||||
// Load statistics
|
||||
const storedStats = localStorage.getItem(STATS_KEY);
|
||||
if (storedStats) {
|
||||
setStatistics(JSON.parse(storedStats));
|
||||
const parsedStats = JSON.parse(storedStats);
|
||||
// Migration for existing stats without solvedIn7
|
||||
if (parsedStats.solvedIn7 === undefined) {
|
||||
parsedStats.solvedIn7 = 0;
|
||||
}
|
||||
setStatistics(parsedStats);
|
||||
} else {
|
||||
const newStats: Statistics = {
|
||||
solvedIn1: 0,
|
||||
@@ -73,6 +79,7 @@ export function useGameState() {
|
||||
solvedIn4: 0,
|
||||
solvedIn5: 0,
|
||||
solvedIn6: 0,
|
||||
solvedIn7: 0,
|
||||
failed: 0,
|
||||
};
|
||||
setStatistics(newStats);
|
||||
@@ -98,6 +105,7 @@ export function useGameState() {
|
||||
case 4: newStats.solvedIn4++; break;
|
||||
case 5: newStats.solvedIn5++; break;
|
||||
case 6: newStats.solvedIn6++; break;
|
||||
case 7: newStats.solvedIn7++; break;
|
||||
}
|
||||
} else {
|
||||
newStats.failed++;
|
||||
@@ -112,7 +120,7 @@ export function useGameState() {
|
||||
|
||||
const newGuesses = [...gameState.guesses, guess];
|
||||
const isSolved = correct;
|
||||
const isFailed = !correct && newGuesses.length >= 6;
|
||||
const isFailed = !correct && newGuesses.length >= 7;
|
||||
|
||||
const newState = {
|
||||
...gameState,
|
||||
|
||||
Reference in New Issue
Block a user