export type CPAStage = "concrete" | "pictoric" | "abstract" export type GalperinStage = "hand" | "external_speech" | "inner_speech" | "mental" | "mastered" export interface CPAState { stage: CPAStage currentValue: number attempts: number mastered: boolean galperinStage: GalperinStage } export function getCPAProgression(skillValue: number): CPAStage[] { return ["concrete", "pictoric", "abstract"] } export function createCPAState(value: number): CPAState { return { stage: "concrete", currentValue: value, attempts: 0, mastered: false, galperinStage: "hand", } } export function advanceStage(state: CPAState): CPAState { const stages: CPAStage[] = ["concrete", "pictoric", "abstract"] const currentIdx = stages.indexOf(state.stage) if (currentIdx < stages.length - 1) { return { ...state, stage: stages[currentIdx + 1], galperinStage: "hand" } } return { ...state, mastered: true } } export function advanceGalperin(stage: GalperinStage): GalperinStage { const order: GalperinStage[] = ["hand", "external_speech", "inner_speech", "mental", "mastered"] const idx = order.indexOf(stage) if (idx < order.length - 1) return order[idx + 1] return "mastered" } export function getGalperinInstruction(stage: GalperinStage, value: number): string { switch (stage) { case "hand": return `Tocá ${value} cosas con tu dedo` case "external_speech": return "Contá en voz alta mientras tocás" case "inner_speech": return "Ahora contá susurrando" case "mental": return "Pensá el número en tu cabeza y señalalo" case "mastered": return "¡Ya sabés este número!" } }