fix(worksheets): align makeHarder fallback with spec priorities

Fix makeHarder fallback to match spec (line 865):
"makeHarder: Increase complexity first (regrouping), then reduce support (scaffolding)"

Previous implementation tried scaffolding first, which was backwards.

Pedagogical rationale: Give harder problems first while students still
have scaffolds, then remove scaffolds once they've practiced with
harder problems.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Thomas Hallock
2025-11-07 13:53:40 -06:00
parent 878cf02511
commit a170209b2f

View File

@@ -856,21 +856,22 @@ export function makeHarder(
}
// Fallback: If we couldn't move toward preset, try any valid harder move
// Per spec: makeHarder should increase complexity (regrouping) first, then reduce support (scaffolding)
if (!moved) {
// Try increasing scaffolding (removing help) first
if (
// Try increasing regrouping (complexity) first
if (newRegroupingIdx < REGROUPING_PROGRESSION.length - 1) {
newRegroupingIdx++
newScaffoldingIdx = clampScaffoldingToValidRange(newRegroupingIdx, newScaffoldingIdx)
moved = true
}
// Otherwise try increasing scaffolding (removing help)
else if (
newScaffoldingIdx < SCAFFOLDING_PROGRESSION.length - 1 &&
isValidCombination(newRegroupingIdx, newScaffoldingIdx + 1)
) {
newScaffoldingIdx++
moved = true
}
// Otherwise try increasing regrouping
else if (newRegroupingIdx < REGROUPING_PROGRESSION.length - 1) {
newRegroupingIdx++
newScaffoldingIdx = clampScaffoldingToValidRange(newRegroupingIdx, newScaffoldingIdx)
moved = true
}
}
}