Files
edueasy/lib/pedagogia/cpa-progression.ts

38 lines
1.0 KiB
TypeScript

export type CPAStage = "concrete" | "pictoric" | "abstract"
export interface CPAState {
stage: CPAStage
currentValue: number
attempts: number
mastered: boolean
}
/**
* CPA (Concrete-Pictórico-Abstracto) progression engine.
*
* - Concrete: show objects (animated) for the child to count with finger.
* - Pictoric: show images of objects, then hide them progressively.
* - Abstract: show only the number symbol → child says/selects the quantity.
*/
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,
}
}
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] }
}
return { ...state, mastered: true }
}