Revert "feat: add intermediate efficiency calculation for real-time feedback"
This reverts commit 7352eff726.
This commit is contained in:
@@ -51,15 +51,9 @@ export function useScore({ board, hero, gameStatusManager, keyManager, gameOver
|
|||||||
|
|
||||||
const optimalSteps = optimalRef.current;
|
const optimalSteps = optimalRef.current;
|
||||||
// Efficiency: 100% = optimal play, 0% = worst case
|
// Efficiency: 100% = optimal play, 0% = worst case
|
||||||
// - If keystrokes <= optimalSteps: intermediate calc showing progress toward goal
|
// Formula: (optimalSteps / keystrokes) * 100, clamped to 0-100
|
||||||
// Formula: (keystrokes / optimalSteps) * 100 (shows how far along optimal path)
|
const efficiency = optimalSteps > 0 && keystrokes > 0
|
||||||
// - If keystrokes > optimalSteps: inverse calc showing how much over optimal
|
? Math.max(0, Math.min(100, Math.round((optimalSteps / keystrokes) * 100)))
|
||||||
// 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))
|
|
||||||
: 100;
|
: 100;
|
||||||
|
|
||||||
// Check custom gameOver condition if provided
|
// Check custom gameOver condition if provided
|
||||||
|
|||||||
Reference in New Issue
Block a user