Skip to content

feat: US currency subtraction problems ($a − $b) for Grade 2+ - #36

Merged
git-cgallagher merged 1 commit into
mainfrom
feat/currency-subtraction
Aug 12, 2026
Merged

git-cgallagher merged 1 commit into
mainfrom
feat/currency-subtraction

Conversation

@git-cgallagher

Copy link
Copy Markdown
Owner

What

Adds the ability to subtract US currency to the US currency math worksheet type: a new subtract mode in generator.js genCurrency, alongside the existing count / add / change modes.

  • Problem form: $a − $b = (U+2212 minus, matching every other generator in the file)
  • Same operand ranges as add: 5–50¢ at Grade 2, 5¢–$9.99 at Grade 3+
  • Operands swapped so the difference is always positive; trivial n − n = 0 skipped (same convention as genSubtraction, generator.js:78)
  • Easy difficulty stays count-only, matching how add is already gated
  • Renders through the existing mode:'text' path — no app.js change
  • No wizard change needed: TYPE_META.currency.grades is unchanged and wizard.js reads TYPE_META live

Docs (same-PR rule)

  • CHANGELOG.md — Unreleased → Added entry. README doesn't enumerate currency modes, so nothing else to touch.

Testing

  • node --check generator.js (what CI gates on) passes
  • Smoke test across grades 2–5 × easy/medium/hard, 40 problems each: subtraction appears at medium/hard only, every answer verified correct and positive

🤖 Generated with Claude Code

Adds a 'subtract' mode to genCurrency alongside count/add/change:
same ranges as add (cents 5–50 for G2, 5–999 for G3+), operands
swapped so the difference is always positive, trivial n − n = 0
skipped, U+2212 minus to match the rest of the generators. Easy
difficulty stays count-only, matching how add is gated. Renders
via the existing mode:'text' path — no app.js change. Wizard needs
no change (TYPE_META grades for currency are unchanged).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@git-cgallagher
git-cgallagher marked this pull request as ready for review August 12, 2026 19:51
@git-cgallagher
git-cgallagher merged commit ab3c232 into main Aug 12, 2026
4 checks passed
@git-cgallagher
git-cgallagher deleted the feat/currency-subtraction branch August 12, 2026 19:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant