refactor: simplify scoring to remove efficiency metrics

- Remove efficiency calculation (not applicable to sudoku gameplay)
- Simplify to time + keystrokes only scoring
- New formula: score = min(1000, (1000 - time_penalty - keystroke_penalty) * difficulty_multiplier)
  - time_penalty = seconds / 10
  - keystroke_penalty = totalKeys / 2
  - difficulty multipliers: easy 1.0x, medium 1.5x, hard 2.0x
- Update difficulty levels to realistic values:
  - Easy: 25 cells removed (was 5)
  - Medium: 40 cells removed (was 50)
  - Hard: 50 cells removed (was 60)
- Update scoreboard to show only Time, Keystrokes, and Final Score (X / 1000)
- Remove editKeystrokes, optimalKeystrokes, efficiency from ScoreManager type
This commit is contained in:
2025-10-22 21:03:56 +01:00
parent 8db4455dc5
commit cfdf8100fb
6 changed files with 145 additions and 47 deletions
+3 -11
View File
@@ -8,7 +8,7 @@ function App() {
const [difficulty, setDifficulty] = useState<Difficulty>('easy');
const gameManager = useGame({ difficulty }, useKeyBindings);
const { containerRef, gameStatus, scoreManager } = gameManager;
const { timeValue, totalKeystrokes, editKeystrokes, optimalKeystrokes, efficiency, finalScore } = scoreManager;
const { timeValue, totalKeystrokes, finalScore } = scoreManager;
const formatTime = (ms: number) => {
const seconds = Math.floor(ms / 1000);
@@ -73,23 +73,15 @@ function App() {
</div>
<div className="w-px h-12 bg-muted-foreground/20" />
<div>
<div className="text-muted-foreground">Total Keys</div>
<div className="text-muted-foreground">Keystrokes</div>
<div className="text-lg font-bold">{totalKeystrokes}</div>
</div>
<div>
<div className="text-muted-foreground">Edit Keys</div>
<div className="text-lg font-bold">{editKeystrokes} / {optimalKeystrokes}</div>
</div>
<div>
<div className="text-muted-foreground">Efficiency</div>
<div className="text-lg font-bold">{efficiency}%</div>
</div>
{gameStatus === "game-won" && finalScore !== null && (
<>
<div className="w-px h-12 bg-muted-foreground/20" />
<div className="text-center">
<div className="text-muted-foreground">Final Score</div>
<div className="text-3xl font-bold bg-gradient-to-r from-green-400 to-emerald-500 bg-clip-text text-transparent">{finalScore}</div>
<div className="text-3xl font-bold bg-gradient-to-r from-green-400 to-emerald-500 bg-clip-text text-transparent">{finalScore} / 1000</div>
</div>
</>
)}