Internal ID: #60
Imported from ISSUES.md via scripts/import-issues.mjs.
Problem Statement. frontend/store/useGameStore.js::completePuzzle:
const difficultyLevels = ["easy", "medium", "difficult", "advanced"];
...
nextPuzzleIndex = (currentPuzzleIndex + 1) % 5;
if (isLevelCompleted) {
...
if (currentIndex < difficultyLevels.length - 1) {
nextDifficulty = difficultyLevels[currentIndex + 1];
nextPuzzleIndex = 0;
}
}
const newScore = score + 100;
Three problems:
- Constant difficulty list; backend/Smart-contract uses different names.
100 always added regardless of level.
- The level wrap-around
+ 1 % 5 happens before the level-completed check, so a player who just completed level n has nextPuzzleIndex = (4 + 1) % 5 = 0 by accident — this works!
Why it matters. Console vs back-end/client drift makes the leaderboard inconsistent. Score inflation is too easy.
Expected Outcome.
- Difficulty list and scoring pulled from API.
- Server is authoritative.
Acceptance Criteria.
- A test simulates: client says "completed level 3," server says "easier to next level allowed," and client applies correctly.
Implementation Notes.
- Use TanStack Query to fetch authoritative level config.
Files / modules affected.
frontend/store/useGameStore.js
- New:
frontend/services/gameApi.js
Dependencies. None.
Difficulty / Effort. Medium / M (≈ 4 hours).
Labels. area:frontend, architecture, priority:high
Problem Statement.
frontend/store/useGameStore.js::completePuzzle:Three problems:
100always added regardless of level.+ 1 % 5happens before the level-completed check, so a player who just completed levelnhasnextPuzzleIndex = (4 + 1) % 5 = 0by accident — this works!Why it matters. Console vs back-end/client drift makes the leaderboard inconsistent. Score inflation is too easy.
Expected Outcome.
Acceptance Criteria.
Implementation Notes.
Files / modules affected.
frontend/store/useGameStore.jsfrontend/services/gameApi.jsDependencies. None.
Difficulty / Effort. Medium / M (≈ 4 hours).
Labels.
area:frontend,architecture,priority:high