- Add useTimer hook for elapsed time tracking - Add useScore hook with comprehensive metrics: - Total keystrokes (all keys) - Edit keystrokes (only editing keys) - Optimal keystrokes (empty cells × 3) - Efficiency percentage (optimal/edit × 100) - Final score (70% efficiency + 30% time-based) - Win condition detects board completion only in normal mode - Track all keystrokes with timestamps in useGame - Update example app with full scoreboard display - Expose boardRef in BoardManager for state checking - Adjust easy mode to 5 removed cells for testing
27 lines
837 B
TypeScript
27 lines
837 B
TypeScript
import type { RefObject } from 'react';
|
|
import type { GameStatus, GameStatusManager } from './useGameStatus/types';
|
|
import type { CursorManager } from './useCursor/types';
|
|
import type { ScoreManager } from './useScore/types';
|
|
|
|
export type Difficulty = 'easy' | 'medium' | 'hard';
|
|
|
|
export type { GameStatus, GameStatusManager };
|
|
export type { CursorManager, Coord } from './useCursor/types';
|
|
export type { ScoreManager } from './useScore/types';
|
|
|
|
export type GameOptions = {
|
|
difficulty?: Difficulty;
|
|
};
|
|
|
|
export type KeyLogEntry = { key: string; timestamp: number };
|
|
|
|
export type GameManager = {
|
|
containerRef: RefObject<HTMLDivElement | null>;
|
|
renderBoard: () => void;
|
|
cursor: CursorManager;
|
|
scoreManager: ScoreManager;
|
|
keyLog: KeyLogEntry[];
|
|
clearKeyLog: () => void;
|
|
getKeyLog: () => KeyLogEntry[];
|
|
} & GameStatusManager;
|