starting new structure

This commit is contained in:
2025-10-19 17:59:12 +01:00
parent 4c6bd0d4d4
commit d0a51d7079
50 changed files with 2219 additions and 432 deletions
+32 -17
View File
@@ -1,20 +1,35 @@
import { useGame } from "./useGame";
import { useScore } from "./useScore";
import type { RefObject } from 'react';
export type UseGameType = ReturnType<typeof useGame>;
export type UseScoreType = ReturnType<typeof useScore>;
export type { Coord, SudokuBoard, SudokuCell, Difficulty } from './useBoard/types';
export type { CursorManager, CursorMode, GameKeyManager, KeyLogEntry } from './useCursor/types';
export type { GameStatus, GameStatusManager } from './useGameStatus/types';
export type { ScoreManager, TimerManager } from './useScore/types';
export type {
Difficulty,
DifficultyName,
} from "./lib/Sudoku";
export type GameOptions = {
difficulty?: Difficulty;
};
export type GamePhase = "idle" | "playing";
export type PlayStatus = "started" | "game-over" | "game-won";
export type GameStatus = "waiting" | "started" | "game-over" | "game-won";
export const isPlaying = (status: GameStatus): status is PlayStatus =>
status === "started" || status === "game-over" || status === "game-won";
export const getGamePhase = (status: GameStatus): GamePhase =>
status === "waiting" ? "idle" : "playing";
export type GameManager = {
containerRef: RefObject<HTMLDivElement | null>;
renderBoard: () => void;
gameStatus: GameStatus;
setGameStatus: (status: GameStatus) => void;
startGame: () => void;
togglePause: (pause?: boolean) => void;
quitGame: () => void;
cursor: CursorManager;
scoreManager: ScoreManager;
keyLog: KeyLogEntry[];
clearKeyLog: () => void;
getKeyLog: () => KeyLogEntry[];
board: {
generateBoard: (difficulty: Difficulty) => void;
solveBoard: () => boolean;
resetBoard: () => void;
getCell: (row: number, col: number) => any;
setCell: (row: number, col: number, value: string) => boolean;
canEditCell: (row: number, col: number) => boolean;
isComplete: () => boolean;
isFullyValid: () => boolean;
};
};