An AI skill that turns books into animated, narrated, interactive web experiences
JavaScript ai-agentsai-educationanimationclaudeclaude-codeclaude-skillsedtecheducationinteractive-textbookscormtext-to-video
feat(math): add decimal addition chapter
yzr7573af06290b
diff --git a/site/index.html b/site/index.htmlindex 10212a6..2d210d3 100644--- a/site/index.html+++ b/site/index.html@@ -23,8 +23,8 @@<a class="book-hotspot algebra-book" data-book="elementary-algebra" href="elementary-algebra/" aria-label="Open Elementary Algebra, 68 narrated chapters"><span class="book-caption"><strong>Elementary Algebra <span aria-hidden="true">↗</span></strong><small>68 narrated chapters</small></span></a>- <a class="book-hotspot math-book" data-book="math-notebook" href="math-notebook/" aria-label="Open Elementary Mathematics, 7 narrated chapters">- <span class="book-caption"><strong>Elementary Mathematics <span aria-hidden="true">↗</span></strong><small>7 narrated chapters</small></span>+ <a class="book-hotspot math-book" data-book="math-notebook" href="math-notebook/" aria-label="Open Elementary Mathematics, 8 narrated chapters">+ <span class="book-caption"><strong>Elementary Mathematics <span aria-hidden="true">↗</span></strong><small>8 narrated chapters</small></span></a><span class="physics-pending">Physics · Coming soon</span></section>diff --git a/site/lib/bookshelf.js b/site/lib/bookshelf.jsindex d5b6a37..a1ad4b1 100644--- a/site/lib/bookshelf.js+++ b/site/lib/bookshelf.js@@ -17,7 +17,7 @@const books = [{ id: 'elementary-algebra', key: 'progress', chapterBase: 'elementary-algebra/', chapters: 68 },{ id: 'math-notebook', key: 'animebook:progress:' + new URL('math-notebook/', location.href).pathname,- chapterBase: 'math-notebook/', chapters: 7 },+ chapterBase: 'math-notebook/', chapters: 8 },];for (const book of books) {const cover = document.querySelector(`[data-book="${book.id}"]`);diff --git a/site/math-notebook/ch07/index.html b/site/math-notebook/ch07/index.htmlindex 30564cc..7b17c4a 100644--- a/site/math-notebook/ch07/index.html+++ b/site/math-notebook/ch07/index.html@@ -5,7 +5,7 @@<style>.screen .blanks .line{gap:14px}.screen input.box{min-width:110px}</style></head><body><script src="../lib/engine.js"></script><script src="audio/en/timings.js"></script><script>'use strict';-const CHAPTER={number:7,title:'Multiplying and Dividing Fractions',minutes:12,language:'en'};+const CHAPTER={number:7,title:'Multiplying and Dividing Fractions',minutes:12,language:'en', next: '../ch08/' };const FM_A=COL.whole,FM_B=COL.nat;const fmText=(p,s,x,y,t=0,size=32,col=COL.chalk,anchor='start')=>{const e=T(p,s,{x,y,size,fill:col,anchor,o:0});show(e,t);return e;};const fmMath=(p,s,x,y,t=0,size=48,col=COL.chalk,anchor='middle')=>{const e=M(p,Array.isArray(s)?s:[s],{x,y,size,fill:col,anchor,o:0});show(e,t);return e;};diff --git a/site/math-notebook/ch08/audio/en/addhund.mp3 b/site/math-notebook/ch08/audio/en/addhund.mp3new file mode 100644index 0000000..07b66d3Binary files /dev/null and b/site/math-notebook/ch08/audio/en/addhund.mp3 differdiff --git a/site/math-notebook/ch08/audio/en/addtenths.mp3 b/site/math-notebook/ch08/audio/en/addtenths.mp3new file mode 100644index 0000000..5f7b726Binary files /dev/null and b/site/math-notebook/ch08/audio/en/addtenths.mp3 differdiff --git a/site/math-notebook/ch08/audio/en/addunequal.mp3 b/site/math-notebook/ch08/audio/en/addunequal.mp3new file mode 100644index 0000000..e43d1bbBinary files /dev/null and b/site/math-notebook/ch08/audio/en/addunequal.mp3 differdiff --git a/site/math-notebook/ch08/audio/en/align.mp3 b/site/math-notebook/ch08/audio/en/align.mp3new file mode 100644index 0000000..112afa4Binary files /dev/null and b/site/math-notebook/ch08/audio/en/align.mp3 differdiff --git a/site/math-notebook/ch08/audio/en/borrow.mp3 b/site/math-notebook/ch08/audio/en/borrow.mp3new file mode 100644index 0000000..a7dcebfBinary files /dev/null and b/site/math-notebook/ch08/audio/en/borrow.mp3 differdiff --git a/site/math-notebook/ch08/audio/en/borrowhund.mp3 b/site/math-notebook/ch08/audio/en/borrowhund.mp3new file mode 100644index 0000000..565d080Binary files /dev/null and b/site/math-notebook/ch08/audio/en/borrowhund.mp3 differdiff --git a/site/math-notebook/ch08/audio/en/final1.mp3 b/site/math-notebook/ch08/audio/en/final1.mp3new file mode 100644index 0000000..c4be191Binary files /dev/null and b/site/math-notebook/ch08/audio/en/final1.mp3 differdiff --git a/site/math-notebook/ch08/audio/en/final2.mp3 b/site/math-notebook/ch08/audio/en/final2.mp3new file mode 100644index 0000000..0d466b8Binary files /dev/null and b/site/math-notebook/ch08/audio/en/final2.mp3 differdiff --git a/site/math-notebook/ch08/audio/en/final3.mp3 b/site/math-notebook/ch08/audio/en/final3.mp3new file mode 100644index 0000000..a65d5cdBinary files /dev/null and b/site/math-notebook/ch08/audio/en/final3.mp3 differdiff --git a/site/math-notebook/ch08/audio/en/finish.mp3 b/site/math-notebook/ch08/audio/en/finish.mp3new file mode 100644index 0000000..6fe7e74Binary files /dev/null and b/site/math-notebook/ch08/audio/en/finish.mp3 differdiff --git a/site/math-notebook/ch08/audio/en/intro.mp3 b/site/math-notebook/ch08/audio/en/intro.mp3new file mode 100644index 0000000..5e6c7d7Binary files /dev/null and b/site/math-notebook/ch08/audio/en/intro.mp3 differdiff --git a/site/math-notebook/ch08/audio/en/longzero.mp3 b/site/math-notebook/ch08/audio/en/longzero.mp3new file mode 100644index 0000000..80ad8a1Binary files /dev/null and b/site/math-notebook/ch08/audio/en/longzero.mp3 differdiff --git a/site/math-notebook/ch08/audio/en/money.mp3 b/site/math-notebook/ch08/audio/en/money.mp3new file mode 100644index 0000000..25681e2Binary files /dev/null and b/site/math-notebook/ch08/audio/en/money.mp3 differdiff --git a/site/math-notebook/ch08/audio/en/places.mp3 b/site/math-notebook/ch08/audio/en/places.mp3new file mode 100644index 0000000..9a04c3dBinary files /dev/null and b/site/math-notebook/ch08/audio/en/places.mp3 differdiff --git a/site/math-notebook/ch08/audio/en/q1.mp3 b/site/math-notebook/ch08/audio/en/q1.mp3new file mode 100644index 0000000..16a0d13Binary files /dev/null and b/site/math-notebook/ch08/audio/en/q1.mp3 differdiff --git a/site/math-notebook/ch08/audio/en/q2.mp3 b/site/math-notebook/ch08/audio/en/q2.mp3new file mode 100644index 0000000..fd4239eBinary files /dev/null and b/site/math-notebook/ch08/audio/en/q2.mp3 differdiff --git a/site/math-notebook/ch08/audio/en/q3.mp3 b/site/math-notebook/ch08/audio/en/q3.mp3new file mode 100644index 0000000..58c7d29Binary files /dev/null and b/site/math-notebook/ch08/audio/en/q3.mp3 differdiff --git a/site/math-notebook/ch08/audio/en/subtract.mp3 b/site/math-notebook/ch08/audio/en/subtract.mp3new file mode 100644index 0000000..615cbffBinary files /dev/null and b/site/math-notebook/ch08/audio/en/subtract.mp3 differdiff --git a/site/math-notebook/ch08/audio/en/timings.js b/site/math-notebook/ch08/audio/en/timings.jsnew file mode 100644index 0000000..1730ffb--- /dev/null+++ b/site/math-notebook/ch08/audio/en/timings.js@@ -0,0 +1,697 @@+window.TIMINGS = {+ "intro": {+ "dur": 15.936,+ "marks": {+ "sub": 3.633+ },+ "cues": [+ [+ 0.104,+ "Chapter eight."+ ],+ [+ 1.146,+ "Adding and subtracting decimals."+ ],+ [+ 3.633,+ "Different numbers of digits can look awkward, but place value gives every digit a home."+ ],+ [+ 9.036,+ "We will line up those homes, trade pieces without changing their value, and keep track of a few dollars along the way."+ ]+ ]+ },+ "places": {+ "dur": 28.416,+ "marks": {+ "tenths": 2.005,+ "hundredths": 7.201,+ "columns": 18.424+ },+ "cues": [+ [+ 0.104,+ "Start with one whole square."+ ],+ [+ 2.005,+ "Split it into ten equal strips."+ ],+ [+ 4.818,+ "Each strip is one tenth."+ ],+ [+ 7.201,+ "Split a strip into ten equal squares."+ ],+ [+ 10.443,+ "Each small square is one hundredth of the whole."+ ],+ [+ 13.646,+ "Ten hundredths make one tenth, and ten tenths make one whole."+ ],+ [+ 18.424,+ "The digits in two point six eight count two wholes, six tenths, and eight hundredths."+ ],+ [+ 25.065,+ "A digit only tells the amount when we know its place."+ ]+ ]+ },+ "align": {+ "dur": 28.224,+ "marks": {+ "wrong": 4.466,+ "right": 14.883,+ "rule": 23.32+ },+ "cues": [+ [+ 0.104,+ "Let us add eight point four and zero point six seven five."+ ],+ [+ 4.466,+ "If we line up whatever digits happen to be last, a tenth could land under a hundredth."+ ],+ [+ 9.701,+ "That would combine different sizes, like counting a dollar and a cent as two dollars."+ ],+ [+ 14.883,+ "Instead, line up the decimal points."+ ],+ [+ 17.812,+ "Now wholes meet wholes, tenths meet tenths, and hundredths meet hundredths."+ ],+ [+ 23.32,+ "The decimal point is our landmark."+ ],+ [+ 25.846,+ "The columns are the reason the rule works."+ ]+ ]+ },+ "q1": {+ "dur": 4.608,+ "marks": {},+ "cues": [+ [+ 0.104,+ "Quick check."+ ],+ [+ 1.094,+ "Choose the board that adds digits with the same place value."+ ]+ ]+ },+ "zeros": {+ "dur": 37.68,+ "marks": {+ "split": 4.831,+ "more": 10.872,+ "whole": 21.471,+ "care": 28.971+ },+ "cues": [+ [+ 0.104,+ "Seven point three has seven wholes and three tenths."+ ],+ [+ 4.831,+ "Three tenths is thirty hundredths, so seven point three zero has exactly the same value."+ ],+ [+ 10.872,+ "Another zero gives seven point three zero zero."+ ],+ [+ 15.26,+ "We still have seven wholes and three tenths; the added thousandths count is zero."+ ],+ [+ 21.471,+ "A whole number has its decimal point just to the right of the ones digit."+ ],+ [+ 25.547,+ "Five can be written as five point zero zero."+ ],+ [+ 28.971,+ "Add zeros after the last decimal digit."+ ],+ [+ 32.214,+ "Putting a zero before the three would move it to a different place and change the number."+ ]+ ]+ },+ "addhund": {+ "dur": 31.032,+ "marks": {+ "combine": 6.406,+ "exchange": 13.958,+ "carry": 19.388+ },+ "cues": [+ [+ 0.117,+ "Back to two point six eight plus one point five seven."+ ],+ [+ 4.115,+ "Work from the smallest place on the right."+ ],+ [+ 6.406,+ "Eight hundredths plus seven hundredths makes fifteen hundredths."+ ],+ [+ 10.326,+ "Watch ten of those small squares form one strip."+ ],+ [+ 13.958,+ "Exchange those ten hundredths for one tenth."+ ],+ [+ 16.979,+ "The total area stays the same."+ ],+ [+ 19.388,+ "Write five in the hundredths answer column, and carry one tenth to the tenths column."+ ],+ [+ 25.208,+ "A carry is a real amount moving into its new home, not a mysterious extra one."+ ]+ ]+ },+ "addtenths": {+ "dur": 32.832,+ "marks": {+ "combine": 1.471,+ "exchange": 10.443,+ "carry": 14.805,+ "answer": 23.307+ },+ "cues": [+ [+ 0.091,+ "Now add the tenths."+ ],+ [+ 1.471,+ "Six tenths plus five tenths plus the carried tenth gives twelve tenths."+ ],+ [+ 7.07,+ "Ten of the strips fit together as a whole square."+ ],+ [+ 10.443,+ "Exchange those ten tenths for one whole, leaving two tenths."+ ],+ [+ 14.805,+ "Write two in the tenths answer column and carry one whole."+ ],+ [+ 18.685,+ "Then two wholes plus one whole plus that carried whole gives four wholes."+ ],+ [+ 23.307,+ "Bring the decimal point straight down."+ ],+ [+ 25.391,+ "The sum is four point two five."+ ],+ [+ 27.617,+ "The regrouping changed how we counted the pieces, but never changed their total value."+ ]+ ]+ },+ "addunequal": {+ "dur": 38.064,+ "marks": {+ "zeros": 4.232,+ "small": 11.94,+ "carry": 19.427,+ "answer": 25.339+ },+ "cues": [+ [+ 0.104,+ "What about eight point four plus zero point six seven five?"+ ],+ [+ 4.232,+ "Write eight point four zero zero so both numbers have a thousandths column."+ ],+ [+ 9.492,+ "These zeros add no value."+ ],+ [+ 11.94,+ "Start at the thousandths: zero plus five is five."+ ],+ [+ 16.081,+ "Hundredths: zero plus seven is seven."+ ],+ [+ 19.427,+ "Tenths: four plus six is ten."+ ],+ [+ 22.396,+ "Write zero tenths and carry one whole."+ ],+ [+ 25.339,+ "Eight wholes plus zero wholes plus one carried whole gives nine."+ ],+ [+ 29.753,+ "The answer is nine point zero seven five."+ ],+ [+ 32.747,+ "Keeping each column in its place also keeps that important zero in the answer."+ ]+ ]+ },+ "q2": {+ "dur": 5.64,+ "marks": {},+ "cues": [+ [+ 0.104,+ "Quick check."+ ],+ [+ 1.185,+ "Choose the picture and number with the same value as seven point three."+ ]+ ]+ },+ "subtract": {+ "dur": 34.656,+ "marks": {+ "pad": 7.565,+ "right": 9.609,+ "answer": 19.362,+ "check": 22.331+ },+ "cues": [+ [+ 0.143,+ "For subtraction, keep the same column homes."+ ],+ [+ 3.62,+ "Take eighteen point seven six minus five point two."+ ],+ [+ 7.565,+ "Write five point two zero."+ ],+ [+ 9.609,+ "Six hundredths minus zero is six."+ ],+ [+ 12.552,+ "Seven tenths minus two is five."+ ],+ [+ 15.3,+ "Eight ones minus five is three, and the ten remains."+ ],+ [+ 19.362,+ "The difference is thirteen point five six."+ ],+ [+ 22.331,+ "Adding the part we removed back to the difference gives the original amount."+ ],+ [+ 26.875,+ "Thirteen point five six plus five point two is eighteen point seven six."+ ],+ [+ 32.383,+ "That is a useful way to check subtraction."+ ]+ ]+ },+ "borrow": {+ "dur": 30.192,+ "marks": {+ "need": 4.323,+ "whole": 12.24,+ "same": 20.208+ },+ "cues": [+ [+ 0.104,+ "Now four point zero two minus one point seven six."+ ],+ [+ 4.323,+ "We have two hundredths, but need to remove six."+ ],+ [+ 7.786,+ "There are zero tenths available, so we cannot borrow a tenth yet."+ ],+ [+ 12.24,+ "Exchange one of the four wholes for ten tenths."+ ],+ [+ 15.768,+ "We now have three wholes, ten tenths, and two hundredths."+ ],+ [+ 20.208,+ "The picture has the same total area as before."+ ],+ [+ 23.529,+ "Borrowing means exchanging a larger piece for ten smaller ones."+ ],+ [+ 27.904,+ "It does not create or lose value."+ ]+ ]+ },+ "borrowhund": {+ "dur": 36.168,+ "marks": {+ "tenth": 2.435,+ "twelve": 9.922,+ "subtract": 18.685,+ "answer": 28.203+ },+ "cues": [+ [+ 0.091,+ "Continue with the ten tenths we just made."+ ],+ [+ 2.435,+ "Exchange one tenth for ten hundredths."+ ],+ [+ 5.378,+ "Nine tenths remain."+ ],+ [+ 6.901,+ "The ten new hundredths join the two we already had."+ ],+ [+ 9.922,+ "Now the top number is counted as three wholes, nine tenths, and twelve hundredths."+ ],+ [+ 15.742,+ "That still equals four point zero two."+ ],+ [+ 18.685,+ "Twelve hundredths minus six is six hundredths."+ ],+ [+ 21.771,+ "Nine tenths minus seven is two tenths."+ ],+ [+ 25.326,+ "Three wholes minus one is two wholes."+ ],+ [+ 28.203,+ "The difference is two point two six."+ ],+ [+ 30.859,+ "A zero column is a bridge: regroup through it, then subtract."+ ]+ ]+ },+ "q3": {+ "dur": 8.184,+ "marks": {},+ "cues": [+ [+ 0.104,+ "Quick check."+ ],+ [+ 1.146,+ "Choose the regrouped pieces that still total four point zero two and let you subtract one point seven six."+ ]+ ]+ },+ "longzero": {+ "dur": 41.232,+ "marks": {+ "pad": 6.328,+ "one": 13.464,+ "tenths": 16.185,+ "hundredths": 19.023,+ "thousandths": 22.396,+ "answer": 32.917+ },+ "cues": [+ [+ 0.091,+ "Zeros can form a longer bridge."+ ],+ [+ 2.305,+ "Try twenty minus three point four eight five."+ ],+ [+ 6.328,+ "Write twenty point zero zero zero."+ ],+ [+ 9.323,+ "We need a thousandth, but all three decimal places are zero."+ ],+ [+ 13.464,+ "Exchange one ten for ten ones."+ ],+ [+ 16.185,+ "Exchange one of those ones for ten tenths."+ ],+ [+ 19.023,+ "Exchange one of those tenths for ten hundredths."+ ],+ [+ 22.396,+ "Finally, exchange one hundredth for ten thousandths."+ ],+ [+ 25.872,+ "The columns now hold one ten, nine ones, nine tenths, nine hundredths, and ten thousandths."+ ],+ [+ 32.917,+ "Subtract from right to left."+ ],+ [+ 34.987,+ "The answer is sixteen point five one five."+ ],+ [+ 38.242,+ "Each exchange preserves the total twenty."+ ]+ ]+ },+ "money": {+ "dur": 45.096,+ "marks": {+ "total": 10.182,+ "left": 25.039,+ "cents": 33.294+ },+ "cues": [+ [+ 0.078,+ "A museum trip costs twelve dollars seventy-five cents for a ticket, eight dollars sixty cents for a meal, and three dollars ninety-five cents for a drink."+ ],+ [+ 10.182,+ "Align the dollars and the two cent places."+ ],+ [+ 13.281,+ "Seventy-five cents plus sixty cents plus ninety-five cents is two dollars thirty cents."+ ],+ [+ 20.065,+ "Add the whole dollars, and the total is twenty-five dollars thirty cents."+ ],+ [+ 25.039,+ "You started with forty dollars."+ ],+ [+ 27.083,+ "Subtract twenty-five dollars thirty cents to find fourteen dollars seventy cents left."+ ],+ [+ 33.294,+ "For money, the first two places after the decimal point count cents."+ ],+ [+ 37.721,+ "Further decimal places would describe fractions of a cent."+ ],+ [+ 41.042,+ "Keep two decimal places when showing these money amounts."+ ]+ ]+ },+ "wrap": {+ "dur": 26.808,+ "marks": {+ "w1": 1.641,+ "w2": 5.938,+ "w3": 11.484,+ "w4": 21.263+ },+ "cues": [+ [+ 0.104,+ "Here are the moves to keep."+ ],+ [+ 1.641,+ "Line up decimal points so same-sized places meet."+ ],+ [+ 5.938,+ "Add trailing zeros when you need empty columns."+ ],+ [+ 9.701,+ "The value stays the same."+ ],+ [+ 11.484,+ "Work from right to left."+ ],+ [+ 12.943,+ "Exchange ten smaller pieces for one larger piece when adding, or one larger piece for ten smaller pieces when subtracting."+ ],+ [+ 21.263,+ "Bring the decimal point straight down."+ ],+ [+ 23.542,+ "Check a subtraction by adding back the amount removed."+ ]+ ]+ },+ "final1": {+ "dur": 7.392,+ "marks": {},+ "cues": [+ [+ 0.104,+ "Chapter practice, set one."+ ],+ [+ 2.24,+ "Add decimals."+ ],+ [+ 3.555,+ "Align the places, and carry when a column reaches ten."+ ]+ ]+ },+ "final2": {+ "dur": 8.232,+ "marks": {},+ "cues": [+ [+ 0.104,+ "Chapter practice, set two."+ ],+ [+ 2.305,+ "Subtract decimals."+ ],+ [+ 4.193,+ "Fill empty places with zeros and regroup when needed."+ ]+ ]+ },+ "final3": {+ "dur": 7.08,+ "marks": {},+ "cues": [+ [+ 0.091,+ "Chapter practice, set three."+ ],+ [+ 2.422,+ "Use the decimal columns to solve these measurement and money problems."+ ]+ ]+ },+ "finish": {+ "dur": 8.16,+ "marks": {},+ "cues": [+ [+ 0.104,+ "Chapter eight complete."+ ],+ [+ 1.836,+ "Same place, same-sized pieces."+ ],+ [+ 4.362,+ "That is the idea behind decimal addition and subtraction."+ ]+ ]+ }+};diff --git a/site/math-notebook/ch08/audio/en/wrap.mp3 b/site/math-notebook/ch08/audio/en/wrap.mp3new file mode 100644index 0000000..a3824b0Binary files /dev/null and b/site/math-notebook/ch08/audio/en/wrap.mp3 differdiff --git a/site/math-notebook/ch08/audio/en/zeros.mp3 b/site/math-notebook/ch08/audio/en/zeros.mp3new file mode 100644index 0000000..a1e9981Binary files /dev/null and b/site/math-notebook/ch08/audio/en/zeros.mp3 differdiff --git a/site/math-notebook/ch08/index.html b/site/math-notebook/ch08/index.htmlnew file mode 100644index 0000000..a973f19--- /dev/null+++ b/site/math-notebook/ch08/index.html@@ -0,0 +1,71 @@+<!doctype html>+<html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1"><title>Adding and Subtracting Decimals — Elementary Mathematics</title><link rel="stylesheet" href="../lib/engine.css"><link rel="expect" href="#bar" blocking="render"><style>.screen .blanks .math{font-size:38px}.side .keys{font-size:20px}</style></head><body>+<script src="../lib/engine.js"></script><script src="audio/en/timings.js"></script><script>+'use strict';+const CHAPTER={number:8,title:'Adding and Subtracting Decimals',minutes:11,language:'en'};+const dcText=(p,s,x,y,t=0,size=30,col=COL.chalk,anchor='start')=>{const e=T(p,s,{x,y,size,fill:col,anchor,o:0});show(e,t);return e;};+const dcMath=(p,s,x,y,t=0,size=48,col=COL.chalk,anchor='middle')=>{const e=M(p,[s],{x,y,size,fill:col,anchor,o:0});show(e,t);return e;};+const dcTitle=(p,s,sub='')=>{dcText(p,s,100,120,.1,43);if(sub)dcText(p,sub,100,170,.15,27,COL.dim);};+function dcPiece(p,x,y,w,h,t=.2,col=COL.chalk){const e=G(p,{x,y,o:0});mk('rect',{width:w,height:h,fill:col,'fill-opacity':.30,stroke:col,'stroke-width':1.7},e);e.dataset.area=w*h;show(e,t);return e;}+function dcSquare(p,x,y,t=.2){return dcPiece(p,x,y,180,180,t);}+function dcStrips(p,n,x,y,t=.2,gap=18){return Array.from({length:n},(_,i)=>dcPiece(p,x+i*gap,y,18,180,t+i*.025));}+function dcCells(p,n,x,y,t=.2,cols=10,gap=18){return Array.from({length:n},(_,i)=>dcPiece(p,x+(i%cols)*gap,y+Math.floor(i/cols)*gap,18,18,t+i*.025));}+function dcBoard(p,{x=145,y=245,step=110,places=['ones','tenths','hundredths'],a=['2','6','8'],b=['1','5','7'],op='+',answer=[],t=.2,size=58}={}){+ const g=G(p,{x,y,o:0}),xs=places.map((_,i)=>i*step);show(g,t);+ places.forEach((s,i)=>T(g,s,{x:xs[i],y:0,size:places.length>4?20:23,fill:COL.dim,anchor:'middle'}));+ xs.forEach(xx=>path(g,`M${xx-step/2+7} 25V325`,{stroke:COL.faint,'stroke-width':1}));+ const dotx=(places.indexOf('ones')+.5)*step;+ const top=a.map((v,i)=>T(g,v,{x:xs[i],y:130,size,anchor:'middle'}));+ const bot=b.map((v,i)=>T(g,v,{x:xs[i],y:218,size,anchor:'middle'}));+ T(g,op,{x:-step*.8,y:218,size,anchor:'middle'});+ if(places.includes('tenths'))[130,218,325].forEach(yy=>T(g,'.',{x:dotx,y:yy,size,anchor:'middle'}));+ path(g,`M${-step*.9} 255H${xs.at(-1)+step*.5}`,{stroke:COL.chalk,'stroke-width':3});+ const ans=places.map((_,i)=>T(g,answer[i]??'',{x:xs[i],y:325,size,anchor:'middle',fill:COL.task,o:0}));+ return {g,top,bot,ans,xs:xs.map(xx=>xx+x),y,dotx:x+dotx};+}+function dcAnswer(board,arr,t){arr.forEach((v,i)=>{board.ans[i].textContent=v;show(board.ans[i],Array.isArray(t)?t[i]:t);});}+function dcCount(p,board,counts,t,label='regrouped counts'){+ const g=G(p,{o:0});counts.forEach((n,i)=>T(g,String(n),{x:board.xs[i],y:board.y+65,size:35,fill:COL.task,anchor:'middle'}));show(g,t);return g;+}+function dcCarry(p,board,i,t){dcText(p,'1',board.xs[i],board.y+65,t,34,COL.task,'middle');}+function dcPickBoard(p,x,y,correct){const g=G(p);dcText(g,correct?'A':'B',x+170,y-90,.2,31,COL.dim,'middle');+ const rows=correct?[' 8.400','+ 0.675']:[' 8.4','+ 0.675'];rows.forEach((s,i)=>T(g,s,{x,y:y+i*85,size:64,font:'monospace'}));path(g,`M${x} ${y+112}H${x+325}`,{stroke:COL.chalk,'stroke-width':3});return {el:g,box:[x-20,y-55,390,210],label:correct?'A: decimal points aligned':'B: last digits aligned'};}+function dcZeroPick(p,x,value,place){const g=G(p);dcMath(g,value,x+165,285,.2,49);dcText(g,'7 wholes +',x+165,345,.2,27,COL.dim,'middle');if(place===1){dcStrips(g,3,x+120,385,.2,26);}else if(place===2){dcCells(g,3,x+120,460,.2,3,26);}else{for(let i=0;i<3;i++)dcPiece(g,x+120+i*26,460,1.8,18,.2);}dcText(g,place===1?'3 tenths':place===2?'3 hundredths':'3 thousandths',x+165,610,.2,27,COL.dim,'middle');return {el:g,box:[x+35,240,270,405],label:value};}+const BEATS=[+['intro','Same place, same pieces',(m,D)=>{const g=G(scene,{o:0,y:24});T(g,'Unit 1 · The Number System · Chapter 8',{x:800,y:265,size:28,fill:COL.dim,anchor:'middle'});T(g,'Adding and Subtracting',{x:800,y:375,size:78,weight:600,anchor:'middle'});T(g,'Decimals',{x:800,y:475,size:82,weight:600,anchor:'middle'});tw(g,{o:1,y:0},.2,1,out);dcMath(g,'2.68 + 1.57',800,590,.6,58);const s=dcText(scene,'Same place. Same-sized pieces.',800,710,m('sub'),34,COL.dim,'middle');hide(g,D-.8,.7);hide(s,D-.8,.7);}],+['places','Digits count sizes',m=>{const p=panel(0);dcTitle(p,'Place value gives each digit a home','Each whole square = 1 unit');dcSquare(p,220,320);dcText(p,'one whole',310,550,.2,30,COL.dim,'middle');const strips=dcStrips(p,10,540,320,m('tenths'));dcText(p,'10 tenths',630,550,m('tenths'),30,COL.dim,'middle');dcCells(p,10,925,320,m('hundredths'),1);dcText(p,'1 tenth = 10 hundredths',1200,465,m('hundredths'),30,COL.task,'middle');dcMath(p,'2.68 = 2 + 0.6 + 0.08',800,705,m('columns'),55);dcText(p,'wholes tenths hundredths',860,775,m('columns',1),28,COL.dim,'middle');}],+['align','Align sizes, not last digits',m=>{const p=panel(0);dcTitle(p,'8.4 + 0.675','Unequal decimal lengths need the same column homes.');const wrong=dcPickBoard(p,250,335,false),right=dcPickBoard(p,980,335,true);put(wrong.el,{o:0});put(right.el,{o:0});show(wrong.el,.2);draw(path(p,'M220 270L635 455M220 455L635 270',{stroke:COL.task,'stroke-width':4},{d:0}),m('wrong'),.6);show(right.el,m('right'));dcText(p,'different places meet',430,560,m('wrong'),30,COL.task,'middle');dcText(p,'same places meet',1160,560,m('right'),30,COL.task,'middle');dcText(p,'Align decimal points → align place values.',800,745,m('rule'),40,COL.task,'middle');}],+['q1','Quick check',()=>{const p=panel(0);dcTitle(p,'Which board combines the same-sized places?');S.dcAlign=[dcPickBoard(p,285,360,true),dcPickBoard(p,1000,360,false)];},{ask:done=>quiz(BAND,[{id:'c-align',prompt:'Choose the correct setup for 8.4 + 0.675.',build:pickEls(S.dcAlign,0,'A aligns the decimal points: tenths meet tenths. Trailing zeros fill hundredths and thousandths.',()=> 'B lines up final digits, placing four tenths under five thousandths. Line up the decimal points.',()=>pulseFx(S.dcAlign[0].el,1.03))}],done)}],+['zeros','Trailing zeros keep the value',m=>{const p=panel(0);dcTitle(p,'7.3 = 7.30 = 7.300','Only trailing zeros: after the last decimal digit.');const strips=dcStrips(p,3,260,300,.2,18);dcText(p,'7 wholes + 3 tenths',330,550,.2,29,COL.dim,'middle');for(let j=0;j<3;j++)for(let i=1;i<10;i++)draw(path(p,`M${260+j*18} ${300+i*18}h18`,{stroke:COL.chalk,'stroke-width':1},{d:0}),m('split'),.5);dcText(p,'7 wholes + 30 hundredths',1050,385,m('split'),34,COL.task,'middle');dcMath(p,'7.300',1050,490,m('more'),59);dcText(p,'zero extra thousandths',1050,545,m('more'),27,COL.dim,'middle');dcMath(p,'5 = 5.00',800,660,m('whole'),53);dcText(p,'7.03 ≠ 7.3 · moving the 3 changes its place',800,790,m('care'),32,COL.task,'middle');}],+['addhund','Trade ten hundredths',m=>{const p=panel(0);dcTitle(p,'2.68 + 1.57','Start with hundredths.');const b=dcBoard(p,{x:260,answer:['4','2','5']});dcText(p,'8 hundredths + 7 hundredths',1140,250,.2,28,COL.dim,'middle');const es=dcCells(p,15,870,335,m('combine'),10,26);es.slice(0,10).forEach((e,i)=>tw(e,{x:980,y:310+i*18},m('exchange')-1,1,io));es.slice(10).forEach((e,i)=>tw(e,{x:1170+i*26,y:445},m('exchange')-1,1,io));es.slice(0,10).forEach(e=>hide(e,m('exchange'),.3));dcPiece(p,980,310,18,180,m('exchange'));dcText(p,'1 tenth',990,555,m('exchange'),30,COL.task,'middle');dcText(p,'5 hundredths',1230,555,m('exchange'),30,COL.task,'middle');dcCarry(p,b,1,m('carry'));show(b.ans[2],m('carry'));dcText(p,'15 hundredths = 1 tenth + 5 hundredths',800,770,m('carry',1.5),34,COL.task,'middle');}],+['addtenths','Trade ten tenths',m=>{const p=panel(0);dcTitle(p,'6 tenths + 5 tenths + 1 carried tenth','Same whole unit; strips keep their sizes.');const b=dcBoard(p,{x:260,answer:['4','2','5']});dcCarry(p,b,1,.2);show(b.ans[2],.2);const es=dcStrips(p,12,850,340,m('combine'),28);es.slice(0,10).forEach((e,i)=>tw(e,{x:850+i*18},m('exchange')-1,1,io));es.slice(10).forEach((e,i)=>tw(e,{x:1180+i*30},m('exchange')-1,1,io));es.slice(0,10).forEach(e=>hide(e,m('exchange'),.2));dcSquare(p,850,340,m('exchange'));dcText(p,'1 whole',940,585,m('exchange'),30,COL.task,'middle');dcText(p,'2 tenths',1220,585,m('exchange'),30,COL.task,'middle');dcCarry(p,b,0,m('carry'));show(b.ans[1],m('carry'));show(b.ans[0],m('answer'));dcMath(p,'2.68 + 1.57 = 4.25',800,770,m('answer'),55);}],+['addunequal','Different decimal lengths',m=>{const p=panel(0);dcTitle(p,'8.4 + 0.675','Trailing zeros fill columns without changing the value.');const b=dcBoard(p,{x:340,step:180,places:['ones','tenths','hundredths','thousandths'],a:['8','4','',''],b:['0','6','7','5'],answer:['9','0','7','5']});['0','0'].forEach((v,i)=>{const e=dcText(p,v,b.xs[i+2],375,m('zeros'),58,COL.task,'middle');});show(b.ans[3],m('small'));show(b.ans[2],m('small',3));dcCarry(p,b,0,m('carry'));show(b.ans[1],m('carry'));show(b.ans[0],m('answer'));dcText(p,'10 tenths = 1 whole + 0 tenths',800,675,m('carry'),30,COL.task,'middle','middle');dcMath(p,'9.075',800,760,m('answer'),62);}],+['q2','Quick check',()=>{const p=panel(0);dcTitle(p,'Which amount equals 7.3?','Same whole unit; strips and cells drawn at their exact relative sizes.');S.dcZero=[dcZeroPick(p,140,'7.30',1),dcZeroPick(p,640,'7.03',2),dcZeroPick(p,1140,'7.003',3)];},{ask:done=>quiz(BAND,[{id:'c-zeros',prompt:'Choose seven wholes and three TENTHS.',build:pickEls(S.dcZero,0,'7.30 equals 7.3. Thirty hundredths is three tenths. A trailing zero adds no value.',i=>i===1?'7.03 has three hundredths, not three tenths. The 3 moved to a smaller place.':'7.003 has three thousandths, not three tenths. The 3 moved two places.',()=>pulseFx(S.dcZero[0].el,1.02))}],done)}],+['subtract','Subtract matching places',m=>{const p=panel(0);dcTitle(p,'18.76 − 5.2','Keep same-sized places in the same columns.');const b=dcBoard(p,{x:275,step:125,places:['tens','ones','tenths','hundredths'],a:['1','8','7','6'],b:['','5','2',''],op:'−',answer:['1','3','5','6']});dcText(p,'0',b.xs[3],463,m('pad'),58,COL.task,'middle');dcAnswer(b,['1','3','5','6'],[m('right',5),m('right',4),m('right',2),m('right')]);dcMath(p,'18.76 − 5.20 = 13.56',1110,360,m('answer'),43);dcMath(p,'13.56 + 5.20 = 18.76',1110,525,m('check'),43);dcText(p,'Add back to check.',1110,600,m('check',1),32,COL.task,'middle');}],+['borrow','A zero column needs a bridge',m=>{const p=panel(0);dcTitle(p,'4.02 − 1.76','Diagram: one selected whole and the original 2 hundredths.');const b=dcBoard(p,{x:260,a:['4','0','2'],b:['1','7','6'],op:'−'});dcText(p,'2 hundredths < 6 hundredths',1140,255,m('need'),29,COL.task,'middle');const whole=dcSquare(p,875,340),cells=dcCells(p,2,1240,340,.2,2,26);dcText(p,'3 other wholes stay in their column',1110,675,.2,28,COL.dim,'middle');hide(whole,m('whole'),.2);const es=dcStrips(p,10,875,340,m('whole'));es.forEach((e,i)=>tw(e,{x:840+i*31},m('whole',1.5),1.2,io));S.dcBorrowCounts=dcCount(p,b,[3,10,2],m('whole'));dcText(p,'1 whole → 10 tenths',1120,585,m('whole',1),34,COL.task,'middle');dcMath(p,'3 + 1.0 + 0.02 = 4.02',800,795,m('same'),44);}],+['borrowhund','Exchange a tenth, then subtract',m=>{const p=panel(0);dcTitle(p,'4.02 − 1.76','Three wholes stay in place; watch the fractional pieces.');const b=dcBoard(p,{x:260,a:['4','0','2'],b:['1','7','6'],op:'−',answer:['2','2','6']});const old=dcCount(p,b,[3,10,2],.2),es=dcStrips(p,10,840,325,.2,31),cells=dcCells(p,2,1240,325,.2,2,26);hide(es[9],m('tenth'),.2);const split=dcCells(p,10,1119,325,m('tenth'),1,18);split.forEach((e,i)=>tw(e,{x:920+(i%6)*26,y:565+Math.floor(i/6)*26},m('tenth',1.2),1.2,io));cells.forEach((e,i)=>tw(e,{x:1024+i*26,y:591},m('tenth',1.2),1.2,io));hide(old,m('twelve'),.2);dcCount(p,b,[3,9,12],m('twelve'));dcText(p,'9 tenths remain',975,270,m('twelve'),29,COL.task,'middle');dcText(p,'12 hundredths',1110,650,m('twelve'),29,COL.task,'middle');dcAnswer(b,['2','2','6'],[m('subtract',6),m('subtract',3),m('subtract')]);dcMath(p,'4.02 − 1.76 = 2.26',800,790,m('answer'),53);}],+['q3','Quick check',()=>{const p=panel(0);dcTitle(p,'Which regrouping still equals 4.02?','Choose counts that also let you remove 1 whole, 7 tenths and 6 hundredths.');S.dcRegroup=[[3,9,12],[3,10,12],[4,9,12]].map((ns,j)=>{const x=200+j*480,g=G(p);dcText(g,String.fromCharCode(65+j),x+135,270,.2,32,COL.dim,'middle');ns.forEach((n,i)=>{dcMath(g,String(n),x+130,350+i*100,.2,48);dcText(g,['wholes','tenths','hundredths'][i],x+180,350+i*100,.2,26,COL.dim);});return {el:g,box:[x-10,285,350,310],label:`${ns[0]} wholes, ${ns[1]} tenths, ${ns[2]} hundredths`};});},{ask:done=>quiz(BAND,[{id:'c-regroup',prompt:'Pick the counted pieces with the SAME total as the starting number.',build:pickEls(S.dcRegroup,0,'3 + 0.9 + 0.12 = 4.02. One whole became ten tenths, then one of those became ten hundredths.',i=>i===1?'3 + 1.0 + 0.12 = 4.12. Making ten hundredths must use up one tenth.':'4 + 0.9 + 0.12 = 5.02. Making ten tenths must use up one whole.',()=>pulseFx(S.dcRegroup[0].el,1.02))}],done)}],+['longzero','A longer zero bridge',m=>{const p=panel(0);dcTitle(p,'20 − 3.485','Regroup through every zero. Counts above digits always total 20.');const b=dcBoard(p,{x:290,step:190,places:['tens','ones','tenths','hundredths','thousandths'],a:['2','0','','',''],b:['','3','4','8','5'],op:'−',answer:['1','6','5','1','5']});[2,3,4].forEach(i=>dcText(p,'0',b.xs[i],375,m('pad'),58,COL.task,'middle'));const vectors=[[1,10,0,0,0],[1,9,10,0,0],[1,9,9,10,0],[1,9,9,9,10]],ks=['one','tenths','hundredths','thousandths'];let prev;vectors.forEach((v,i)=>{const g=dcCount(p,b,v,m(ks[i]));if(prev)hide(prev,m(ks[i]),.2);prev=g;});dcText(p,'1 larger unit → 10 of the next smaller unit',800,675,m('one'),33,COL.task,'middle');dcAnswer(b,['1','6','5','1','5'],m('answer'));dcMath(p,'20.000 − 3.485 = 16.515',800,780,m('answer'),54);}],+['money','Costs and change',m=>{const p=panel(0);dcTitle(p,'A museum trip · $40.00 budget','Whole dollars · tenths of a dollar · hundredths of a dollar');[['Ticket','$12.75'],['Meal','$8.60'],['Drink','$3.95']].forEach(([s,v],i)=>{dcText(p,s,230,315+i*100,.2,33,COL.dim);dcMath(p,v,580,315+i*100,.2,50);});dcMath(p,'$12.75 + $8.60 + $3.95 = $25.30',900,630,m('total'),48);dcMath(p,'$40.00 − $25.30 = $14.70',900,735,m('left'),53);dcText(p,'First TWO decimal places count cents.',1110,355,m('cents'),30,COL.task,'middle');dcText(p,'Later places: fractions of a cent.',1110,410,m('cents',1),27,COL.dim,'middle');}],+['wrap','The four moves',m=>{const p=panel(0);[['Align decimal points: same-sized places meet.','w1'],['Trailing zeros fill empty places; value stays the same.','w2'],['Work right to left. Exchange pieces when needed.','w3'],['Drop the decimal point. Add back to check subtraction.','w4']].forEach(([s,k],i)=>{const g=G(p,{x:-16,y:245+i*145,o:0});mk('circle',{cx:150,cy:-10,r:26,fill:COL.task},g);T(g,String(i+1),{x:150,y:0,size:30,anchor:'middle',fill:COL.board});T(g,s,{x:215,size:34});tw(g,{x:0,o:1},m(k),.6);});}],+['final1','Chapter practice',()=>panel(0),{ask:done=>quiz(SCREEN,[{id:'p-add',prompt:'Add. Give the exact value; equivalent trailing zeros are accepted.',build:blanks([+{parts:['3.86 + 4.79 = ',{box:'8.65'}],why:'15 hundredths carries 1 tenth; 16 tenths carries 1 whole. The sum is 8.65.',hint:'Align decimal points and include each carried amount.'},+{parts:['12.047 + 3.6 = ',{box:'15.647'}],why:'Use 3.600 so tenths, hundredths and thousandths meet.'},+{parts:['9 + 0.825 = ',{box:'9.825'}],why:'Write 9.000. Nine wholes plus 825 thousandths is 9.825.'},+{parts:['2.35 + 0.8 + 14.006 = ',{box:'17.156'}],why:'Align 2.350, 0.800 and 14.006. The exact sum is 17.156.'}+])}],done,'Chapter practice 1 of 3')}],+['final2','Chapter practice',()=>panel(0),{ask:done=>quiz(SCREEN,[{id:'p-subtract',prompt:'Subtract. Regroup through zeros when a column needs more pieces.',build:blanks([+{parts:['16.84 − 2.7 = ',{box:'14.14'}],why:'Use 2.70: subtract matching places.'},+{parts:['6.03 − 2.58 = ',{box:'3.45'}],why:'Regroup 6.03 as 5 wholes, 9 tenths, 13 hundredths. Subtract to get 3.45.',hint:'A zero tenths column needs a whole exchanged first.'},+{parts:['50 − 7.264 = ',{box:'42.736'}],why:'50.000 regrouped has 4 tens, 9 ones, 9 tenths, 9 hundredths and 10 thousandths.'},+{parts:['23.4001 − 0.0786 = ',{box:'23.3215'}],why:'Keep ten-thousandths aligned. Regroup through both zero columns: the difference is 23.3215.'}+])}],done,'Chapter practice 2 of 3')}],+['final3','Chapter practice',()=>panel(0),{ask:done=>quiz(SCREEN,[+{id:'p-measure',prompt:'A 5.2-meter cable has a 3.875-meter piece removed. How much remains?',build:blanks([{parts:[{box:'1.325'},' meters'],why:'5.200 − 3.875 = 1.325. Check: 3.875 + 1.325 = 5.200.'}])},+{id:'p-money',prompt:'You have $20. A notebook costs $7.85, a pen set $4.60, and a folder $2.95. Find the total and money left.',build:blanks([{parts:['Total: $',{box:'15.40'}],why:'7.85 + 4.60 + 2.95 = 15.40. For money display $15.40.'},{parts:['Money left: $',{box:'4.60'}],why:'20.00 − 15.40 = 4.60. For money display $4.60.'}])},+{id:'p-identity',prompt:'Fill the blank with the same value. Trailing zeros are accepted.',build:blanks([{parts:['6.4 = ',{box:'6.400'}],why:'6.400 keeps the 4 in the tenths place and adds zero hundredths and thousandths.',hint:'You can add trailing zeros: 6.400 has the same value.'}])}+],done,'Chapter practice 3 of 3')}],+['finish','Finished',()=>panel(0),{ask:finishCard}]+].map(([id,title,run,extra])=>({id,title,run,...extra}));+boot();+</script></body></html>diff --git a/site/math-notebook/index.html b/site/math-notebook/index.htmlindex 1a0e4fa..d20c502 100644--- a/site/math-notebook/index.html+++ b/site/math-notebook/index.html@@ -229,7 +229,7 @@ main#contents { padding-bottom: 80px; }'use strict';// Chapters are numbered in order through the units. Add a chapter here when its lesson is ready.const UNITS = [ // [unit title, [[chapter title, minutes], ...]]; chapters are numbered in order. Add a chapter when its lesson is ready.- ['The Number System', [['Types of Numbers and the Number Line', 9], ['Positive and Negative Numbers', 8], ['Absolute Value', 9], ['Factors and Greatest Common Factor', 11], ['Multiples and Least Common Multiple', 10], ['Fraction Basics: Types of Fractions and Adding and Subtracting Fractions', 13], ['Multiplying and Dividing Fractions', 12]]],+ ['The Number System', [['Types of Numbers and the Number Line', 9], ['Positive and Negative Numbers', 8], ['Absolute Value', 9], ['Factors and Greatest Common Factor', 11], ['Multiples and Least Common Multiple', 10], ['Fraction Basics: Types of Fractions and Adding and Subtracting Fractions', 13], ['Multiplying and Dividing Fractions', 12], ['Adding and Subtracting Decimals', 11]]],];const HUES = ['#f4a48c', '#86c9e8', '#f3c95c', '#e8a0c8', '#8fd6b0', '#bba8ee', '#f0b45a'];const id = n => 'ch' + String(n).padStart(2, '0');