Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 | /** * Card Sorting Challenge Game Definition * * A single-player pattern recognition game where players arrange abacus cards * in ascending order using only visual patterns (no numbers shown). */ import { defineGame, getGameTheme } from '@/lib/arcade/game-sdk' import type { GameManifest } from '@/lib/arcade/game-sdk' import { GameComponent } from './components/GameComponent' import { CardSortingProvider } from './Provider' import type { CardSortingConfig, CardSortingMove, CardSortingState } from './types' import { cardSortingValidator } from './Validator' const manifest: GameManifest = { name: 'card-sorting', displayName: 'Card Sorting Challenge', icon: '🔢', description: 'Sort abacus cards using pattern recognition', longDescription: 'Challenge your abacus reading skills! Arrange cards in ascending order using only ' + 'the visual patterns - no numbers shown. Perfect for practicing number recognition and ' + 'developing mental math intuition.', maxPlayers: 1, // Single player only difficulty: 'Intermediate', chips: ['🧠Pattern Recognition', '🎯 Solo Challenge', '📊 Smart Scoring'], ...getGameTheme('green'), available: true, practiceBreakReady: false, // Has practiceBreakConfig but UI integration not yet complete practiceBreakConfig: { suggestedConfig: { cardCount: 5, showNumbers: false, // Practice reading the abacus! timeLimit: null, gameMode: 'solo', }, lockedFields: ['gameMode'], // Keep it solo for practice breaks minDurationMinutes: 2, maxDurationMinutes: 6, difficultyPresets: { easy: { cardCount: 5, showNumbers: true }, medium: { cardCount: 8, showNumbers: false }, hard: { cardCount: 12, showNumbers: false }, }, }, coPlay: { mode: 'none' }, } const defaultConfig: CardSortingConfig = { cardCount: 8, timeLimit: null, gameMode: 'solo', } // Config validation function function validateCardSortingConfig(config: unknown): config is CardSortingConfig { if (typeof config !== 'object' || config === null) { return false } const c = config as Record<string, unknown> // Validate cardCount if (!('cardCount' in c) || ![5, 8, 12, 15].includes(c.cardCount as number)) { return false } // Validate showNumbers if (!('showNumbers' in c) || typeof c.showNumbers !== 'boolean') { return false } // Validate timeLimit if ('timeLimit' in c) { if (c.timeLimit !== null && (typeof c.timeLimit !== 'number' || c.timeLimit < 30)) { return false } } // Validate gameMode (optional, defaults to 'solo') if ('gameMode' in c) { if (!['solo', 'collaborative', 'competitive', 'relay'].includes(c.gameMode as string)) { return false } } return true } export const cardSortingGame = defineGame<CardSortingConfig, CardSortingState, CardSortingMove>({ manifest, Provider: CardSortingProvider, GameComponent, validator: cardSortingValidator, defaultConfig, validateConfig: validateCardSortingConfig, }) |