Add maximum digit constraint for multiplication worksheets #1
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This is all just me playing with Claude Code but the new feature does appear to work, so I figured I'd share. This is useful for my kid as we're working on the times table while also doing these multiplication worksheets, but some of the exercises would be for numbers he doesn't know yet (like, the times table for 9 or whatever).
I guess the other big structural change which might be a dealbreaker for you is moving the code to
/docs, this is just so that GitHub Pages lets us deploy the app (free and simple hosting).🎯 Preview Build
Try the new feature here: https://ezuk.github.io/hw-gen/
📝 What This PR Does
This PR adds a maximum digit constraint feature for multiplication worksheets. When generating multiplication problems, users can now specify a maximum digit value (5, 6, 7, or 8) to ensure that at least one operand in each problem is less than or equal to that value.
🤔 Why This Feature?
This feature is designed for children who are progressively learning their multiplication tables. For example:
3 × 8✅ or5 × 9✅ are included (one operand ≤ 5)7 × 8❌ are excluded (both operands > 5)This helps build confidence and allows focused practice on specific multiplication ranges.
🔧 Changes Made
User Interface
src/index.htmllines 217-227Core Logic (
src/js/hw-gen.js)maxDigitparameter to application stategenEquation()to respect max digit constraint for multiplicationgenerate()to filter/constrain equation generationHelper Functions (
src/js/util.js)randRangeByDigitsWithMax()functionWorksheet Generators (
src/js/hw-sets.js)Updated custom generators to accept and apply
maxDigitparameter:multiplication-vis-emoji- Visual emoji-based problemsmultiplication-vis-1- Grid-based visual problems (2-6 range)multiplication-11-13- Problems with 11-13Deployment
/docsfolder for GitHub Pages deployment🧪 How to Test
📊 Files Changed
src/index.html- Added UI controlsrc/js/hw-gen.js- Core generation logic updatessrc/js/hw-sets.js- Updated worksheet generatorssrc/js/util.js- New helper functiondocs/- Added for GitHub Pages deployment (mirrorssrc/)✅ Testing Done
Note: This feature only affects multiplication worksheets and has no impact on addition, subtraction, or division problems.