soroban-abacus-flashcards/apps/web/src/app/create/worksheets
Thomas Hallock 3bf127f344 feat: add precision controls for tiny regions in Know Your World
Implement automatic cursor dampening, super zoom on hover, and quick-escape to make sub-pixel regions (Gibraltar 0.08px, Jersey 0.82px) clickable. Fix crosshair accuracy to match dampened cursor position, add excluded region visualization (gray pre-labeled), and increase unfound region contrast (0.3→0.7 opacity).

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-19 18:06:34 -06:00
..
__tests__ feat: add responsive page button layout with dynamic dropdown 2025-11-18 11:08:45 -06:00
addition
components feat: add precision controls for tiny regions in Know Your World 2025-11-19 18:06:34 -06:00
constants fix: consolidate worksheet validation constants and increase MAX_PAGES to 100 2025-11-12 08:57:00 -06:00
hooks fix: respect operator-specific scaffolding in mastery+mixed mode 2025-11-18 06:40:35 -06:00
typstHelpers feat: add responsive page button layout with dynamic dropdown 2025-11-18 11:08:45 -06:00
utils feat: add responsive page button layout with dynamic dropdown 2025-11-18 11:08:45 -06:00
AI_GRADING_EXECUTIVE_SUMMARY.md fix: align share persistence with user session logic 2025-11-11 12:03:32 -06:00
AI_MASTERY_ASSESSMENT_PLAN.md fix: align share persistence with user session logic 2025-11-11 12:03:32 -06:00
CONFIG_SCHEMA_GUIDE.md
HYBRID_LAYOUT_PLAN.md fix: align share persistence with user session logic 2025-11-11 12:03:32 -06:00
IMPLEMENTATION_PLAN_WITH_PANELS.md fix: align share persistence with user session logic 2025-11-11 12:03:32 -06:00
IMPLEMENTATION_STATUS.md fix: align share persistence with user session logic 2025-11-11 12:03:32 -06:00
LAYOUT_REDESIGN_PROPOSALS.md fix: align share persistence with user session logic 2025-11-11 12:03:32 -06:00
MASTERY_DEPENDENCIES.md fix: align share persistence with user session logic 2025-11-11 12:03:32 -06:00
MASTERY_EXECUTIVE_SUMMARY.md fix: align share persistence with user session logic 2025-11-11 12:03:32 -06:00
MASTERY_PROGRESSION_EXAMPLE.md fix: align share persistence with user session logic 2025-11-11 12:03:32 -06:00
MASTERY_REDESIGN_PLAN.md fix: align share persistence with user session logic 2025-11-11 12:03:32 -06:00
MASTERY_SIMPLIFIED.md fix: align share persistence with user session logic 2025-11-11 12:03:32 -06:00
MASTERY_SYSTEM_PLAN.md fix: align share persistence with user session logic 2025-11-11 12:03:32 -06:00
MASTERY_UI_PLAN.md fix: align share persistence with user session logic 2025-11-11 12:03:32 -06:00
MASTERY_V2_ARCHITECTURE.md fix: align share persistence with user session logic 2025-11-11 12:03:32 -06:00
OPERATOR_SPECIFIC_SETTINGS.md docs: add operator-specific settings architecture & refactoring plan 2025-11-17 18:24:07 -06:00
PROBLEM_GENERATION_ARCHITECTURE.md docs: comprehensive problem generation documentation 2025-11-12 09:19:20 -06:00
PROMPTING_STRATEGY.md fix: align share persistence with user session logic 2025-11-11 12:03:32 -06:00
PUBLICATION_PLAN.md fix: align share persistence with user session logic 2025-11-11 12:03:32 -06:00
README.md docs: add operator-specific settings architecture & refactoring plan 2025-11-17 18:24:07 -06:00
README_CONFIG_PERSISTENCE.md fix: refactor worksheet config persistence to blacklist approach + Storybook stories 2025-11-13 11:26:36 -06:00
REFACTORING_PLAN.md fix: align share persistence with user session logic 2025-11-11 12:03:32 -06:00
SHARE_PERSISTENCE_FIX_PLAN.md fix: align share persistence with user session logic 2025-11-11 12:03:32 -06:00
SMART_DIFFICULTY_SPEC.md fix: align share persistence with user session logic 2025-11-11 12:03:32 -06:00
SUBTRACTION_AND_OPERATOR_PLAN.md fix: align share persistence with user session logic 2025-11-11 12:03:32 -06:00
SUBTRACTION_SCAFFOLDING_ANALYSIS.md fix: align share persistence with user session logic 2025-11-11 12:03:32 -06:00
Screenshot 2025-11-10 at 08.43.34.png fix: align share persistence with user session logic 2025-11-11 12:03:32 -06:00
Screenshot 2025-11-10 at 08.43.43.png fix: align share persistence with user session logic 2025-11-11 12:03:32 -06:00
Screenshot 2025-11-10 at 08.43.50.png fix: align share persistence with user session logic 2025-11-11 12:03:32 -06:00
Screenshot 2025-11-10 at 08.55.31.png fix: align share persistence with user session logic 2025-11-11 12:03:32 -06:00
Screenshot 2025-11-10 at 08.55.36.png fix: align share persistence with user session logic 2025-11-11 12:03:32 -06:00
Screenshot 2025-11-10 at 08.55.42.png fix: align share persistence with user session logic 2025-11-11 12:03:32 -06:00
Screenshot 2025-11-10 at 08.55.47.png fix: align share persistence with user session logic 2025-11-11 12:03:32 -06:00
Screenshot 2025-11-10 at 08.55.52.png fix: align share persistence with user session logic 2025-11-11 12:03:32 -06:00
Screenshot 2025-11-10 at 08.55.57.png fix: align share persistence with user session logic 2025-11-11 12:03:32 -06:00
TWO_MODE_IMPLEMENTATION_PLAN.md fix: align share persistence with user session logic 2025-11-11 12:03:32 -06:00
TWO_MODE_SYSTEM_PLAN.md fix: align share persistence with user session logic 2025-11-11 12:03:32 -06:00
TYPST_HELPERS_REFACTOR_PLAN.md fix: align share persistence with user session logic 2025-11-11 12:03:32 -06:00
USER_WARNING_IMPROVEMENTS.md docs: comprehensive problem generation documentation 2025-11-12 09:19:20 -06:00
UX_EXECUTIVE_SUMMARY.md fix: align share persistence with user session logic 2025-11-11 12:03:32 -06:00
UX_UI_PLAN.md fix: align share persistence with user session logic 2025-11-11 12:03:32 -06:00
WORKSHEET_VIRTUALIZATION_PROPOSALS.md fix: align share persistence with user session logic 2025-11-11 12:03:32 -06:00
complexityLevels.ts feat: add worksheet generation core logic and helpers 2025-11-11 11:49:27 -06:00
config-schemas.ts feat: add responsive page button layout with dynamic dropdown 2025-11-18 11:08:45 -06:00
difficultyProfiles.ts feat: add responsive page button layout with dynamic dropdown 2025-11-18 11:08:45 -06:00
displayRules.ts fix: add 'auto' to RuleMode type to prevent undefined display values 2025-11-18 07:24:04 -06:00
generatePreview.ts feat: add responsive page button layout with dynamic dropdown 2025-11-18 11:08:45 -06:00
manualModePresets.ts feat: add worksheet generation core logic and helpers 2025-11-11 11:49:27 -06:00
masteryLogic.ts feat: add responsive page button layout with dynamic dropdown 2025-11-18 11:08:45 -06:00
page.tsx fix: enable virtualization for worksheet preview by limiting SSR to 3 pages 2025-11-12 10:41:57 -06:00
problemAnalysis.ts feat: add worksheet generation core logic and helpers 2025-11-11 11:49:27 -06:00
problemGenerator.ts fix: add shuffling to progressive difficulty mode & UI improvements 2025-11-12 17:35:13 -06:00
progressionPath.ts feat: add worksheet generation core logic and helpers 2025-11-11 11:49:27 -06:00
skillMigration.ts feat: add worksheet generation core logic and helpers 2025-11-11 11:49:27 -06:00
skills.ts feat: add worksheet generation core logic and helpers 2025-11-11 11:49:27 -06:00
techniques.ts feat: add worksheet generation core logic and helpers 2025-11-11 11:49:27 -06:00
types.ts feat: add responsive page button layout with dynamic dropdown 2025-11-18 11:08:45 -06:00
typstGenerator.ts feat: add responsive page button layout with dynamic dropdown 2025-11-18 11:08:45 -06:00
typstHelpers.ts feat: add worksheet generation core logic and helpers 2025-11-11 11:49:27 -06:00
validation.ts feat: add responsive page button layout with dynamic dropdown 2025-11-18 11:08:45 -06:00

README.md

Worksheet Generator

Create customizable math worksheets with progressive difficulty, problem space validation, and Typst-powered PDF generation.

Features

  • Addition & Subtraction: Full support for multi-digit problems (1-5 digits)
  • Progressive Difficulty: Smart Mode automatically scales difficulty based on skill level
  • Problem Space Validation: Real-time warnings when configurations have limited unique problems
  • Typst Integration: High-quality PDF generation with customizable layouts
  • Display Rules: Configurable visual aids (carry boxes, ten frames, place-value colors, etc.)
  • Mastery System: Adaptive learning with skill tracking and progression

Quick Start

// Access the worksheet studio at /create/worksheets/addition
// Configure settings, preview problems, download PDF

Architecture Documentation

Core Systems

Problem Generation - PROBLEM_GENERATION_ARCHITECTURE.md

  • Complete technical documentation of problem generation algorithms
  • Two generation strategies: generate-all + shuffle (small spaces) vs retry-based (large spaces)
  • Problem space estimation and duplicate risk calculation
  • Edge cases: single-digit constraints, mixed mastery mode, subtraction borrowing
  • Performance considerations and testing guide

Quick Reference - .claude/PROBLEM_GENERATION.md

  • Fast lookup for developers and Claude Code
  • Strategy selection logic with code examples
  • Debugging commands and common modifications
  • Q&A troubleshooting section

UX Improvements - USER_WARNING_IMPROVEMENTS.md

  • Recommended UI enhancements for problem space warnings
  • Design mockups for config panel indicators
  • Implementation phases and component structure

Additional Documentation

Key Concepts

Problem Space

The "problem space" is the set of all unique problems possible given your constraints:

  • 1-digit 100% regrouping: Only 45 unique problems exist (e.g., 2+8, 3+7, 4+9...)
  • 2-digit mixed regrouping: ~4,000 unique problems
  • 3-digit problems: ~400,000 unique problems

Why it matters: Requesting more problems than exist in the space results in duplicates. The system warns you when this happens.

Generation Strategies

Generate-All + Shuffle (Small spaces < 10,000)

  • Enumerates all valid problems upfront
  • Shuffles deterministically
  • Zero retries, guaranteed coverage
  • Cycles through full set when requesting more than available

Retry-Based (Large spaces ≥ 10,000)

  • Randomly generates problems
  • Retries on duplicates (up to 100 times)
  • Allows some duplicates to prevent performance issues

Progressive Difficulty

Smart Mode - Automatically adjusts difficulty based on:

  • Student skill level (tracked via mastery system)
  • Previous performance
  • Target regrouping/borrowing probability

Manual Mode - You control:

  • Digit range (1-5 digits)
  • Regrouping/borrowing probability (0-100%)
  • Progressive vs constant difficulty

Common Edge Cases

Single-Digit 100% Regrouping

Problem: Only 45 unique problems where both operands are 0-9 and result requires carrying.

Solution:

  • Reduce pages to 1-2 (20-40 problems)
  • Lower regrouping to 50%
  • Increase to 2-digit problems

Mastery + Mixed Mode

Problem: Addition and subtraction use separate skill-based configs, making combined problem space estimation complex.

Solution: Validation is skipped for this mode. Each operator uses its own config independently.

Subtraction Multiple Borrowing

Problem: 1-2 digit subtraction cannot have 2+ borrow operations (mathematical impossibility).

Solution: System automatically falls back to single-borrow problems for these ranges.

File Structure

worksheets/
├── README.md (this file)
├── PROBLEM_GENERATION_ARCHITECTURE.md    # Technical deep-dive
├── USER_WARNING_IMPROVEMENTS.md          # UX enhancement plan
├── problemGenerator.ts                   # Core generation logic
├── utils/
│   └── validateProblemSpace.ts          # Space estimation
├── components/
│   ├── config-panel/                    # Configuration UI
│   └── worksheet-preview/               # Preview + warnings
│       ├── WorksheetPreviewContext.tsx  # Validation state
│       └── DuplicateWarningBanner.tsx   # Warning display
└── addition/
    ├── SMART_DIFFICULTY_SPEC.md         # Smart Mode spec
    └── page.tsx                         # Addition worksheet page

Testing

# Type check
npm run type-check

# Run all checks before committing
npm run pre-commit

See PROBLEM_GENERATION_ARCHITECTURE.md for comprehensive testing checklist.

Contributing

When modifying problem generation:

  1. Read PROBLEM_GENERATION_ARCHITECTURE.md for complete system understanding
  2. Check .claude/PROBLEM_GENERATION.md for quick reference
  3. Run the testing checklist
  4. Update inline comments if changing generation strategy
  5. Consider UX impact (see USER_WARNING_IMPROVEMENTS.md)

Parent: apps/web/README.md - Web application overview Abacus Component: packages/abacus-react/README.md - Abacus visualization library