From afce474e0df845a2d77806d8d3cca79deffd701a Mon Sep 17 00:00:00 2001 From: Andre Padez Date: Sun, 2 Nov 2025 17:16:10 +0000 Subject: [PATCH] Revert "feat: add intermediate efficiency calculation for real-time feedback" This reverts commit 7352eff726cbeb1e0b18d02e0d33dd5478d50ab7. --- src/useScore/useScore.ts | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/src/useScore/useScore.ts b/src/useScore/useScore.ts index e1621f6..8f58a18 100644 --- a/src/useScore/useScore.ts +++ b/src/useScore/useScore.ts @@ -51,15 +51,9 @@ export function useScore({ board, hero, gameStatusManager, keyManager, gameOver const optimalSteps = optimalRef.current; // Efficiency: 100% = optimal play, 0% = worst case - // - If keystrokes <= optimalSteps: intermediate calc showing progress toward goal - // Formula: (keystrokes / optimalSteps) * 100 (shows how far along optimal path) - // - If keystrokes > optimalSteps: inverse calc showing how much over optimal - // Formula: (optimalSteps / keystrokes) * 100 (shows excess usage) - // Result clamped to 0-100 - const efficiency = optimalSteps > 0 && keystrokes > 0 - ? keystrokes <= optimalSteps - ? Math.round((keystrokes / optimalSteps) * 100) - : Math.max(0, Math.round((optimalSteps / keystrokes) * 100)) + // Formula: (optimalSteps / keystrokes) * 100, clamped to 0-100 + const efficiency = optimalSteps > 0 && keystrokes > 0 + ? Math.max(0, Math.min(100, Math.round((optimalSteps / keystrokes) * 100))) : 100; // Check custom gameOver condition if provided