All files / web/src/arcade-games/constant-explorer index.ts

100% Statements 82/82
100% Branches 0/0
100% Functions 0/0
100% Lines 82/82

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 831x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x  
/**
 * Constant Explorer — Practice Break "Game"
 *
 * Embeds the number line's narrated constant explorations (pi, phi, e, etc.)
 * as a calm, contemplative practice break option. Not a game in the traditional
 * sense — no moves, no scoring — but registered in the game system so it
 * appears alongside arcade games in the break selection UI.
 */
 
import { defineGame, getGameTheme } from '@/lib/arcade/game-sdk'
import type { GameManifest } from '@/lib/arcade/game-sdk'
import { ConstantExplorerGame } from './GameComponent'
import { ConstantExplorerProvider } from './Provider'
import type { ConstantExplorerConfig, ConstantExplorerMove, ConstantExplorerState } from './types'
import { constantExplorerValidator } from './Validator'
 
const manifest: GameManifest = {
  name: 'constant-explorer',
  displayName: 'Math Discovery',
  icon: '\uD83D\uDD2D', // telescope
  description: 'Watch a beautiful math constant come to life',
  longDescription:
    'A narrated exploration of famous mathematical constants like pi, the golden ratio, ' +
    "and Euler's number. Watch animated visualizations on the number line while a narrator " +
    'explains what makes each constant special. A calm, contemplative break from practice.',
  maxPlayers: 1,
  difficulty: 'Beginner',
  chips: ['Discovery', 'Constants', 'Narrated'],
  ...getGameTheme('teal'),
  available: true,
  practiceBreakReady: true,
  practiceBreakConfig: {
    suggestedConfig: {
      constantId: 'random',
    },
    lockedFields: [],
    minDurationMinutes: 1,
    maxDurationMinutes: 5,
    difficultyPresets: {
      easy: { constantId: 'random' },
      medium: { constantId: 'random' },
      hard: { constantId: 'random' },
    },
    fieldConfig: {
      constantId: {
        label: 'Constant',
        type: 'select',
        options: [
          { value: 'random', label: 'Random' },
          { value: 'balance', label: 'Balance (least watched)' },
          { value: 'pi', label: '\u03C0 Pi' },
          { value: 'e', label: "e Euler's Number" },
          { value: 'phi', label: '\u03C6 Golden Ratio' },
          { value: 'sqrt2', label: '\u221A2 Square Root of 2' },
          { value: 'sqrt3', label: '\u221A3 Square Root of 3' },
          { value: 'tau', label: '\u03C4 Tau' },
          { value: 'gamma', label: '\u03B3 Euler-Mascheroni' },
          { value: 'ln2', label: 'ln2 Natural Log of 2' },
          { value: 'ramanujan', label: '1/\u03C0 Ramanujan' },
          { value: 'feigenbaum', label: '\u03B4 Feigenbaum' },
        ],
      },
    },
  },
  coPlay: { mode: 'none' },
}
 
const defaultConfig: ConstantExplorerConfig = {
  constantId: 'random',
}
 
export const constantExplorerGame = defineGame<
  ConstantExplorerConfig,
  ConstantExplorerState,
  ConstantExplorerMove
>({
  manifest,
  Provider: ConstantExplorerProvider,
  GameComponent: ConstantExplorerGame,
  validator: constantExplorerValidator,
  defaultConfig,
})