feat: add shared types and difficulty constants

This commit is contained in:
2026-04-07 20:50:16 +07:00
parent 8f1c71b439
commit 932325ffa9
2 changed files with 56 additions and 0 deletions
+32
View File
@@ -0,0 +1,32 @@
import { Difficulty, DifficultyConfig } from "../types";
export const DIFFICULTY_CONFIGS: Record<Difficulty, DifficultyConfig> = {
easy: {
rows: 4,
cols: 6,
timerSeconds: 300,
hints: 5,
shuffles: 3,
pairCount: 12,
},
medium: {
rows: 6,
cols: 8,
timerSeconds: 240,
hints: 3,
shuffles: 2,
pairCount: 24,
},
hard: {
rows: 8,
cols: 10,
timerSeconds: 180,
hints: 1,
shuffles: 1,
pairCount: 40,
},
};
export const BASE_MATCH_SCORE = 100;
export const SPEED_BONUS_MAX = 50;
export const SPEED_BONUS_WINDOW_MS = 5000;
+24
View File
@@ -0,0 +1,24 @@
export type Difficulty = "easy" | "medium" | "hard";
export interface Point {
row: number;
col: number;
}
export type GameStatus = "menu" | "playing" | "paused" | "won" | "lost";
export interface DifficultyConfig {
rows: number;
cols: number;
timerSeconds: number;
hints: number;
shuffles: number;
pairCount: number;
}
export interface TileData {
emoji: string;
id: number;
}
export type Board = (TileData | null)[][];