An AI skill that turns books into animated, narrated, interactive web experiences
JavaScript ai-agentsai-educationanimationclaudeclaude-codeclaude-skillsedtecheducationinteractive-textbookscormtext-to-video
fix(math-notebook): every chapter reviewed and polished; practice headers count once
yzr695c3905529a
diff --git a/engine/check_i18n.py b/engine/check_i18n.pyindex cee3546..c0e30a9 100644--- a/engine/check_i18n.py+++ b/engine/check_i18n.py@@ -212,7 +212,7 @@ async def check_russian_lesson(browser, errors):], () => { window.quizDone = true; })""")await page.wait_for_timeout(100)assert "вводите числа вида 0,75" in await text(".card .keys")- assert await text(".card .kicker") == "Проверь себя 1 из 3"+ assert await text(".card .kicker") == "Проверь себя · вопрос 1 из 3"await page.locator(".box").fill("0,75")await page.locator(".box").press("Enter")assert (await text(".card .fb")).startswith("Верно."), "0,75 is accepted"diff --git a/engine/engine.js b/engine/engine.jsindex a452cd7..1a2efe1 100644--- a/engine/engine.js+++ b/engine/engine.js@@ -24,7 +24,7 @@ const TRANSLATIONS = {checksInLesson: 'Quick checks and practice are in the interactive lesson.',volumeLabel: 'Adjust volume', volumeTitle: 'Volume (0 = muted)', volumeSlider: 'Volume',helpLabel: 'Keyboard shortcuts (?)', speedLabel: 'Playback speed (< and >)', captionsLabel: 'Captions (C)', fullScreenLabel: 'Full screen', goToStep: 'Go to step {n}: {title}',- quickCheck: 'Quick check', countOf: '{k} of {n}', check: 'Check', showAnswer: 'Show answer', nextQuestion: 'Next question', continue: 'Continue',+ quickCheck: 'Quick check', countOf: 'question {k} of {n}', check: 'Check', showAnswer: 'Show answer', nextQuestion: 'Next question', continue: 'Continue',correct: 'Correct. ', notQuite: 'Not quite. ', answerPrefix: 'Answer: ', keysPrefix: 'Keys: ',hintMove: ' move, ', hintChoose: ' choose', hintChooseOrClickGrid: ' choose, or click the grid', hintMoveAlongLine: ' move along the line, ',hintChooseOrClick: ' choose, or click', hintRow: ' row, ', hintTypeFraction: 'type numbers like 3/4 or −2 1/4, ', hintTypeNumber: 'type the number, ',@@ -61,7 +61,7 @@ const TRANSLATIONS = {checksInLesson: 'Проверочные вопросы и практика — в интерактивном уроке.',volumeLabel: 'Настроить громкость', volumeTitle: 'Громкость (0 — без звука)', volumeSlider: 'Громкость',helpLabel: 'Горячие клавиши (?)', speedLabel: 'Скорость воспроизведения (< и >)', captionsLabel: 'Субтитры (C)', fullScreenLabel: 'Полный экран', goToStep: 'Перейти к шагу {n}: {title}',- quickCheck: 'Проверь себя', countOf: '{k} из {n}', check: 'Проверить', showAnswer: 'Показать ответ', nextQuestion: 'Следующий вопрос', continue: 'Продолжить',+ quickCheck: 'Проверь себя', countOf: 'вопрос {k} из {n}', check: 'Проверить', showAnswer: 'Показать ответ', nextQuestion: 'Следующий вопрос', continue: 'Продолжить',correct: 'Верно. ', notQuite: 'Не совсем. ', answerPrefix: 'Ответ: ', keysPrefix: 'Клавиши: ',hintMove: ' двигаться, ', hintChoose: ' выбрать', hintChooseOrClickGrid: ' выбрать или щёлкнуть по сетке', hintMoveAlongLine: ' двигаться по прямой, ',hintChooseOrClick: ' выбрать или щёлкнуть', hintRow: ' строка, ', hintTypeFraction: 'вводите числа вида 3/4 или −2 1/4, ', hintTypeNumber: 'введите число, ',@@ -96,7 +96,7 @@ const TRANSLATIONS = {checksInLesson: '小测验和练习在互动课程里。',volumeLabel: '调节音量', volumeTitle: '音量(0 为静音)', volumeSlider: '音量',helpLabel: '键盘快捷键(?)', speedLabel: '播放速度(< 和 >)', captionsLabel: '字幕(C)', fullScreenLabel: '全屏', goToStep: '跳到第 {n} 步:{title}',- quickCheck: '小测', countOf: '{k} / {n}', check: '检查', showAnswer: '显示答案', nextQuestion: '下一题', continue: '继续',+ quickCheck: '小测', countOf: '第 {k}/{n} 题', check: '检查', showAnswer: '显示答案', nextQuestion: '下一题', continue: '继续',correct: '正确。', notQuite: '还不对。', answerPrefix: '答案:', keysPrefix: '按键:',hintMove: ' 移动,', hintChoose: ' 选择', hintChooseOrClickGrid: ' 选择,或点击网格', hintMoveAlongLine: ' 沿数轴移动,',hintChooseOrClick: ' 选择,或点击', hintRow: ' 换行,', hintTypeFraction: '可输入 3/4 或 −2 1/4 这样的数,', hintTypeNumber: '输入数字,',@@ -131,7 +131,7 @@ const TRANSLATIONS = {checksInLesson: '確認問題と練習はインタラクティブな授業の中にあります。',volumeLabel: '音量を調整', volumeTitle: '音量(0 でミュート)', volumeSlider: '音量',helpLabel: 'キーボードショートカット(?)', speedLabel: '再生速度(< と >)', captionsLabel: '字幕(C)', fullScreenLabel: '全画面', goToStep: 'ステップ {n}:{title} へ移動',- quickCheck: '確認問題', countOf: '{k} / {n}', check: '答え合わせ', showAnswer: '答えを見る', nextQuestion: '次の問題', continue: '続ける',+ quickCheck: '確認問題', countOf: '問 {k}/{n}', check: '答え合わせ', showAnswer: '答えを見る', nextQuestion: '次の問題', continue: '続ける',correct: '正解。', notQuite: 'おしい。', answerPrefix: '答え:', keysPrefix: 'キー:',hintMove: ' 移動、', hintChoose: ' 選ぶ', hintChooseOrClickGrid: ' 選ぶ、またはマス目をクリック', hintMoveAlongLine: ' 数直線上を移動、',hintChooseOrClick: ' 選ぶ、またはクリック', hintRow: ' 行、', hintTypeFraction: '3/4 や −2 1/4 のように入力、', hintTypeNumber: '数を入力、',@@ -899,7 +899,7 @@ function quiz(pos, qs, done, label = translate('quickCheck')) {if (isShortcut(e, 's') && !bShow.hidden) { bShow.click(); return true; }return false;};- const kick = label + (qs.length > 1 ? ' ' + translate('countOf', { k: k + 1, n: qs.length }) : '');+ const kick = label + (qs.length > 1 ? ' · ' + translate('countOf', { k: k + 1, n: qs.length }) : '');const head = h('div', 'head', [h('p', 'kicker', kick), h('p', 'prompt', [rich(q.prompt, pos.cls.startsWith('screen') ? 38 : 28)])]); // match the prompt's type sizeif (ctl.hint) head.append(h('p', 'keys', [translate('keysPrefix'), ...ctl.hint]));c.replaceChildren(...(guide ? [guide] : []), head, fb, body, acts);diff --git a/site/elementary-algebra/lib/engine.js b/site/elementary-algebra/lib/engine.jsindex a452cd7..1a2efe1 100644--- a/site/elementary-algebra/lib/engine.js+++ b/site/elementary-algebra/lib/engine.js@@ -24,7 +24,7 @@ const TRANSLATIONS = {checksInLesson: 'Quick checks and practice are in the interactive lesson.',volumeLabel: 'Adjust volume', volumeTitle: 'Volume (0 = muted)', volumeSlider: 'Volume',helpLabel: 'Keyboard shortcuts (?)', speedLabel: 'Playback speed (< and >)', captionsLabel: 'Captions (C)', fullScreenLabel: 'Full screen', goToStep: 'Go to step {n}: {title}',- quickCheck: 'Quick check', countOf: '{k} of {n}', check: 'Check', showAnswer: 'Show answer', nextQuestion: 'Next question', continue: 'Continue',+ quickCheck: 'Quick check', countOf: 'question {k} of {n}', check: 'Check', showAnswer: 'Show answer', nextQuestion: 'Next question', continue: 'Continue',correct: 'Correct. ', notQuite: 'Not quite. ', answerPrefix: 'Answer: ', keysPrefix: 'Keys: ',hintMove: ' move, ', hintChoose: ' choose', hintChooseOrClickGrid: ' choose, or click the grid', hintMoveAlongLine: ' move along the line, ',hintChooseOrClick: ' choose, or click', hintRow: ' row, ', hintTypeFraction: 'type numbers like 3/4 or −2 1/4, ', hintTypeNumber: 'type the number, ',@@ -61,7 +61,7 @@ const TRANSLATIONS = {checksInLesson: 'Проверочные вопросы и практика — в интерактивном уроке.',volumeLabel: 'Настроить громкость', volumeTitle: 'Громкость (0 — без звука)', volumeSlider: 'Громкость',helpLabel: 'Горячие клавиши (?)', speedLabel: 'Скорость воспроизведения (< и >)', captionsLabel: 'Субтитры (C)', fullScreenLabel: 'Полный экран', goToStep: 'Перейти к шагу {n}: {title}',- quickCheck: 'Проверь себя', countOf: '{k} из {n}', check: 'Проверить', showAnswer: 'Показать ответ', nextQuestion: 'Следующий вопрос', continue: 'Продолжить',+ quickCheck: 'Проверь себя', countOf: 'вопрос {k} из {n}', check: 'Проверить', showAnswer: 'Показать ответ', nextQuestion: 'Следующий вопрос', continue: 'Продолжить',correct: 'Верно. ', notQuite: 'Не совсем. ', answerPrefix: 'Ответ: ', keysPrefix: 'Клавиши: ',hintMove: ' двигаться, ', hintChoose: ' выбрать', hintChooseOrClickGrid: ' выбрать или щёлкнуть по сетке', hintMoveAlongLine: ' двигаться по прямой, ',hintChooseOrClick: ' выбрать или щёлкнуть', hintRow: ' строка, ', hintTypeFraction: 'вводите числа вида 3/4 или −2 1/4, ', hintTypeNumber: 'введите число, ',@@ -96,7 +96,7 @@ const TRANSLATIONS = {checksInLesson: '小测验和练习在互动课程里。',volumeLabel: '调节音量', volumeTitle: '音量(0 为静音)', volumeSlider: '音量',helpLabel: '键盘快捷键(?)', speedLabel: '播放速度(< 和 >)', captionsLabel: '字幕(C)', fullScreenLabel: '全屏', goToStep: '跳到第 {n} 步:{title}',- quickCheck: '小测', countOf: '{k} / {n}', check: '检查', showAnswer: '显示答案', nextQuestion: '下一题', continue: '继续',+ quickCheck: '小测', countOf: '第 {k}/{n} 题', check: '检查', showAnswer: '显示答案', nextQuestion: '下一题', continue: '继续',correct: '正确。', notQuite: '还不对。', answerPrefix: '答案:', keysPrefix: '按键:',hintMove: ' 移动,', hintChoose: ' 选择', hintChooseOrClickGrid: ' 选择,或点击网格', hintMoveAlongLine: ' 沿数轴移动,',hintChooseOrClick: ' 选择,或点击', hintRow: ' 换行,', hintTypeFraction: '可输入 3/4 或 −2 1/4 这样的数,', hintTypeNumber: '输入数字,',@@ -131,7 +131,7 @@ const TRANSLATIONS = {checksInLesson: '確認問題と練習はインタラクティブな授業の中にあります。',volumeLabel: '音量を調整', volumeTitle: '音量(0 でミュート)', volumeSlider: '音量',helpLabel: 'キーボードショートカット(?)', speedLabel: '再生速度(< と >)', captionsLabel: '字幕(C)', fullScreenLabel: '全画面', goToStep: 'ステップ {n}:{title} へ移動',- quickCheck: '確認問題', countOf: '{k} / {n}', check: '答え合わせ', showAnswer: '答えを見る', nextQuestion: '次の問題', continue: '続ける',+ quickCheck: '確認問題', countOf: '問 {k}/{n}', check: '答え合わせ', showAnswer: '答えを見る', nextQuestion: '次の問題', continue: '続ける',correct: '正解。', notQuite: 'おしい。', answerPrefix: '答え:', keysPrefix: 'キー:',hintMove: ' 移動、', hintChoose: ' 選ぶ', hintChooseOrClickGrid: ' 選ぶ、またはマス目をクリック', hintMoveAlongLine: ' 数直線上を移動、',hintChooseOrClick: ' 選ぶ、またはクリック', hintRow: ' 行、', hintTypeFraction: '3/4 や −2 1/4 のように入力、', hintTypeNumber: '数を入力、',@@ -899,7 +899,7 @@ function quiz(pos, qs, done, label = translate('quickCheck')) {if (isShortcut(e, 's') && !bShow.hidden) { bShow.click(); return true; }return false;};- const kick = label + (qs.length > 1 ? ' ' + translate('countOf', { k: k + 1, n: qs.length }) : '');+ const kick = label + (qs.length > 1 ? ' · ' + translate('countOf', { k: k + 1, n: qs.length }) : '');const head = h('div', 'head', [h('p', 'kicker', kick), h('p', 'prompt', [rich(q.prompt, pos.cls.startsWith('screen') ? 38 : 28)])]); // match the prompt's type sizeif (ctl.hint) head.append(h('p', 'keys', [translate('keysPrefix'), ...ctl.hint]));c.replaceChildren(...(guide ? [guide] : []), head, fb, body, acts);diff --git a/site/joke-collection/lib/engine.js b/site/joke-collection/lib/engine.jsindex a452cd7..1a2efe1 100644--- a/site/joke-collection/lib/engine.js+++ b/site/joke-collection/lib/engine.js@@ -24,7 +24,7 @@ const TRANSLATIONS = {checksInLesson: 'Quick checks and practice are in the interactive lesson.',volumeLabel: 'Adjust volume', volumeTitle: 'Volume (0 = muted)', volumeSlider: 'Volume',helpLabel: 'Keyboard shortcuts (?)', speedLabel: 'Playback speed (< and >)', captionsLabel: 'Captions (C)', fullScreenLabel: 'Full screen', goToStep: 'Go to step {n}: {title}',- quickCheck: 'Quick check', countOf: '{k} of {n}', check: 'Check', showAnswer: 'Show answer', nextQuestion: 'Next question', continue: 'Continue',+ quickCheck: 'Quick check', countOf: 'question {k} of {n}', check: 'Check', showAnswer: 'Show answer', nextQuestion: 'Next question', continue: 'Continue',correct: 'Correct. ', notQuite: 'Not quite. ', answerPrefix: 'Answer: ', keysPrefix: 'Keys: ',hintMove: ' move, ', hintChoose: ' choose', hintChooseOrClickGrid: ' choose, or click the grid', hintMoveAlongLine: ' move along the line, ',hintChooseOrClick: ' choose, or click', hintRow: ' row, ', hintTypeFraction: 'type numbers like 3/4 or −2 1/4, ', hintTypeNumber: 'type the number, ',@@ -61,7 +61,7 @@ const TRANSLATIONS = {checksInLesson: 'Проверочные вопросы и практика — в интерактивном уроке.',volumeLabel: 'Настроить громкость', volumeTitle: 'Громкость (0 — без звука)', volumeSlider: 'Громкость',helpLabel: 'Горячие клавиши (?)', speedLabel: 'Скорость воспроизведения (< и >)', captionsLabel: 'Субтитры (C)', fullScreenLabel: 'Полный экран', goToStep: 'Перейти к шагу {n}: {title}',- quickCheck: 'Проверь себя', countOf: '{k} из {n}', check: 'Проверить', showAnswer: 'Показать ответ', nextQuestion: 'Следующий вопрос', continue: 'Продолжить',+ quickCheck: 'Проверь себя', countOf: 'вопрос {k} из {n}', check: 'Проверить', showAnswer: 'Показать ответ', nextQuestion: 'Следующий вопрос', continue: 'Продолжить',correct: 'Верно. ', notQuite: 'Не совсем. ', answerPrefix: 'Ответ: ', keysPrefix: 'Клавиши: ',hintMove: ' двигаться, ', hintChoose: ' выбрать', hintChooseOrClickGrid: ' выбрать или щёлкнуть по сетке', hintMoveAlongLine: ' двигаться по прямой, ',hintChooseOrClick: ' выбрать или щёлкнуть', hintRow: ' строка, ', hintTypeFraction: 'вводите числа вида 3/4 или −2 1/4, ', hintTypeNumber: 'введите число, ',@@ -96,7 +96,7 @@ const TRANSLATIONS = {checksInLesson: '小测验和练习在互动课程里。',volumeLabel: '调节音量', volumeTitle: '音量(0 为静音)', volumeSlider: '音量',helpLabel: '键盘快捷键(?)', speedLabel: '播放速度(< 和 >)', captionsLabel: '字幕(C)', fullScreenLabel: '全屏', goToStep: '跳到第 {n} 步:{title}',- quickCheck: '小测', countOf: '{k} / {n}', check: '检查', showAnswer: '显示答案', nextQuestion: '下一题', continue: '继续',+ quickCheck: '小测', countOf: '第 {k}/{n} 题', check: '检查', showAnswer: '显示答案', nextQuestion: '下一题', continue: '继续',correct: '正确。', notQuite: '还不对。', answerPrefix: '答案:', keysPrefix: '按键:',hintMove: ' 移动,', hintChoose: ' 选择', hintChooseOrClickGrid: ' 选择,或点击网格', hintMoveAlongLine: ' 沿数轴移动,',hintChooseOrClick: ' 选择,或点击', hintRow: ' 换行,', hintTypeFraction: '可输入 3/4 或 −2 1/4 这样的数,', hintTypeNumber: '输入数字,',@@ -131,7 +131,7 @@ const TRANSLATIONS = {checksInLesson: '確認問題と練習はインタラクティブな授業の中にあります。',volumeLabel: '音量を調整', volumeTitle: '音量(0 でミュート)', volumeSlider: '音量',helpLabel: 'キーボードショートカット(?)', speedLabel: '再生速度(< と >)', captionsLabel: '字幕(C)', fullScreenLabel: '全画面', goToStep: 'ステップ {n}:{title} へ移動',- quickCheck: '確認問題', countOf: '{k} / {n}', check: '答え合わせ', showAnswer: '答えを見る', nextQuestion: '次の問題', continue: '続ける',+ quickCheck: '確認問題', countOf: '問 {k}/{n}', check: '答え合わせ', showAnswer: '答えを見る', nextQuestion: '次の問題', continue: '続ける',correct: '正解。', notQuite: 'おしい。', answerPrefix: '答え:', keysPrefix: 'キー:',hintMove: ' 移動、', hintChoose: ' 選ぶ', hintChooseOrClickGrid: ' 選ぶ、またはマス目をクリック', hintMoveAlongLine: ' 数直線上を移動、',hintChooseOrClick: ' 選ぶ、またはクリック', hintRow: ' 行、', hintTypeFraction: '3/4 や −2 1/4 のように入力、', hintTypeNumber: '数を入力、',@@ -899,7 +899,7 @@ function quiz(pos, qs, done, label = translate('quickCheck')) {if (isShortcut(e, 's') && !bShow.hidden) { bShow.click(); return true; }return false;};- const kick = label + (qs.length > 1 ? ' ' + translate('countOf', { k: k + 1, n: qs.length }) : '');+ const kick = label + (qs.length > 1 ? ' · ' + translate('countOf', { k: k + 1, n: qs.length }) : '');const head = h('div', 'head', [h('p', 'kicker', kick), h('p', 'prompt', [rich(q.prompt, pos.cls.startsWith('screen') ? 38 : 28)])]); // match the prompt's type sizeif (ctl.hint) head.append(h('p', 'keys', [translate('keysPrefix'), ...ctl.hint]));c.replaceChildren(...(guide ? [guide] : []), head, fb, body, acts);diff --git a/site/little-red-riding-hood/lib/engine.js b/site/little-red-riding-hood/lib/engine.jsindex a452cd7..1a2efe1 100644--- a/site/little-red-riding-hood/lib/engine.js+++ b/site/little-red-riding-hood/lib/engine.js@@ -24,7 +24,7 @@ const TRANSLATIONS = {checksInLesson: 'Quick checks and practice are in the interactive lesson.',volumeLabel: 'Adjust volume', volumeTitle: 'Volume (0 = muted)', volumeSlider: 'Volume',helpLabel: 'Keyboard shortcuts (?)', speedLabel: 'Playback speed (< and >)', captionsLabel: 'Captions (C)', fullScreenLabel: 'Full screen', goToStep: 'Go to step {n}: {title}',- quickCheck: 'Quick check', countOf: '{k} of {n}', check: 'Check', showAnswer: 'Show answer', nextQuestion: 'Next question', continue: 'Continue',+ quickCheck: 'Quick check', countOf: 'question {k} of {n}', check: 'Check', showAnswer: 'Show answer', nextQuestion: 'Next question', continue: 'Continue',correct: 'Correct. ', notQuite: 'Not quite. ', answerPrefix: 'Answer: ', keysPrefix: 'Keys: ',hintMove: ' move, ', hintChoose: ' choose', hintChooseOrClickGrid: ' choose, or click the grid', hintMoveAlongLine: ' move along the line, ',hintChooseOrClick: ' choose, or click', hintRow: ' row, ', hintTypeFraction: 'type numbers like 3/4 or −2 1/4, ', hintTypeNumber: 'type the number, ',@@ -61,7 +61,7 @@ const TRANSLATIONS = {checksInLesson: 'Проверочные вопросы и практика — в интерактивном уроке.',volumeLabel: 'Настроить громкость', volumeTitle: 'Громкость (0 — без звука)', volumeSlider: 'Громкость',helpLabel: 'Горячие клавиши (?)', speedLabel: 'Скорость воспроизведения (< и >)', captionsLabel: 'Субтитры (C)', fullScreenLabel: 'Полный экран', goToStep: 'Перейти к шагу {n}: {title}',- quickCheck: 'Проверь себя', countOf: '{k} из {n}', check: 'Проверить', showAnswer: 'Показать ответ', nextQuestion: 'Следующий вопрос', continue: 'Продолжить',+ quickCheck: 'Проверь себя', countOf: 'вопрос {k} из {n}', check: 'Проверить', showAnswer: 'Показать ответ', nextQuestion: 'Следующий вопрос', continue: 'Продолжить',correct: 'Верно. ', notQuite: 'Не совсем. ', answerPrefix: 'Ответ: ', keysPrefix: 'Клавиши: ',hintMove: ' двигаться, ', hintChoose: ' выбрать', hintChooseOrClickGrid: ' выбрать или щёлкнуть по сетке', hintMoveAlongLine: ' двигаться по прямой, ',hintChooseOrClick: ' выбрать или щёлкнуть', hintRow: ' строка, ', hintTypeFraction: 'вводите числа вида 3/4 или −2 1/4, ', hintTypeNumber: 'введите число, ',@@ -96,7 +96,7 @@ const TRANSLATIONS = {checksInLesson: '小测验和练习在互动课程里。',volumeLabel: '调节音量', volumeTitle: '音量(0 为静音)', volumeSlider: '音量',helpLabel: '键盘快捷键(?)', speedLabel: '播放速度(< 和 >)', captionsLabel: '字幕(C)', fullScreenLabel: '全屏', goToStep: '跳到第 {n} 步:{title}',- quickCheck: '小测', countOf: '{k} / {n}', check: '检查', showAnswer: '显示答案', nextQuestion: '下一题', continue: '继续',+ quickCheck: '小测', countOf: '第 {k}/{n} 题', check: '检查', showAnswer: '显示答案', nextQuestion: '下一题', continue: '继续',correct: '正确。', notQuite: '还不对。', answerPrefix: '答案:', keysPrefix: '按键:',hintMove: ' 移动,', hintChoose: ' 选择', hintChooseOrClickGrid: ' 选择,或点击网格', hintMoveAlongLine: ' 沿数轴移动,',hintChooseOrClick: ' 选择,或点击', hintRow: ' 换行,', hintTypeFraction: '可输入 3/4 或 −2 1/4 这样的数,', hintTypeNumber: '输入数字,',@@ -131,7 +131,7 @@ const TRANSLATIONS = {checksInLesson: '確認問題と練習はインタラクティブな授業の中にあります。',volumeLabel: '音量を調整', volumeTitle: '音量(0 でミュート)', volumeSlider: '音量',helpLabel: 'キーボードショートカット(?)', speedLabel: '再生速度(< と >)', captionsLabel: '字幕(C)', fullScreenLabel: '全画面', goToStep: 'ステップ {n}:{title} へ移動',- quickCheck: '確認問題', countOf: '{k} / {n}', check: '答え合わせ', showAnswer: '答えを見る', nextQuestion: '次の問題', continue: '続ける',+ quickCheck: '確認問題', countOf: '問 {k}/{n}', check: '答え合わせ', showAnswer: '答えを見る', nextQuestion: '次の問題', continue: '続ける',correct: '正解。', notQuite: 'おしい。', answerPrefix: '答え:', keysPrefix: 'キー:',hintMove: ' 移動、', hintChoose: ' 選ぶ', hintChooseOrClickGrid: ' 選ぶ、またはマス目をクリック', hintMoveAlongLine: ' 数直線上を移動、',hintChooseOrClick: ' 選ぶ、またはクリック', hintRow: ' 行、', hintTypeFraction: '3/4 や −2 1/4 のように入力、', hintTypeNumber: '数を入力、',@@ -899,7 +899,7 @@ function quiz(pos, qs, done, label = translate('quickCheck')) {if (isShortcut(e, 's') && !bShow.hidden) { bShow.click(); return true; }return false;};- const kick = label + (qs.length > 1 ? ' ' + translate('countOf', { k: k + 1, n: qs.length }) : '');+ const kick = label + (qs.length > 1 ? ' · ' + translate('countOf', { k: k + 1, n: qs.length }) : '');const head = h('div', 'head', [h('p', 'kicker', kick), h('p', 'prompt', [rich(q.prompt, pos.cls.startsWith('screen') ? 38 : 28)])]); // match the prompt's type sizeif (ctl.hint) head.append(h('p', 'keys', [translate('keysPrefix'), ...ctl.hint]));c.replaceChildren(...(guide ? [guide] : []), head, fb, body, acts);diff --git a/site/madness-shorts/lib/engine.js b/site/madness-shorts/lib/engine.jsindex a452cd7..1a2efe1 100644--- a/site/madness-shorts/lib/engine.js+++ b/site/madness-shorts/lib/engine.js@@ -24,7 +24,7 @@ const TRANSLATIONS = {checksInLesson: 'Quick checks and practice are in the interactive lesson.',volumeLabel: 'Adjust volume', volumeTitle: 'Volume (0 = muted)', volumeSlider: 'Volume',helpLabel: 'Keyboard shortcuts (?)', speedLabel: 'Playback speed (< and >)', captionsLabel: 'Captions (C)', fullScreenLabel: 'Full screen', goToStep: 'Go to step {n}: {title}',- quickCheck: 'Quick check', countOf: '{k} of {n}', check: 'Check', showAnswer: 'Show answer', nextQuestion: 'Next question', continue: 'Continue',+ quickCheck: 'Quick check', countOf: 'question {k} of {n}', check: 'Check', showAnswer: 'Show answer', nextQuestion: 'Next question', continue: 'Continue',correct: 'Correct. ', notQuite: 'Not quite. ', answerPrefix: 'Answer: ', keysPrefix: 'Keys: ',hintMove: ' move, ', hintChoose: ' choose', hintChooseOrClickGrid: ' choose, or click the grid', hintMoveAlongLine: ' move along the line, ',hintChooseOrClick: ' choose, or click', hintRow: ' row, ', hintTypeFraction: 'type numbers like 3/4 or −2 1/4, ', hintTypeNumber: 'type the number, ',@@ -61,7 +61,7 @@ const TRANSLATIONS = {checksInLesson: 'Проверочные вопросы и практика — в интерактивном уроке.',volumeLabel: 'Настроить громкость', volumeTitle: 'Громкость (0 — без звука)', volumeSlider: 'Громкость',helpLabel: 'Горячие клавиши (?)', speedLabel: 'Скорость воспроизведения (< и >)', captionsLabel: 'Субтитры (C)', fullScreenLabel: 'Полный экран', goToStep: 'Перейти к шагу {n}: {title}',- quickCheck: 'Проверь себя', countOf: '{k} из {n}', check: 'Проверить', showAnswer: 'Показать ответ', nextQuestion: 'Следующий вопрос', continue: 'Продолжить',+ quickCheck: 'Проверь себя', countOf: 'вопрос {k} из {n}', check: 'Проверить', showAnswer: 'Показать ответ', nextQuestion: 'Следующий вопрос', continue: 'Продолжить',correct: 'Верно. ', notQuite: 'Не совсем. ', answerPrefix: 'Ответ: ', keysPrefix: 'Клавиши: ',hintMove: ' двигаться, ', hintChoose: ' выбрать', hintChooseOrClickGrid: ' выбрать или щёлкнуть по сетке', hintMoveAlongLine: ' двигаться по прямой, ',hintChooseOrClick: ' выбрать или щёлкнуть', hintRow: ' строка, ', hintTypeFraction: 'вводите числа вида 3/4 или −2 1/4, ', hintTypeNumber: 'введите число, ',@@ -96,7 +96,7 @@ const TRANSLATIONS = {checksInLesson: '小测验和练习在互动课程里。',volumeLabel: '调节音量', volumeTitle: '音量(0 为静音)', volumeSlider: '音量',helpLabel: '键盘快捷键(?)', speedLabel: '播放速度(< 和 >)', captionsLabel: '字幕(C)', fullScreenLabel: '全屏', goToStep: '跳到第 {n} 步:{title}',- quickCheck: '小测', countOf: '{k} / {n}', check: '检查', showAnswer: '显示答案', nextQuestion: '下一题', continue: '继续',+ quickCheck: '小测', countOf: '第 {k}/{n} 题', check: '检查', showAnswer: '显示答案', nextQuestion: '下一题', continue: '继续',correct: '正确。', notQuite: '还不对。', answerPrefix: '答案:', keysPrefix: '按键:',hintMove: ' 移动,', hintChoose: ' 选择', hintChooseOrClickGrid: ' 选择,或点击网格', hintMoveAlongLine: ' 沿数轴移动,',hintChooseOrClick: ' 选择,或点击', hintRow: ' 换行,', hintTypeFraction: '可输入 3/4 或 −2 1/4 这样的数,', hintTypeNumber: '输入数字,',@@ -131,7 +131,7 @@ const TRANSLATIONS = {checksInLesson: '確認問題と練習はインタラクティブな授業の中にあります。',volumeLabel: '音量を調整', volumeTitle: '音量(0 でミュート)', volumeSlider: '音量',helpLabel: 'キーボードショートカット(?)', speedLabel: '再生速度(< と >)', captionsLabel: '字幕(C)', fullScreenLabel: '全画面', goToStep: 'ステップ {n}:{title} へ移動',- quickCheck: '確認問題', countOf: '{k} / {n}', check: '答え合わせ', showAnswer: '答えを見る', nextQuestion: '次の問題', continue: '続ける',+ quickCheck: '確認問題', countOf: '問 {k}/{n}', check: '答え合わせ', showAnswer: '答えを見る', nextQuestion: '次の問題', continue: '続ける',correct: '正解。', notQuite: 'おしい。', answerPrefix: '答え:', keysPrefix: 'キー:',hintMove: ' 移動、', hintChoose: ' 選ぶ', hintChooseOrClickGrid: ' 選ぶ、またはマス目をクリック', hintMoveAlongLine: ' 数直線上を移動、',hintChooseOrClick: ' 選ぶ、またはクリック', hintRow: ' 行、', hintTypeFraction: '3/4 や −2 1/4 のように入力、', hintTypeNumber: '数を入力、',@@ -899,7 +899,7 @@ function quiz(pos, qs, done, label = translate('quickCheck')) {if (isShortcut(e, 's') && !bShow.hidden) { bShow.click(); return true; }return false;};- const kick = label + (qs.length > 1 ? ' ' + translate('countOf', { k: k + 1, n: qs.length }) : '');+ const kick = label + (qs.length > 1 ? ' · ' + translate('countOf', { k: k + 1, n: qs.length }) : '');const head = h('div', 'head', [h('p', 'kicker', kick), h('p', 'prompt', [rich(q.prompt, pos.cls.startsWith('screen') ? 38 : 28)])]); // match the prompt's type sizeif (ctl.hint) head.append(h('p', 'keys', [translate('keysPrefix'), ...ctl.hint]));c.replaceChildren(...(guide ? [guide] : []), head, fb, body, acts);diff --git a/site/madness/lib/engine.js b/site/madness/lib/engine.jsindex a452cd7..1a2efe1 100644--- a/site/madness/lib/engine.js+++ b/site/madness/lib/engine.js@@ -24,7 +24,7 @@ const TRANSLATIONS = {checksInLesson: 'Quick checks and practice are in the interactive lesson.',volumeLabel: 'Adjust volume', volumeTitle: 'Volume (0 = muted)', volumeSlider: 'Volume',helpLabel: 'Keyboard shortcuts (?)', speedLabel: 'Playback speed (< and >)', captionsLabel: 'Captions (C)', fullScreenLabel: 'Full screen', goToStep: 'Go to step {n}: {title}',- quickCheck: 'Quick check', countOf: '{k} of {n}', check: 'Check', showAnswer: 'Show answer', nextQuestion: 'Next question', continue: 'Continue',+ quickCheck: 'Quick check', countOf: 'question {k} of {n}', check: 'Check', showAnswer: 'Show answer', nextQuestion: 'Next question', continue: 'Continue',correct: 'Correct. ', notQuite: 'Not quite. ', answerPrefix: 'Answer: ', keysPrefix: 'Keys: ',hintMove: ' move, ', hintChoose: ' choose', hintChooseOrClickGrid: ' choose, or click the grid', hintMoveAlongLine: ' move along the line, ',hintChooseOrClick: ' choose, or click', hintRow: ' row, ', hintTypeFraction: 'type numbers like 3/4 or −2 1/4, ', hintTypeNumber: 'type the number, ',@@ -61,7 +61,7 @@ const TRANSLATIONS = {checksInLesson: 'Проверочные вопросы и практика — в интерактивном уроке.',volumeLabel: 'Настроить громкость', volumeTitle: 'Громкость (0 — без звука)', volumeSlider: 'Громкость',helpLabel: 'Горячие клавиши (?)', speedLabel: 'Скорость воспроизведения (< и >)', captionsLabel: 'Субтитры (C)', fullScreenLabel: 'Полный экран', goToStep: 'Перейти к шагу {n}: {title}',- quickCheck: 'Проверь себя', countOf: '{k} из {n}', check: 'Проверить', showAnswer: 'Показать ответ', nextQuestion: 'Следующий вопрос', continue: 'Продолжить',+ quickCheck: 'Проверь себя', countOf: 'вопрос {k} из {n}', check: 'Проверить', showAnswer: 'Показать ответ', nextQuestion: 'Следующий вопрос', continue: 'Продолжить',correct: 'Верно. ', notQuite: 'Не совсем. ', answerPrefix: 'Ответ: ', keysPrefix: 'Клавиши: ',hintMove: ' двигаться, ', hintChoose: ' выбрать', hintChooseOrClickGrid: ' выбрать или щёлкнуть по сетке', hintMoveAlongLine: ' двигаться по прямой, ',hintChooseOrClick: ' выбрать или щёлкнуть', hintRow: ' строка, ', hintTypeFraction: 'вводите числа вида 3/4 или −2 1/4, ', hintTypeNumber: 'введите число, ',@@ -96,7 +96,7 @@ const TRANSLATIONS = {checksInLesson: '小测验和练习在互动课程里。',volumeLabel: '调节音量', volumeTitle: '音量(0 为静音)', volumeSlider: '音量',helpLabel: '键盘快捷键(?)', speedLabel: '播放速度(< 和 >)', captionsLabel: '字幕(C)', fullScreenLabel: '全屏', goToStep: '跳到第 {n} 步:{title}',- quickCheck: '小测', countOf: '{k} / {n}', check: '检查', showAnswer: '显示答案', nextQuestion: '下一题', continue: '继续',+ quickCheck: '小测', countOf: '第 {k}/{n} 题', check: '检查', showAnswer: '显示答案', nextQuestion: '下一题', continue: '继续',correct: '正确。', notQuite: '还不对。', answerPrefix: '答案:', keysPrefix: '按键:',hintMove: ' 移动,', hintChoose: ' 选择', hintChooseOrClickGrid: ' 选择,或点击网格', hintMoveAlongLine: ' 沿数轴移动,',hintChooseOrClick: ' 选择,或点击', hintRow: ' 换行,', hintTypeFraction: '可输入 3/4 或 −2 1/4 这样的数,', hintTypeNumber: '输入数字,',@@ -131,7 +131,7 @@ const TRANSLATIONS = {checksInLesson: '確認問題と練習はインタラクティブな授業の中にあります。',volumeLabel: '音量を調整', volumeTitle: '音量(0 でミュート)', volumeSlider: '音量',helpLabel: 'キーボードショートカット(?)', speedLabel: '再生速度(< と >)', captionsLabel: '字幕(C)', fullScreenLabel: '全画面', goToStep: 'ステップ {n}:{title} へ移動',- quickCheck: '確認問題', countOf: '{k} / {n}', check: '答え合わせ', showAnswer: '答えを見る', nextQuestion: '次の問題', continue: '続ける',+ quickCheck: '確認問題', countOf: '問 {k}/{n}', check: '答え合わせ', showAnswer: '答えを見る', nextQuestion: '次の問題', continue: '続ける',correct: '正解。', notQuite: 'おしい。', answerPrefix: '答え:', keysPrefix: 'キー:',hintMove: ' 移動、', hintChoose: ' 選ぶ', hintChooseOrClickGrid: ' 選ぶ、またはマス目をクリック', hintMoveAlongLine: ' 数直線上を移動、',hintChooseOrClick: ' 選ぶ、またはクリック', hintRow: ' 行、', hintTypeFraction: '3/4 や −2 1/4 のように入力、', hintTypeNumber: '数を入力、',@@ -899,7 +899,7 @@ function quiz(pos, qs, done, label = translate('quickCheck')) {if (isShortcut(e, 's') && !bShow.hidden) { bShow.click(); return true; }return false;};- const kick = label + (qs.length > 1 ? ' ' + translate('countOf', { k: k + 1, n: qs.length }) : '');+ const kick = label + (qs.length > 1 ? ' · ' + translate('countOf', { k: k + 1, n: qs.length }) : '');const head = h('div', 'head', [h('p', 'kicker', kick), h('p', 'prompt', [rich(q.prompt, pos.cls.startsWith('screen') ? 38 : 28)])]); // match the prompt's type sizeif (ctl.hint) head.append(h('p', 'keys', [translate('keysPrefix'), ...ctl.hint]));c.replaceChildren(...(guide ? [guide] : []), head, fb, body, acts);diff --git a/site/math-notebook/ch01/index.html b/site/math-notebook/ch01/index.htmlindex c5add8f..1d3dc67 100644--- a/site/math-notebook/ch01/index.html+++ b/site/math-notebook/ch01/index.html@@ -274,15 +274,15 @@ const BEATS = [['final1', 'Chapter practice', () => { panel(0); }, { ask: done => quiz(SCREEN, [{id: 'p-classify1', prompt: ['Pick every family each number belongs to.'],build: grid(PRACTICE1, FAM_COLS),- }], done, 'Chapter practice 1 of 3') }],+ }], done, 'Chapter practice · set 1 of 3') }],['final2', 'Chapter practice', () => { panel(0); }, { ask: done => quiz(SCREEN, [{id: 'p-classify2', prompt: ['Pick every family each number belongs to. In ', $m('0.1010010001…'), ' each run of zeros is one longer.'],build: grid(PRACTICE2, FAM_COLS),- }], done, 'Chapter practice 2 of 3') }],+ }], done, 'Chapter practice · set 2 of 3') }],['final3', 'Chapter practice', () => { panel(0); }, { ask: done => quiz(SCREEN, [{id: 'p-side', prompt: ['Is each number left or right of 0 on a number line?'],build: grid(PRACTICE3, [['l', 'Left of 0', COL.nat, 'L'], ['r', 'Right of 0', COL.whole, 'R']], { multi: false }),- }], done, 'Chapter practice 3 of 3') }],+ }], done, 'Chapter practice · set 3 of 3') }],['finish', 'Finished', () => { panel(0); }, { ask: finishCard }],].map(([id, title, run, extra]) => ({ id, title, run, ...extra }));diff --git a/site/math-notebook/ch02/index.html b/site/math-notebook/ch02/index.htmlindex 7e3452f..2a52f3f 100644--- a/site/math-notebook/ch02/index.html+++ b/site/math-notebook/ch02/index.html@@ -37,10 +37,13 @@ function pnBand(v0, v1, col, t0) {}// n unit hops from 0 in direction dir (+1 right, −1 left), one arc per step.function pnHops(p, n, dir, t0, col, step = .28) {+ const out = [];for (let k = 0; k < n; k++) {const a = X(dir * k), b = X(dir * (k + 1));- draw(path(p, `M${a} ${Y0 - 14}Q${(a + b) / 2} ${Y0 - 72} ${b} ${Y0 - 14}`, { stroke: col, 'stroke-width': 3 }, { d: 0 }), t0 + k * step, step, lin);+ const h = path(p, `M${a} ${Y0 - 14}Q${(a + b) / 2} ${Y0 - 72} ${b} ${Y0 - 14}`, { stroke: col, 'stroke-width': 3 }, { d: 0 });+ draw(h, t0 + k * step, step, lin); out.push(h);}+ return out;}// Flip a dot across zero from a to b along an arc whose top is at y = peak; the dot changes to b's sign colour.// Pass g to move an existing dot (from landDot or an earlier flip); returns the dot.@@ -152,7 +155,7 @@ const BEATS = [}],['signs', 'Writing the signs', (m) => {const p = panel(0);- const [d4] = mark(p, 4, ['+4'], .3);+ const [d4] = mark(p, 4, ['+4'], m('plus'));mline(p, ['+4 = 4'], X(4), 330, m('same'), POS, 60);text(p, 'the + sign is optional', X(4), 384, m('same', 1), { size: 28, fill: COL.dim, anchor: 'middle' });mark(p, -4, ['−4'], m('minus'));@@ -162,11 +165,10 @@ const BEATS = [const tr = pnTip(p, 1, COL.task), tl = pnTip(p, -1, COL.task);show(tr, m('ends'), .3); show(tl, m('ends'), .3);hide(tr, m('inf', 1.2), .5); hide(tl, m('ninf', 1.2), .5);- text(p, '∞', 1550, Y0 + 18, m('inf'), { size: 60, fill: POS, anchor: 'middle', font: MATH });- text(p, 'infinity', 1540, 690, m('inf', .4), { size: 22, fill: POS, anchor: 'middle', weight: 600 });- text(p, '−∞', 50, Y0 + 18, m('ninf'), { size: 52, fill: NEG, anchor: 'middle', font: MATH });- text(p, 'negative', 60, 690, m('ninf', .4), { size: 22, fill: NEG, anchor: 'middle', weight: 600 });- text(p, 'infinity', 60, 716, m('ninf', .4), { size: 22, fill: NEG, anchor: 'middle', weight: 600 });+ text(p, '∞', 1450, Y0 - 34, m('inf'), { size: 64, fill: POS, anchor: 'middle', font: MATH });+ text(p, 'infinity', 1450, Y0 - 100, m('inf', .4), { size: 28, fill: POS, anchor: 'middle', weight: 600 });+ text(p, '−∞', 150, Y0 - 34, m('ninf'), { size: 64, fill: NEG, anchor: 'middle', font: MATH });+ text(p, 'negative infinity', 150, Y0 - 100, m('ninf', .4), { size: 28, fill: NEG, anchor: 'middle', weight: 600 });text(p, 'Infinity (∞): endless, without any limit', 800, 790, m('word'), { size: 30, fill: COL.dim, anchor: 'middle' });}],['q1', 'Quick check', () => { panel(0); }, { ask: done => quiz(Q1POS, [{@@ -220,7 +222,7 @@ const BEATS = [], done) }],['vertical', 'Upright number lines', (m) => {const p = panel(0);- hide(S.line, 0, .4);+ hide(S.line, m('up'), .4);const Z = 480; // y of zero on both scalesconst above = put(mk('rect', { x: 240, y: 170, width: 1220, height: Z - 170, fill: POS }, p), { o: 0 });tw(above, { o: .08 }, m('rule'), .6);@@ -228,8 +230,8 @@ const BEATS = [tw(below, { o: .08 }, m('rule'), .6);const gT = G(p, { o: 0 });const th = thermometer(gT, { x: 430, bottom: 760, top: 200, lo: -30, hi: 30, step: 10, value: 20, color: COL.task });- show(gT, .3, .6);- text(p, '°C', 430, 160, .5, { size: 26, fill: COL.dim, anchor: 'middle' });+ show(gT, m('up'), .6);+ text(p, '°C', 430, 160, m('up', .3), { size: 26, fill: COL.dim, anchor: 'middle' });mline(p, ['+20°'], 474, th.Yt(20) + 12, m('warm', .6), POS, 40, 'start');th.set(-10, m('drop'), tw, 2.4);mline(p, ['−10°'], 474, th.Yt(-10) + 12, m('cold'), NEG, 40, 'start');@@ -241,10 +243,11 @@ const BEATS = [draw(wave, m('sea', .6), .8);text(p, 'sea level', 1436, Z + 8, m('sea', 1), { size: 22, fill: COL.dim, weight: 600 });const gull = G(p, { x: 1300, y: Yf(30), o: 0 });- path(gull, 'M-24 0Q-12 -14 0 0Q12 -14 24 0', { stroke: COL.chalk, 'stroke-width': 3.5 });+ path(gull, 'M-46 4Q-24 -26 0 2Q24 -26 46 4', { stroke: COL.chalk, 'stroke-width': 5 });+ mk('ellipse', { cy: 4, rx: 12, ry: 7, fill: COL.chalk }, gull);show(gull, m('gull'));const dg = G(p, { x: 1150, y: Yf(30), s: 0, o: 0 }); mk('circle', { r: 10, fill: POS }, dg); pop(dg, m('gull', .4));- text(p, '+30 ft', 1340, Yf(30) + 10, m('gull', .8), { size: 32, fill: POS, weight: 600 });+ text(p, '+30 ft', 1372, Yf(30) + 10, m('gull', .8), { size: 32, fill: POS, weight: 600 });const sub = G(p, { x: 1300, y: Yf(-30), o: 0 });mk('ellipse', { rx: 44, ry: 15, fill: COL.board, stroke: COL.chalk, 'stroke-width': 3 }, sub);mk('rect', { x: -10, y: -28, width: 22, height: 14, rx: 3, fill: COL.board, stroke: COL.chalk, 'stroke-width': 3 }, sub);@@ -264,10 +267,11 @@ const BEATS = [const p = panel(0);show(S.line, .2, .5);landDot(p, 5, .4, POS); landDot(p, -5, .6, NEG);- pnHops(p, 5, 1, m('five'), POS);- text(p, '5 steps', X(2.5), Y0 - 88, m('five', 1.4), { size: 28, fill: POS, anchor: 'middle', weight: 600 });- pnHops(p, 5, -1, m('nfive'), NEG);- text(p, '5 steps', X(-2.5), Y0 - 88, m('nfive', 1.4), { size: 28, fill: NEG, anchor: 'middle', weight: 600 });+ const old = pnHops(p, 5, 1, m('five'), POS);+ old.push(text(p, '5 steps', X(2.5), Y0 - 88, m('five', 1.4), { size: 28, fill: POS, anchor: 'middle', weight: 600 }));+ old.push(...pnHops(p, 5, -1, m('nfive'), NEG));+ old.push(text(p, '5 steps', X(-2.5), Y0 - 88, m('nfive', 1.4), { size: 28, fill: NEG, anchor: 'middle', weight: 600 }));+ old.forEach(e => hide(e, m('flip'), .4));text(p, 'Opposites: same distance from 0, opposite sides', 800, 250, m('opp'), { size: 36, anchor: 'middle', weight: 700 });text(p, '5 and −5 are opposites.', 800, 304, m('opp', 1.4), { size: 30, fill: COL.dim, anchor: 'middle' });pnFlip(p, 5, -5, m('flip', .3), { peak: 400 });@@ -310,25 +314,25 @@ const BEATS = [['A negative number always shows its − sign; the + is optional.', 'w2'],['Opposite quantities get opposite signs: owe −2, save +2.', 'w3'],['Opposites: same distance from 0. Flip twice to get back.', 'w4']].forEach(([str, mk_], i) => {- const g = G(p, { x: -16, y: 250 + i * 130, o: 0 });+ const g = G(p, { x: 69, y: 240 + i * 150, o: 0 });mk('circle', { cx: 200, cy: -12, r: 26, fill: COL.task }, g);T(g, String(i + 1), { x: 200, y: -1, size: 30, fill: COL.board, weight: 700, anchor: 'middle' });- T(g, str, { x: 260, size: 34, weight: 600 });- tw(g, { o: 1, x: 0 }, m(mk_), .6);+ T(g, str, { x: 260, size: 38, weight: 600 });+ tw(g, { o: 1, x: 85 }, m(mk_), .6);});}],['final1', 'Chapter practice', () => { panel(0); }, { ask: done => quiz(SCREEN, [{id: 'p-quantities', prompt: ['Write the integer for each quantity.'],build: pnBlanks(PRACTICE1),- }], done, 'Chapter practice 1 of 3') }],+ }], done, 'Chapter practice · set 1 of 3') }],['final2', 'Chapter practice', () => { panel(0); }, { ask: done => quiz(SCREEN, [{- id: 'p-opposites', prompt: ['Find each number.'],+ id: 'p-opposites', prompt: ['Find each opposite.'],build: pnBlanks(PRACTICE2),- }], done, 'Chapter practice 2 of 3') }],+ }], done, 'Chapter practice · set 2 of 3') }],['final3', 'Chapter practice', () => { panel(0); }, { ask: done => quiz(SCREEN, [{id: 'p-truefalse', prompt: ['True or false?'],build: grid(PRACTICE3, TF, { multi: false, text: true }),- }], done, 'Chapter practice 3 of 3') }],+ }], done, 'Chapter practice · set 3 of 3') }],['finish', 'Finished', () => { panel(0); }, { ask: finishCard }],].map(([id, title, run, extra]) => ({ id, title, run, ...extra }));diff --git a/site/math-notebook/ch03/index.html b/site/math-notebook/ch03/index.htmlindex e330f32..76347fb 100644--- a/site/math-notebook/ch03/index.html+++ b/site/math-notebook/ch03/index.html@@ -271,6 +271,8 @@ const BEATS = [const d6 = landDot(p, 6, m('inside', .8), POS);pulse(r1[0], m('then', .2), 1.6);pnFlip(p, 6, -6, m('flip'), { peak: 420, g: d6 });+ const arc6 = p.lastElementChild;+ hide(arc6, m('seven'), .4); hide(d6, m('seven'), .4);showT(r1, 8, 9, m('flip', 1.4));showT(r2, 0, 3, m('seven'));showT(r2, 4, 7, m('inside2', .3));@@ -279,8 +281,8 @@ const BEATS = [M(ghost, ['7'], { size: 60, fill: COL.bad });path(ghost, 'M-24 8L24 -48', { stroke: COL.bad, 'stroke-width': 4 });show(r2[8], m('wrong'), .4); show(ghost, m('wrong', .3), .4);- text(p, 'not 7', r2[9]._px + 46, 290, m('wrong', 1), { size: 26, fill: COL.bad, weight: 600 });- hide(ghost, m('flip2'), .4);+ const not7 = text(p, 'not 7', r2[9]._px + 46, 290, m('wrong', 1), { size: 26, fill: COL.bad, weight: 600 });+ hide(ghost, m('flip2'), .4); hide(not7, m('flip2'), .4);pnFlip(p, 7, -7, m('flip2'), { peak: 380, g: d7 });show(r2[9], m('flip2', 1.4), .4);text(p, 'Inside first, then outside.', 800, 780, m('rule'), { size: 34, anchor: 'middle', weight: 600 });@@ -323,7 +325,7 @@ const BEATS = [text(p, 'with letters', 1170, 170, m('var'), { size: 28, fill: COL.dim, anchor: 'middle', weight: 600 });eqLine(p, ['ab'], ['a · b'], 300, m('ab'), { xEq: 1170, size: 56 });eqLine(p, ['3x'], ['3 · x'], 410, m('three'), { xEq: 1170, size: 56 });- show(put(mk('circle', { cx: 1170 - 56 * .6 - mathW(['x'], 56) / 2 + 6, cy: 395, r: 21, fill: 'none', stroke: COL.task, 'stroke-width': 3 }, p), { o: 0 }), m('word', .2), .4);+ show(put(mk('circle', { cx: 1170 - 56 * .6 - mathW(['x'], 56) / 2 - 1, cy: 396, r: 18, fill: 'none', stroke: COL.task, 'stroke-width': 3 }, p), { o: 0 }), m('word', .2), .4);text(p, 'Variable: a letter that stands for a number we don’t know yet', 800, 740, m('word', .6), { size: 34, fill: COL.task, anchor: 'middle', weight: 600 });}],['wrap', 'Summary', (m) => {@@ -342,19 +344,19 @@ const BEATS = [['final1', 'Chapter practice', () => { panel(0); }, { ask: done => quiz(SCREEN, [{id: 'p-evaluate', prompt: ['Find each absolute value.'],build: blanks(PRACTICE1),- }], done, 'Chapter practice 1 of 4') }],+ }], done, 'Chapter practice · set 1 of 4') }],['final2', 'Chapter practice', () => { panel(0); }, { ask: done => quiz(SCREEN, [{id: 'p-steps', prompt: ['Evaluate: inside the bars first, then outside.'],build: blanks(PRACTICE2),- }], done, 'Chapter practice 2 of 4') }],+ }], done, 'Chapter practice · set 2 of 4') }],['final3', 'Chapter practice', () => { panel(0); }, { ask: done => quiz(SCREEN, [{id: 'p-world', prompt: ['Answer with a number (no sign needed).'],build: pnBlanks(PRACTICE3),- }], done, 'Chapter practice 3 of 4') }],+ }], done, 'Chapter practice · set 3 of 4') }],['final4', 'Chapter practice', () => { panel(0); }, { ask: done => quiz(SCREEN, [{id: 'p-truefalse', prompt: ['True or false?'],build: grid(PRACTICE4, TF, { multi: false, text: true }),- }], done, 'Chapter practice 4 of 4') }],+ }], done, 'Chapter practice · set 4 of 4') }],['finish', 'Finished', () => { panel(0); }, { ask: finishCard }],].map(([id, title, run, extra]) => ({ id, title, run, ...extra }));diff --git a/site/math-notebook/ch04/index.html b/site/math-notebook/ch04/index.htmlindex 8e4424f..b09bc12 100644--- a/site/math-notebook/ch04/index.html+++ b/site/math-notebook/ch04/index.html@@ -120,7 +120,7 @@ const BEATS=[const p=panel(0);fcTitle(p,'Twenty-four stools for the drama club','Find every pair, then read both ends.');const d=fcDots(p,24,{cx:570,cy:440,cols:6,gap:55,r:10});[[1,24,'one',30],[2,12,'two',55],[3,8,'three',65],[4,6,'five',72]].forEach(([a,b,k,gap],i)=>{fcArrange(d,b,m(k),{cx:570,cy:440,gap});fcPair(p,a,b,1060,295+i*90,m(k,1),40);});fcText(p,'6 × 4 repeats 4 × 6',1050,690,m('reverse'),28,COL.dim);- fcText(p,'factors:',130,785,m('all'),30,COL.dim);fcMath(p,'1, 2, 3, 4, 6, 8, 12, 24',870,785,m('all',1),39,COL.task);+ fcText(p,'factors of 24:',560,785,m('all'),32,COL.dim,'end');fcMath(p,'1, 2, 3, 4, 6, 8, 12, 24',590,785,m('all',1),39,COL.task,'start');}],['lastdigit','Read the last digit',m=>{const p=panel(0);fcTitle(p,'Divisibility shortcuts','Divisible = no remainder');@@ -129,14 +129,14 @@ const BEATS=[draw(path(p,`M${x-20} ${y+16}H${x+22}`,{stroke:COL.task,'stroke-width':5},{d:0}),m(k),.5);fcText(p,`divisible by ${n}`,570,y,m(k,.4),34,COL.task);fcText(p,`last digit: ${rule}`,1020,y,m(k,1),32,COL.dim);});- fcText(p,'Ends in 0 → passes 5 AND 10',800,820,m('overlap'),34,COL.task,'middle');+ fcText(p,'Ends in 0 → passes 5 AND 10',800,790,m('overlap'),34,COL.task,'middle');fcText(p,'65: passes 5 ✓ fails 10 ✗',800,850,m('overlap',4.8),30,COL.dim,'middle');}],['digitsum','Add the digits for 3 and 9',m=>{const p=panel(0);fcTitle(p,'For 3 and 9, test the digit sum');const a=[4,2].map((v,i)=>fcMath(p,String(v),285+i*65,340,.3,65));const b=[2,9,7].map((v,i)=>fcMath(p,String(v),270+i*65,520,.3,65));- fcText(p,'42',130,340,.3,36,COL.dim);fcText(p,'297',130,520,.3,36,COL.dim);- a.forEach((e,i)=>tw(e,{x:620+i*160},m('sum3'),1,io));fcMath(p,'+',700,340,m('sum3',.4),52,COL.dim);fcMath(p,'= 6',965,340,m('sum3',1),52);fcText(p,'passes 3',1210,340,m('sum3',1.7),34,COL.task);- b.forEach((e,i)=>tw(e,{x:570+i*150},m('sum9'),1,io));[645,795].forEach(x=>fcMath(p,'+',x,520,m('sum9',.4),48,COL.dim));fcMath(p,'= 18',1010,520,m('sum9',1),52);fcText(p,'passes 9',1210,520,m('sum9',1.7),34,COL.task);+ fcText(p,'42',450,340,m('sum3'),36,COL.dim);fcText(p,'297',400,520,m('sum9'),36,COL.dim);+ a.forEach((e,i)=>tw(e,{x:620+i*160},m('sum3'),1,io));fcMath(p,'+',700,340,m('sum3',.4),52,COL.dim);fcMath(p,'= 6',900,340,m('sum3',1),65);fcText(p,'passes 3',1210,340,m('sum3',1.7),34,COL.task);+ b.forEach((e,i)=>tw(e,{x:570+i*150},m('sum9'),1,io));[645,795].forEach(x=>fcMath(p,'+',x,520,m('sum9',.4),48,COL.dim));fcMath(p,'= 18',1000,520,m('sum9',1),65);fcText(p,'passes 9',1210,520,m('sum9',1.7),34,COL.task);fcText(p,'42: sum 6 → passes 3, fails 9',800,675,m('compare'),35,COL.task,'middle');fcText(p,'Multiple of 9 → multiple of 3',800,775,m('rule'),34,COL.chalk,'middle');fcText(p,'The reverse is not always true.',800,823,m('rule',3),28,COL.dim,'middle');}],@@ -188,8 +188,8 @@ const BEATS=[blues.slice(12).forEach((e,i)=>tw(e,{x:575+i*90,y:655},m('eight')+i*.01,1.1,io));const badLabel=fcText(p,'12 kits leave 6 blue counters outside.',800,745,m('eight',1.5),32,COL.task,'middle');const badOutline=path(p,'M535 615H1070V695H535Z',{stroke:COL.task,'stroke-width':3},{d:0});draw(badOutline,m('eight',1.3),.6);- badBoxes.forEach(e=>hide(e,m('greatest')));hide(badLabel,m('greatest'));hide(badOutline,m('greatest'));six.forEach(e=>show(e,m('greatest')));show(lab6,m('greatest'));moveSets(6,m('greatest'));- fcText(p,'Greatest number of kits = GCF(12, 18) = 6',800,245,m('greatest'),32,COL.task,'middle');+ badBoxes.forEach(e=>hide(e,m('greatest')));hide(badLabel,m('greatest'));hide(badOutline,m('greatest'));six.forEach(e=>show(e,m('greatest')));moveSets(6,m('greatest'));+ fcText(p,'Greatest number of kits = GCF(12, 18) = 6',800,800,m('greatest'),32,COL.task,'middle');}],['coprime','The GCF can be 1 — or the smaller number',m=>{const p=panel(0);fcTitle(p,'Two useful edge cases');@@ -201,12 +201,12 @@ const BEATS=[}],['wrap','Summary',m=>{const p=panel(0);const rows=[['Factors: equal whole rows, with no leftovers.','w1'],['Divisibility: last digit, or sum of the digits.','w2'],['Prime: exactly two factors. 1 is not prime; 2 is.','w3'],['GCF: largest shared factor; greatest matching groups.','w4']];- rows.forEach(([s,k],i)=>{const g=G(p,{x:-16,y:260+i*140,o:0});mk('circle',{cx:170,cy:-12,r:26,fill:COL.task},g);T(g,String(i+1),{x:170,y:-1,size:30,fill:COL.board,anchor:'middle',weight:700});T(g,s,{x:230,size:36,weight:600});tw(g,{x:0,o:1},m(k),.6);});+ rows.forEach(([s,k],i)=>{const g=G(p,{x:124,y:260+i*140,o:0});mk('circle',{cx:170,cy:-12,r:26,fill:COL.task},g);T(g,String(i+1),{x:170,y:-1,size:30,fill:COL.board,anchor:'middle',weight:700});T(g,s,{x:230,size:36,weight:600});tw(g,{x:140,o:1},m(k),.6);});}],['final1','Chapter practice',()=>panel(0),{ask:done=>quiz(SCREEN,[{id:'p-factors',prompt:['Select ',h('b','','every'),' positive factor of each number.'],build:grid([{parts:['18'],ans:['1','2','3','6','9','18'],why:'18 = 1×18 = 2×9 = 3×6. Collect both ends of each pair.'},{parts:['24'],ans:['1','2','3','4','6','8','12','24'],why:'24 = 1×24 = 2×12 = 3×8 = 4×6.'}- ],[1,2,3,4,6,8,9,12,18,24].map((v,i)=>[String(v),String(v),COL.chalk,String((i+1)%10)]))}],done,'Chapter practice 1 of 4')}],+ ],[1,2,3,4,6,8,9,12,18,24].map((v,i)=>[String(v),String(v),COL.chalk,String((i+1)%10)]))}],done,'Chapter practice · set 1 of 4')}],['final2','Chapter practice',()=>panel(0),{ask:done=>quiz(SCREEN,[{id:'p-divisibility',prompt:'Is each statement true?',build:grid([{parts:['462 is divisible by 2.'],ans:['y'],why:'Its last digit is 2, which is even.'},{parts:['537 is divisible by 3.'],ans:['y'],why:'5 + 3 + 7 = 15, and 15 is divisible by 3.'},@@ -214,13 +214,13 @@ const BEATS=[{parts:['2,145 is divisible by 10.'],ans:['n'],why:'The last digit must be 0, not 5.'},{parts:['51 is divisible by 9.'],ans:['n'],why:'5 + 1 = 6. It passes 3, but fails 9.'},{parts:['Every multiple of 9 is a multiple of 3.'],ans:['y'],why:'9 = 3×3, so any whole number of nines is also a whole number of threes.'}- ],FC_YN,{multi:false,text:true})}],done,'Chapter practice 2 of 4')}],+ ],FC_YN,{multi:false,text:true})}],done,'Chapter practice · set 2 of 4')}],['final3','Chapter practice',()=>panel(0),{ask:done=>quiz(SCREEN,[{id:'p-gcf',prompt:'Find each greatest common factor.',build:blanks([{parts:['GCF(14, 35) = ',{box:'7'}],why:'Shared factors: 1 and 7. The greatest is 7.'},{parts:['GCF(35, 64) = ',{box:'1'}],why:'35 has factors 1,5,7,35; 64 has factors 1,2,4,8,16,32,64. Only 1 is shared.'},{parts:['GCF(16, 48) = ',{box:'16'}],why:'16 itself divides 48: 16 × 3 = 48.'},{parts:['GCF(20, 50) = ',{box:'10'}],why:'Shared factors: 1,2,5,10. The greatest is 10.'}- ])}],done,'Chapter practice 3 of 4')}],+ ])}],done,'Chapter practice · set 3 of 4')}],['final4','Chapter practice',()=>panel(0),{ask:done=>quiz(SCREEN,[{id:'p-kits',prompt:['An art club has ',h('b','','15 blue counters'),' and ',h('b','','25 coral counters'),'. Make the greatest number of identical kits, with no leftovers.'],build:blanks([{parts:['number of kits = ',{box:'5'}],why:'GCF(15,25) = 5. A smaller common factor would not give the greatest number of kits.'},@@ -228,7 +228,7 @@ const BEATS=[{parts:['coral in each = ',{box:'5'}],why:'25 ÷ 5 = 5 coral counters per kit. The blue/coral counts can differ; the kits match.'}])},{id:'p-primes',prompt:'Is each number prime?',build:grid([{parts:['1'],ans:['n'],why:'1 has only one positive factor, so it is not prime.'},{parts:['2'],ans:['y'],why:'2 has exactly two positive factors: 1 and 2.'}],FC_YN,{multi:false})}- ],done,'Chapter practice 4 of 4')}],+ ],done,'Chapter practice · set 4 of 4')}],['finish','Finished',()=>panel(0),{ask:finishCard}]].map(([id,title,run,extra])=>({id,title,run,...extra}));boot();diff --git a/site/math-notebook/ch05/index.html b/site/math-notebook/ch05/index.htmlindex 9d8f66c..cd4ad57 100644--- a/site/math-notebook/ch05/index.html+++ b/site/math-notebook/ch05/index.html@@ -21,7 +21,7 @@ function mcTitle(p,s,sub=''){mcText(p,s,100,120,.1,44);if(sub)mcText(p,sub,100,1function mcChip(p,v,x,y,t=0,col=COL.task,w=80){const g=G(p,{x,y,o:0});mk('rect',{x:-w/2,y:-30,width:w,height:60,rx:12,fill:COL.board,stroke:col,'stroke-width':2},g);T(g,String(v),{y:12,size:34,fill:col,anchor:'middle'});show(g,t);return g;}function mcDots(p,n,cx,cy,cols,gap=35,col=COL.chalk,t=.2){const rows=Math.ceil(n/cols);return Array.from({length:n},(_,i)=>{const e=G(p,{x:cx+(i%cols-(cols-1)/2)*gap,y:cy+(Math.floor(i/cols)-(rows-1)/2)*gap,o:0});mk('circle',{r:9,fill:col},e);show(e,t+i*.015);return e;});}function mcBundle(p,cx,cy,t){const g=G(p,{x:cx,y:cy,o:0});mk('rect',{x:-70,y:-70,width:140,height:140,rx:16,fill:'none',stroke:MC_A,'stroke-width':2.5},g);[-24,24].forEach(x=>[-24,24].forEach(y=>mk('circle',{cx:x,cy:y,r:11,fill:MC_A},g)));show(g,t);return g;}-function mcTrack(p,step,max,y,col,t=.2,{label=String(step),arcs=true,ends=true}={}){+function mcTrack(p,step,max,y,col,t=.2,{label='+'+step,arcs=true,ends=true}={}){const x=v=>240+v/max*1160;const g=G(p);mcText(g,label,135,y+12,.2,36,col,'middle');path(g,`M240 ${y}H1420`,{stroke:COL.faint,'stroke-width':2});for(let v=0;v<=max;v++)path(g,`M${x(v)} ${y-5}V${y+5}`,{stroke:COL.faint,'stroke-width':1});@@ -38,7 +38,7 @@ function mcPairTracks(p,a,b,max,ta=.2,tb=.2,match=.2){for(let v=1;v<=max;v++)if(v%a===0&&v%b===0){const x=A.x(v);draw(path(p,`M${x} 327V330M${x} 374V457`,{stroke:COL.task,'stroke-width':3,'stroke-dasharray':'7 7'},{d:0}),match,.6);const el=mcChip(p,v,x,610,match+.4);shared.push({el,v,box:[x-46,572,92,77],label:`Shared positive endpoint ${v}`});}return {A,B,shared};}-function mcCoinGroups(dots,size,cy,t){const ng=dots.length/size,groupGap=1000/ng,inside=size===6?22:21;dots.forEach((e,i)=>{const k=Math.floor(i/size),j=i%size;tw(e,{x:300+k*groupGap+(j-(size-1)/2)*inside,y:cy},t+i*.018,1.1,io);});}+function mcCoinGroups(dots,size,cy,t){const ng=dots.length/size,groupGap=1000/ng,inside=30;dots.forEach((e,i)=>{const k=Math.floor(i/size),j=i%size;tw(e,{x:800+(k-(ng-1)/2)*groupGap+(j-(size-1)/2)*inside,y:cy},t+i*.018,1.1,io);});}const BEATS=[['intro','Multiples and LCM',(m,D)=>{const g=G(scene,{o:0,y:24});T(g,'Unit 1 · The Number System · Chapter 5',{x:800,y:260,size:28,fill:COL.dim,anchor:'middle'});T(g,'Multiples and',{x:800,y:370,size:82,weight:600,anchor:'middle'});T(g,'Least Common Multiple',{x:800,y:470,size:76,weight:600,anchor:'middle'});tw(g,{o:1,y:0},.2,1.1,out);[4,6].forEach((n,i)=>mcDots(g,n,680+i*240,555,n,26,i?MC_B:MC_A,.8));const s=mcText(scene,'When will repeating patterns line up?',800,700,m('sub'),34,COL.dim,'middle');hide(g,D-.8,.7);hide(s,D-.8,.7);}],['bundles','Build multiples from equal groups',m=>{const p=panel(0);mcTitle(p,'Grow the number of bundles','Every complete bundle holds 4 dots.');[350,650,950,1250].forEach((x,i)=>mcBundle(p,x,360,i?m(['one','two','three','four'][i]):.2));const keys=['one','two','three','four'];keys.forEach((key,i)=>{const g=G(p,{o:0}),x2=420+i*300;path(g,`M280 450v16h${x2-280}v-16`,{stroke:MC_A,'stroke-width':3});T(g,`${i+1} ${i?'bundles':'bundle'} so far`,{x:(280+x2)/2,y:515,size:30,fill:MC_A,anchor:'middle'});M(g,[`4 × ${i+1} = ${4*(i+1)}`],{x:800,y:605,size:52,fill:MC_A,anchor:'middle'});show(g,m(key));if(i<3)hide(g,m(keys[i+1]));});mcText(p,'4, 8, 12, 16, …',800,730,m('rule'),48,COL.task,'middle');mcText(p,'Each total is a whole number of complete bundles.',800,810,m('rule',2),31,COL.dim,'middle');}],@@ -48,20 +48,20 @@ const BEATS=[['least','Least means first positive match',m=>{const p=panel(0);mcTitle(p,'Read shared totals from smallest to largest');const q=mcPairTracks(p,4,6,24,.2,.2,.4);const first=q.shared[0].el;pulse(first,m('first'),1.25);draw(path(p,`M${q.A.x(12)-58} 565h116v90h-116Z`,{stroke:COL.task,'stroke-width':4},{d:0}),m('first'),.6);pulse(q.shared[1].el,m('later'),1.1);mcText(p,'0 = start; use positive totals',800,745,m('zero'),32,COL.dim,'middle');mcText(p,'LCM(4, 6) = 12',800,815,m('name'),46,COL.task,'middle');}],['q2','Quick check',()=>{const p=panel(0);mcTitle(p,'Which shared endpoint is the least common multiple?');S.mcShared=mcPairTracks(p,4,6,24,.2,.2,.2).shared;},{ask:done=>quiz(BAND,[{id:'c-first',prompt:'Choose the first positive total reached by BOTH tracks.',build:pickEls(S.mcShared,0,'12 is the first positive match: 3 × 4 = 2 × 6.',()=> '24 works for both tracks, but 12 is a smaller positive match.',()=>pulseFx(S.mcShared[0].el,1.3))}],done)}],['nines','Lists meet at ninety-nine',m=>{const p=panel(0);mcTitle(p,'Find the first shared value','Add the same group size at every step.');mcText(p,'9',110,350,.2,42,MC_A);mcText(p,'11',110,505,.2,42,MC_B);Array.from({length:11},(_,i)=>mcChip(p,9*(i+1),230+i*108,335,i?m('nine')+i*.22:.2,MC_A,72));const b=Array.from({length:9},(_,i)=>mcChip(p,11*(i+1),230+i*108,490,i?m('eleven')+i*.22:.2,MC_B,72));tw(b[8],{x:1310},m('match'),1,io);draw(path(p,'M1310 371V454',{stroke:COL.task,'stroke-width':4},{d:0}),m('match',1),.5);mcText(p,'81 → 90 → 99: do not skip a step',800,665,m('nine',3),32,COL.dim,'middle');mcText(p,'LCM(9, 11) = 99',800,780,m('match',1.5),48,COL.task,'middle');}],-['shortcut','Test the larger-number list',m=>{const p=panel(0);mcTitle(p,'One ordered list can do the job','Every candidate is already a multiple of 11.');const vals=Array.from({length:9},(_,i)=>11*(i+1));vals.forEach((v,i)=>{const x=300+(i%5)*245,y=i<5?335:520;const el=mcChip(p,v,x,y,i?m('start')+i*.12:.2,i===8?COL.task:MC_B,96);if(i<8)mcText(p,'remainder',x,y+70,m('test')+i*.25,25,COL.dim,'middle');else pulse(el,m('whole'),1.2);});mcMath(p,'99 ÷ 9 = 11',800,730,m('whole'),48,COL.task);mcText(p,'First candidate that passes both → LCM',800,815,m('stop'),34,COL.dim,'middle');}],+['shortcut','Test the larger-number list',m=>{const p=panel(0);mcTitle(p,'One ordered list can do the job','Every candidate is already a multiple of 11.');const vals=Array.from({length:9},(_,i)=>11*(i+1));vals.forEach((v,i)=>{const x=i<5?300+i*245:800+(i-7.5)*245,y=i<5?335:520;const el=mcChip(p,v,x,y,i?m('start')+i*.12:.2,i===8?COL.task:MC_B,96);if(i<8)mcText(p,`÷9 → R ${v%9}`,x,y+72,m('test')+i*.25,30,COL.dim,'middle');else{pulse(el,m('whole'),1.2);mcText(p,'÷9 = 11 ✓',x,y+72,m('whole'),30,COL.task,'middle');}});mcMath(p,'99 ÷ 9 = 11',800,730,m('whole'),48,COL.task);mcText(p,'First candidate that passes both → LCM',800,815,m('stop'),34,COL.dim,'middle');}],['divides','When one number divides the other',m=>{const p=panel(0);mcTitle(p,'What if the larger number already works?','Blue: groups of 6 Coral: groups of 18');mcPairTracks(p,6,18,36,.2,m('eighteen'),m('eighteen',1));mcMath(p,'18 = 3 × 6',750,730,m('eighteen',1.5),46,COL.task);mcText(p,'18 is the smallest positive multiple of 18.',800,795,m('small'),32,COL.dim,'middle');mcText(p,'LCM(6, 18) = 18',800,850,m('rule'),36,COL.task,'middle');}],-['triple','Common means every row',m=>{const p=panel(0);mcTitle(p,'Three group sizes: 3, 4, and 6');const a=mcTrack(p,3,12,290,MC_A,.2),b=mcTrack(p,4,12,460,MC_B,.2),c=mcTrack(p,6,12,630,COL.chalk,.2);const x=a.x(6);draw(path(p,`M${x} 355V605`,{stroke:COL.task,'stroke-width':2,'stroke-dasharray':'7 8'},{d:0}),m('six'),.5);mcText(p,'6 misses the 4 row',710,545,m('six',1),28,COL.task,'end');draw(path(p,'M1400 305V308M1400 354V478M1400 524V615',{stroke:COL.task,'stroke-width':4},{d:0}),m('twelve'),.6);mcText(p,'4 × 3 = 3 × 4 = 2 × 6 = 12',800,755,m('twelve'),39,COL.task,'middle');mcText(p,'LCM(3, 4, 6) = 12',800,825,m('all'),42,COL.task,'middle');}],+['triple','Common means every row',m=>{const p=panel(0);mcTitle(p,'Three group sizes: 3, 4, and 6');const a=mcTrack(p,3,12,290,MC_A,.2),b=mcTrack(p,4,12,460,MC_B,.2),c=mcTrack(p,6,12,630,COL.chalk,.2);const x=a.x(6);draw(path(p,`M${x} 355V605`,{stroke:COL.task,'stroke-width':2,'stroke-dasharray':'7 8'},{d:0}),m('six'),.5);mcText(p,'6 is not',1445,465,m('six',1),26,COL.task);mcText(p,'on this row',1445,497,m('six',1),26,COL.task);draw(path(p,'M1400 305V308M1400 354V478M1400 524V615',{stroke:COL.task,'stroke-width':4},{d:0}),m('twelve'),.6);mcText(p,'4 × 3 = 3 × 4 = 2 × 6 = 12',800,755,m('twelve'),39,COL.task,'middle');mcText(p,'LCM(3, 4, 6) = 12',800,825,m('all'),42,COL.task,'middle');}],['schedule','The first shared inspection',m=>{const p=panel(0);mcTitle(p,'Two bikes. One shared inspection day.','Blue: inspect every 4 days Coral: inspect every 10 days');mcText(p,'start together',240,235,m('start'),27,COL.dim,'middle');mcPairTracks(p,4,10,20,m('five'),m('six'),m('meet'));mcText(p,'Day 20: 5 × 4 = 2 × 10',800,750,m('meet',1),44,COL.task,'middle');mcText(p,'20 days after their shared starting day',800,820,m('meet',3),32,COL.dim,'middle');}],['q3','Quick check',()=>{const p=panel(0);mcTitle(p,'When do both bikes first need inspection together?','Blue: every 4 days. Coral: every 10 days.');const A=mcTrack(p,4,20,310,MC_A,.2),B=mcTrack(p,10,20,475,MC_B,.2);S.mcDays=[4,8,12,16,20].map(v=>{const el=mcChip(p,v,A.x(v),610,.4,COL.task,70);return {el,v,box:[A.x(v)-41,573,82,75],label:`Day ${v}`};});},{ask:done=>quiz(BAND,[{id:'c-reunion',prompt:'Pick the earliest positive day that appears on both inspection tracks.',build:pickEls(S.mcDays,4,'Day 20 is the first shared inspection: five 4-day periods, or two 10-day periods.',i=>`Day ${S.mcDays[i].v} is on the four-day track, but it is not divisible by 10.`,()=>pulseFx(S.mcDays[4].el,1.3))}],done)}],-['coins','The smallest equal total',m=>{const p=panel(0);mcTitle(p,'Equal totals. Different complete groups.','Blue collector: groups of 6 Coral collector: groups of 8');mcText(p,'8, 16',420,250,m('eight'),36,MC_B,'middle');mcText(p,'neither divides into whole groups of 6',1020,250,m('eight',1),29,COL.dim,'middle');const aa=mcDots(p,24,800,400,12,38,MC_A,.2),bb=mcDots(p,24,800,590,12,38,MC_B,.2);mcCoinGroups(aa,6,390,m('six'));mcCoinGroups(bb,8,590,m('six'));[6,8].forEach((size,r)=>{const ng=24/size,cy=r?590:390;for(let k=0;k<ng;k++){const x=300+k*1000/ng;const g=G(p,{o:0});mk('rect',{x:x-size*24/2,y:cy-36,width:size*24,height:72,rx:12,fill:'none',stroke:r?MC_B:MC_A,'stroke-width':2},g);show(g,m('six',1));}});mcText(p,'4 groups of 6 = 24',800,480,m('total'),32,MC_A,'middle');mcText(p,'3 groups of 8 = 24',800,680,m('total',1),32,MC_B,'middle');mcText(p,'24 coins for EACH collector',800,760,m('total',2),42,COL.task,'middle');mcText(p,'Smallest shared total, with no leftovers.',800,830,m('why'),31,COL.dim,'middle');}],-['wrap','Summary',m=>{const p=panel(0);[['Multiples: totals of complete equal groups.','w1'],['Common multiples: totals every group size can reach.','w2'],['LCM: first positive shared total.','w3'],['Use it: first reunions and smallest equal totals.','w4']].forEach(([s,k],i)=>{const g=G(p,{x:-16,y:260+i*140,o:0});mk('circle',{cx:155,cy:-12,r:26,fill:COL.task},g);T(g,String(i+1),{x:155,y:-1,size:30,fill:COL.board,anchor:'middle',weight:700});T(g,s,{x:215,size:35,weight:600});tw(g,{x:0,o:1},m(k),.6);});}],-['final1','Chapter practice',()=>panel(0),{ask:done=>quiz(SCREEN,[{id:'p-lists',prompt:'Write the first five positive multiples, in increasing order.',build:blanks([{parts:['7: ',{box:'7'},', ',{box:'14'},', ',{box:'21'},', ',{box:'28'},', ',{box:'35'}],why:'Start with 7 × 1 = 7; add 7 each time.',hint:'Each next total is one more complete group of 7.'},{parts:['9: ',{box:'9'},', ',{box:'18'},', ',{box:'27'},', ',{box:'36'},', ',{box:'45'}],why:'Start with 9 × 1 = 9; add 9 each time.',hint:'Start with one group, then add 9 at each step.'}])}],done,'Chapter practice 1 of 3')}],-['final2','Chapter practice',()=>panel(0),{ask:done=>quiz(SCREEN,[{id:'p-lcm',prompt:'Find each least common multiple.',build:blanks([{parts:['LCM(6, 10) = ',{box:'30'}],why:'10,20,30… first divides exactly by 6 at 30.'},{parts:['LCM(8, 12) = ',{box:'24'}],why:'8,16,24… meets 12,24… at 24.'},{parts:['LCM(10, 15) = ',{box:'30'}],why:'15,30… first divides exactly by 10 at 30.'},{parts:['LCM(7, 28) = ',{box:'28'}],why:'28 itself is 4 × 7; no smaller positive multiple of 28 exists.'}])}],done,'Chapter practice 2 of 3')}],+['coins','The smallest equal total',m=>{const p=panel(0);mcTitle(p,'Equal totals. Different complete groups.','Blue collector: groups of 6 Coral collector: groups of 8');const demo=G(p);[[8,390,'8 = 6 + 2 left over',0],[16,590,'16 = 12 + 4 left over',2]].forEach(([n,cy,lab,dt])=>{mcDots(demo,n,520,cy,n,38,COL.chalk,m('eight')+dt);mcText(demo,lab,880,cy+12,m('eight')+dt+.4,32,COL.dim);});hide(demo,m('six'),.4);const aa=mcDots(p,24,800,390,24,36,MC_A,m('six')+.3),bb=mcDots(p,24,800,590,24,36,MC_B,m('six')+.3);mcCoinGroups(aa,6,390,m('six')+1.5);mcCoinGroups(bb,8,590,m('six')+1.5);[6,8].forEach((size,r)=>{const ng=24/size,cy=r?590:390;for(let k=0;k<ng;k++){const x=800+(k-(ng-1)/2)*1000/ng;const g=G(p,{o:0});mk('rect',{x:x-size*16,y:cy-36,width:size*32,height:72,rx:12,fill:'none',stroke:r?MC_B:MC_A,'stroke-width':2},g);show(g,m('six',3.4));}});mcText(p,'4 groups of 6 = 24',800,480,m('total'),32,MC_A,'middle');mcText(p,'3 groups of 8 = 24',800,680,m('total',1),32,MC_B,'middle');mcText(p,'24 coins for EACH collector',800,760,m('total',2),42,COL.task,'middle');mcText(p,'Smallest shared total, with no leftovers.',800,830,m('why'),31,COL.dim,'middle');}],+['wrap','Summary',m=>{const p=panel(0);[['Multiples: totals of complete equal groups.','w1'],['Common multiples: totals every group size can reach.','w2'],['LCM: first positive shared total.','w3'],['Use it: first reunions and smallest equal totals.','w4']].forEach(([s,k],i)=>{const g=G(p,{x:34,y:290+i*150,o:0});mk('circle',{cx:155,cy:-12,r:30,fill:COL.task},g);T(g,String(i+1),{x:155,y:0,size:34,fill:COL.board,anchor:'middle',weight:700});T(g,s,{x:215,size:44,weight:600});tw(g,{x:50,o:1},m(k),.6);});}],+['final1','Chapter practice',()=>panel(0),{ask:done=>quiz(SCREEN,[{id:'p-lists',prompt:'Write the first five positive multiples, in increasing order.',build:blanks([{parts:['7: ',{box:'7'},', ',{box:'14'},', ',{box:'21'},', ',{box:'28'},', ',{box:'35'}],why:'Start with 7 × 1 = 7; add 7 each time.',hint:'Each next total is one more complete group of 7.'},{parts:['9: ',{box:'9'},', ',{box:'18'},', ',{box:'27'},', ',{box:'36'},', ',{box:'45'}],why:'Start with 9 × 1 = 9; add 9 each time.',hint:'Start with one group, then add 9 at each step.'}])}],done,'Chapter practice · set 1 of 3')}],+['final2','Chapter practice',()=>panel(0),{ask:done=>quiz(SCREEN,[{id:'p-lcm',prompt:'Find each least common multiple.',build:blanks([{parts:['LCM(6, 10) = ',{box:'30'}],why:'10,20,30… first divides exactly by 6 at 30.'},{parts:['LCM(8, 12) = ',{box:'24'}],why:'8,16,24… meets 12,24… at 24.'},{parts:['LCM(10, 15) = ',{box:'30'}],why:'15,30… first divides exactly by 10 at 30.'},{parts:['LCM(7, 28) = ',{box:'28'}],why:'28 itself is 4 × 7; no smaller positive multiple of 28 exists.'}])}],done,'Chapter practice · set 2 of 3')}],['final3','Chapter practice',()=>panel(0),{ask:done=>quiz(SCREEN,[{id:'p-visits',prompt:'Two friends start together. One visits a community workshop every 3 days, the other every 5 days. Find their first shared return.',build:blanks([{parts:[{box:'15'},' days after the start'],why:'LCM(3,5) = 15: five 3-day periods and three 5-day periods.'}])},{id:'p-packages',prompt:'Two shops receive equal positive item totals. One receives complete packages of 4 items, the other packages of 10. What is the least total for each?',build:blanks([{parts:[{box:'20'},' items each'],why:'LCM(4,10) = 20: five packages of four or two packages of ten.'}])},{id:'p-flowers',prompt:'Ana and Ben have equal positive flower totals. Ana makes bouquets of 5, Ben bouquets of 9, with no leftovers. Find the least total for each.',build:blanks([{parts:[{box:'45'},' flowers each'],why:'LCM(5,9) = 45 flowers: Ana has 9 bouquets, Ben 5. Flowers and bouquets are different units.'}])}- ],done,'Chapter practice 3 of 3')}],+ ],done,'Chapter practice · set 3 of 3')}],['finish','Finished',()=>panel(0),{ask:finishCard}]].map(([id,title,run,extra])=>({id,title,run,...extra}));boot();diff --git a/site/math-notebook/ch06/index.html b/site/math-notebook/ch06/index.htmlindex 646a43d..804ea56 100644--- a/site/math-notebook/ch06/index.html+++ b/site/math-notebook/ch06/index.html@@ -29,10 +29,10 @@ function fbCandidates(p,data,y=305){return data.map((v,i)=>{const x=155+i*470,g=const BEATS=[['intro','Fraction basics',(m,D)=>{const g=G(scene,{o:0,y:24});T(g,'Unit 1 · The Number System · Chapter 6',{x:800,y:235,size:28,fill:COL.dim,anchor:'middle'});T(g,'Fraction Basics',{x:800,y:345,size:82,weight:600,anchor:'middle'});T(g,'Types · Adding · Subtracting',{x:800,y:435,size:49,anchor:'middle'});tw(g,{o:1,y:0},.2,1,out);const b=fbBar(g,560,490,480,3,2,FB_A,.5,90,{cuts:false});b.lines.forEach(e=>show(e,m('sub')));const s=fbText(scene,'Make the equal pieces explain the numbers.',800,720,m('sub'),34,COL.dim,'middle');hide(g,D-.8,.7);hide(s,D-.8,.7);}],['parts','Pieces of ONE whole',m=>{const p=panel(0);fbTitle(p,'Count equal pieces of one whole','The outline always means one whole strip.');const b=fbBar(p,200,300,840,6,0,FB_A,.2,140,{cuts:false});b.lines.forEach(e=>show(e,m('split')));const color=fbPieces(p,4,6,200,300,840,FB_A,m('count'),140);fbText(p,'one whole → 6 equal pieces',620,520,m('split'),34,COL.dim,'middle');fbMath(p,[F('4','6')],1210,375,m('count'),85,FB_A);fbText(p,'4 = numerator',1100,515,m('names'),32,FB_A);fbText(p,'pieces we have',1100,557,m('names',1),28,COL.dim);fbText(p,'6 = denominator',1100,645,m('names',2),32,COL.task);fbText(p,'equal pieces in ONE whole',1100,687,m('names',3),25,COL.dim);fbText(p,'The unit whole and the equal piece size matter.',800,810,m('names',6),32,COL.dim,'middle');}],-['equal','Equal pieces matter',m=>{const p=panel(0);fbTitle(p,'Three pieces does not always mean thirds');const a=fbBar(p,250,270,900,3,2,FB_A,.2,120,{uneven:[0,150,300,900]});fbText(p,'Unequal pieces: do not count these as thirds',700,445,m('uneven'),32,COL.task,'middle');const b=fbBar(p,250,540,900,3,2,FB_A,m('equal'),120);fbMath(p,[F('2','3')],1300,610,m('equal'),65,FB_A);fbText(p,'Equal pieces → two thirds',700,720,m('equal',1),34,FB_A,'middle');fbText(p,'One whole? Equal pieces?',800,815,m('one'),37,COL.task,'middle');}],-['remainder','What is left over?',m=>{const p=panel(0);fbTitle(p,'Share 11 snack bars among 3 friends','First share whole bars equally.');const es=Array.from({length:11},(_,i)=>{const e=G(p,{x:260+i*95,y:300,o:0});mk('rect',{x:-27,y:-18,width:54,height:36,rx:4,fill:FB_A},e);show(e,.2+i*.04);return e;});for(let j=0;j<3;j++){const x=350+j*420;fbText(p,['Ana','Bo','Cai'][j],x,545,m('share'),33,COL.dim,'middle');draw(path(p,`M${x-150} 365h300v130h-300Z`,{stroke:COL.dim,'stroke-width':2},{d:0}),m('share'),.5);for(let i=0;i<3;i++)tw(es[j*3+i],{x:x+(i-1)*75,y:420},m('share')+j*.2,1.2);}[9,10].forEach((i,k)=>tw(es[i],{x:710+k*100,y:650},m('left'),1));const rlab=fbText(p,'2 left over = remainder 2',800,740,m('left',1),35,COL.task,'middle');hide(rlab,m('fraction'),.5);fbMath(p,'11 ÷ 3 = 3 R 2',900,815,m('left',2),40);fbText(p,'Whole bars only:',390,815,m('left',2),27,COL.dim);[9,10].forEach((idx,k)=>{[-9,9].forEach(xx=>draw(path(es[idx],`M${xx} -18V18`,{stroke:COL.chalk,'stroke-width':2},{d:0}),m('fraction'),.7));hide(es[idx],m('fraction',1.2),.1);for(let j=0;j<3;j++){const e=G(p,{x:710+k*100-27+j*18,y:632,o:0});mk('rect',{width:18,height:36,fill:FB_A,stroke:COL.chalk,'stroke-width':1.5},e);show(e,m('fraction',1.2));tw(e,{x:350+j*420-18+k*18,y:456},m('fraction',1.5),1.3,io);}});fbText(p,'Split both leftover bars into thirds.',800,230,m('fraction'),30,COL.dim,'middle');fbMath(p,['Each share: 3 + ',F('2','3'),' snack bars'],800,665,m('fraction',3),37,FB_A);}],-['q1','Quick check',()=>{const p=panel(0);fbTitle(p,'Which picture really shows two thirds?','Each outline is one whole strip.');S.fbEq=fbCandidates(p,[{d:3,n:2,uneven:[0,70,140,350],label:'A · unequal pieces'},{d:3,n:2,label:'B · equal thirds'},{d:3,n:1,label:'C · equal thirds'}]);},{ask:done=>quiz(BAND,[{id:'c-equal',prompt:'Choose the picture with TWO of THREE equal pieces filled.',build:pickEls(S.fbEq,1,'B shows two equal thirds. The denominator counts three equal pieces in ONE whole.',i=>i===0?'A has unequal pieces. Counting two of them does not make two thirds.':'C has only one of its three equal pieces filled.',()=>pulseFx(S.fbEq[1].el,1.08))}],done)}],-['types','Three ways to describe fractions',m=>{const p=panel(0);fbTitle(p,'Positive examples: compare with one whole');const xs=[160,650,1140];fbBar(p,xs[0],260,300,4,3,FB_A,.2);fbBar(p,xs[1],260,300,4,4,FB_A,.2);fbBar(p,xs[1],370,300,4,1,FB_A,m('improper'));fbBar(p,xs[2],260,300,4,4,FB_A,.2);fbBar(p,xs[2],370,300,4,1,FB_A,m('mixed'));[['proper','Proper',[F('3','4')],'3 < 4 → less than 1'],['improper','Improper',[F('5','4')],'5 ≥ 4 → at least 1'],['mixed','Mixed',['1 ',F('1','4')],'whole + proper part']].forEach(([k,s,v,n],i)=>{fbText(p,s,xs[i]+150,535,m(k),37,COL.task,'middle');fbMath(p,v,xs[i]+150,625,m(k),57);fbText(p,n,xs[i]+150,715,m(k,1),28,COL.dim,'middle');});fbText(p,'Signs do not change type: compare magnitudes (absolute values).',800,810,m('mixed',3),27,COL.dim,'middle');}],+['equal','Equal pieces matter',m=>{const p=panel(0);fbTitle(p,'Three pieces does not always mean thirds');const a=fbBar(p,350,270,900,3,2,FB_A,.2,120,{uneven:[0,150,300,900]});fbText(p,'Unequal pieces: do not count these as thirds',800,445,m('uneven'),32,COL.task,'middle');const b=fbBar(p,350,540,900,3,2,FB_A,m('equal'),120);fbText(p,'Equal pieces → two thirds =',985,735,m('equal',3),34,FB_A,'end');fbMath(p,[F('2','3')],1018,740,m('equal',3),60,FB_A);fbText(p,'One whole? Equal pieces?',800,842,m('one'),37,COL.task,'middle');}],+['remainder','What is left over?',m=>{const p=panel(0);fbTitle(p,'Share 11 snack bars among 3 friends');const sub=fbText(p,'First share whole bars equally.',100,171,.2,27,COL.dim);hide(sub,m('fraction'),.4);fbText(p,'Split both leftover bars into thirds.',100,171,m('fraction',.4),27,COL.dim);const BW=72,BH=44,fx=j=>350+j*450;const es=Array.from({length:11},(_,i)=>{const e=G(p,{x:300+i*100,y:255,o:0});mk('rect',{x:-BW/2,y:-BH/2,width:BW,height:BH,rx:5,fill:FB_A},e);show(e,.2+i*.04);return e;});for(let j=0;j<3;j++){const x=fx(j);fbText(p,['Ana','Bo','Cai'][j],x,550,m('share'),33,COL.dim,'middle');draw(path(p,`M${x-180} 330h360v170h-360Z`,{stroke:COL.dim,'stroke-width':2},{d:0}),m('share'),.5);}for(let i=0;i<9;i++){const r=Math.floor(i/3);tw(es[i],{x:fx(i%3)+(r-1)*100,y:380},m('share',.5+r*.9),.8,io);}[9,10].forEach((i,k)=>tw(es[i],{x:750+k*100,y:610},m('left'),1,io));const rlab=fbText(p,'2 left over = remainder 2',800,690,m('left',1),35,COL.task,'middle');hide(rlab,m('fraction'),.5);fbMath(p,'Whole bars only: 11 ÷ 3 = 3 R 2',800,800,m('left',1.6),42);[9,10].forEach((idx,k)=>{[-BW/6,BW/6].forEach(xx=>draw(path(es[idx],`M${xx} ${-BH/2}V${BH/2}`,{stroke:COL.chalk,'stroke-width':2},{d:0}),m('fraction'),.7));hide(es[idx],m('fraction',1.2),.1);for(let j=0;j<3;j++){const e=G(p,{x:750+k*100-BW/2+j*BW/3,y:610-BH/2,o:0});mk('rect',{width:BW/3,height:BH,fill:FB_A,stroke:COL.chalk,'stroke-width':1.5},e);show(e,m('fraction',1.2));tw(e,{x:fx(j)-BW/3+k*BW/3,y:440},m('fraction',1.5),1.3,io);}});fbMath(p,['Each share: 3 + ',F('2','3'),' snack bars'],800,690,m('fraction',3.5),52,FB_A);}],+['q1','Quick check',()=>{const p=panel(0);fbTitle(p,'Which picture really shows two thirds?','Each outline is one whole strip.');S.fbEq=fbCandidates(p,[{d:3,n:2,uneven:[0,70,140,350],label:'A'},{d:3,n:2,label:'B'},{d:3,n:1,label:'C'}]);},{ask:done=>quiz(BAND,[{id:'c-equal',prompt:'Choose the picture with TWO of THREE equal pieces filled.',build:pickEls(S.fbEq,1,'B shows two equal thirds. The denominator counts three equal pieces in ONE whole.',i=>i===0?'A has unequal pieces. Counting two of them does not make two thirds.':'C has only one of its three equal pieces filled.',()=>pulseFx(S.fbEq[1].el,1.08))}],done)}],+['types','Three ways to describe fractions',m=>{const p=panel(0);fbTitle(p,'Compare each amount with one whole');const xs=[160,650,1140];fbBar(p,xs[0],260,300,4,3,FB_A,.2);fbBar(p,xs[1],260,300,4,4,FB_A,.2);fbBar(p,xs[1],370,300,4,1,FB_A,m('improper'));fbBar(p,xs[2],260,300,4,4,FB_A,.2);fbBar(p,xs[2],370,300,4,1,FB_A,m('mixed'));[['proper','Proper',[F('3','4')],'3 < 4 → less than 1'],['improper','Improper',[F('5','4')],'5 ≥ 4 → at least 1'],['mixed','Mixed',['1 ',F('1','4')],'whole + proper part']].forEach(([k,s,v,n],i)=>{fbText(p,s,xs[i]+150,560,m(k),40,COL.task,'middle');fbMath(p,v,xs[i]+150,670,m(k),66);fbText(p,n,xs[i]+150,780,m(k,1),30,COL.dim,'middle');});}],['mixed','Mixed → improper',m=>{const p=panel(0);fbTitle(p,'Two and one fourth: count all the quarters');[200,660].forEach(x=>{const b=fbBar(p,x,320,360,4,4,FB_A,.2,120,{cuts:false});b.lines.forEach(e=>show(e,m('split')));});fbBar(p,1120,320,360,4,1,FB_A,.2,120);fbText(p,'4 quarters',380,520,m('count'),33,FB_A,'middle');fbText(p,'4 quarters',840,520,m('count',1),33,FB_A,'middle');fbText(p,'1 quarter',1300,520,m('count',2),33,FB_A,'middle');fbMath(p,['2 ',F('1','4'),' = ',F('2 × 4 + 1','4'),' = ',F('9','4')],800,660,m('count',3),60);fbText(p,'Whole count × denominator + numerator',800,780,m('rule'),35,COL.task,'middle');fbText(p,'Keep the denominator: the pieces are still quarters.',800,835,m('rule',3),28,COL.dim,'middle');}],['improper','Improper → mixed',m=>{const p=panel(0);fbTitle(p,'Nine quarters regroup into whole strips');const w=360,es=fbPieces(p,9,4,250,265,360,FB_A,.2,100);[200,660,1120].forEach(x=>fbBar(p,x,460,w,4,0,FB_A,.2,100));es.slice(0,4).forEach((e,i)=>tw(e,{x:200+i*90,y:460},m('groups'),1.2,io));es.slice(4,8).forEach((e,i)=>tw(e,{x:660+i*90,y:460},m('groups',2),1.2,io));tw(es[8],{x:1120,y:460},m('left'),1.2,io);fbMath(p,'9 ÷ 4 = 2 R 1',800,660,m('left',1),48);fbMath(p,[F('9','4'),' = 2 ',F('1','4')],800,760,m('name'),58,FB_A);fbText(p,'Both forms are correct. Follow a requested form.',800,840,m('name',5),30,COL.dim,'middle');}],['q2','Quick check',()=>{const p=panel(0);fbTitle(p,'Which mixed-number picture equals nine fourths?','All outlines represent the same size whole.');S.fbMixed=[[2,1],[1,3],[2,3]].map(([a,b],i)=>{const x=185+i*470,g=fbMixed(p,x,260,a,b,4);fbMath(g,[String(a)+' ',F(String(b),'4')],x+135,640,.3,52);return {el:g,box:[x-15,240,300,455],label:`${a} and ${b} fourths`};});},{ask:done=>quiz(BAND,[{id:'c-mixed',prompt:['Choose the area matching ',$m(F('9','4')),'.'],build:pickEls(S.fbMixed,0,'Two wholes use eight quarters; one more quarter makes nine fourths.',i=>i===1?'One whole and three quarters is seven fourths. Count every filled quarter.':'Two wholes and three quarters is eleven fourths, not nine.',()=>pulseFx(S.fbMixed[0].el,1.04))}],done)}],@@ -42,31 +42,30 @@ const BEATS=[['unlike','Different piece sizes',m=>{const p=panel(0);fbTitle(p,'One half + one third','One whole strip has the same width in both rows.');fbBar(p,200,280,840,2,1,FB_A,.2,120);fbBar(p,200,480,840,3,1,FB_B,.2,120);fbMath(p,[F('1','2')],1190,350,.2,65,FB_A);fbMath(p,[F('1','3')],1190,555,.2,65,FB_B);fbText(p,'Different denominators → different piece sizes',800,690,m('sizes'),32,COL.task,'middle');const wrong=fbMath(p,[F('1+1','2+3'),' = ',F('2','5')],800,790,m('mistake'),52,COL.dim);draw(path(p,'M600 755L1000 812',{stroke:COL.bad,'stroke-width':4},{d:0}),m('mistake',1),.4);fbText(p,'Rename both with a common piece size.',800,850,m('common'),29,COL.task,'middle');}],['rename','Rename without changing area',m=>{const p=panel(0);fbTitle(p,'LCM(2, 3) = 6 → sixth-sized pieces','The outline and colored areas stay fixed.');const a=fbBar(p,200,290,700,2,1,FB_A,.2,120),b=fbBar(p,200,520,700,3,1,FB_B,.2,120);fbCuts(a,6,m('split'));fbCuts(b,6,m('split'));fbMath(p,[F('1','2'),' = ',F('1 × 3','2 × 3'),' = ',F('3','6')],1195,385,m('half'),42,FB_A);fbMath(p,[F('1','3'),' = ',F('1 × 2','3 × 2'),' = ',F('2','6')],1195,610,m('third'),42,FB_B);fbText(p,'Same area. More, smaller pieces.',800,765,m('why'),38,COL.task,'middle');fbText(p,'Multiply numerator AND denominator by the same factor.',800,830,m('why',2),29,COL.dim,'middle');}],['unlikeadd','Now combine the sixths',m=>{const p=panel(0);fbTitle(p,'Matching pieces can be counted together');const w=840,x=250;[235,380,590].forEach(y=>fbBar(p,x,y,w,6,0,FB_A,.2,85));const a=fbPieces(p,3,6,x,235,w,FB_A),b=fbPieces(p,2,6,x,380,w,FB_B);const la=fbMath(p,[F('3','6')],1260,295,.2,52,FB_A),lb=fbMath(p,[F('2','6')],1260,440,.2,52,FB_B);hide(la,m('move',1),.4);hide(lb,m('move',2.3),.4);fbMove(a,x,590,w,6,m('move'));fbMove(b,x,590,w,6,m('move',1.3),3);fbMath(p,[F('1','2'),' + ',F('1','3'),' = ',F('3','6'),' + ',F('2','6'),' = ',F('5','6')],800,780,m('answer'),49);fbText(p,'LCM keeps the common denominator as small as possible.',800,844,m('lcm'),28,COL.dim,'middle');}],-['q3','Quick check',()=>{const p=panel(0);fbTitle(p,'Choose the area for one half + one third','Same whole size. Rename both amounts as sixths.');S.fbSum=fbCandidates(p,[{d:6,n:3,label:'A · three sixths'},{d:6,n:5,label:'B · five sixths'},{d:5,n:2,label:'C · two fifths'}]);},{ask:done=>quiz(BAND,[{id:'c-sum',prompt:'Which result combines THREE sixths with TWO sixths?',build:pickEls(S.fbSum,1,'B: three sixths plus two sixths fills five sixths of one whole.',i=>i===0?'A only shows the original half. The two sixths from one third must be added too.':'C adds denominators and changes the piece size. Two fifths is even smaller than one half.',()=>pulseFx(S.fbSum[1].el,1.08))}],done)}],+['q3','Quick check',()=>{const p=panel(0);fbTitle(p,'Choose the area for one half + one third','Same whole size. Rename both amounts as sixths.');S.fbSum=fbCandidates(p,[{d:6,n:3,label:'A'},{d:6,n:5,label:'B'},{d:5,n:2,label:'C'}]);},{ask:done=>quiz(BAND,[{id:'c-sum',prompt:'Which result combines THREE sixths with TWO sixths?',build:pickEls(S.fbSum,1,'B: three sixths plus two sixths fills five sixths of one whole.',i=>i===0?'A only shows the original half. The two sixths from one third must be added too.':'C adds denominators and changes the piece size. Two fifths is even smaller than one half.',()=>pulseFx(S.fbSum[1].el,1.08))}],done)}],['unlikesub','Rename, then remove',m=>{const p=panel(0);fbTitle(p,'Three fourths − one sixth');const x=200,w=1050,a=fbBar(p,x,260,w,4,3,FB_A,.2,105),b=fbBar(p,x,475,w,6,1,FB_B,.2,105);fbText(p,'LCM(4, 6) = 12',800,220,m('lcm'),33,COL.task,'middle');fbCuts(a,12,m('rename'));fbCuts(b,12,m('rename'));const before=fbMath(p,[F('3','4'),' = ',F('9','12')],1360,330,m('rename'),45,FB_A);hide(before,m('remove',1),.4);fbMath(p,[F('7','12')],1360,330,m('answer'),48,FB_A);fbMath(p,[F('1','6'),' = ',F('2','12')],1360,545,m('rename',2),45,FB_B);a.filled.forEach(e=>hide(e,m('rename'),.1));const es=fbPieces(p,9,12,x,260,w,FB_A,m('rename'),105);es.slice(7).forEach(e=>{tw(e,{y:390},m('remove'),1.1,io);hide(e,m('remove',1.5),.8);});fbMath(p,[F('9','12'),' − ',F('2','12'),' = ',F('7','12')],800,720,m('answer'),59);fbText(p,'Seven twelfths remain. Already in lowest terms.',800,815,m('answer',2),31,COL.task,'middle');}],-['wrap','Summary',m=>{const p=panel(0);[['Count equal pieces of ONE whole.','w1'],['Convert the notation. Preserve the amount.','w2'],['Simplify: divide both counts by their GCF.','w3'],['Match piece sizes, then add or subtract.','w4']].forEach(([s,k],i)=>{const g=G(p,{x:-16,y:260+i*140,o:0});mk('circle',{cx:155,cy:-12,r:26,fill:COL.task},g);T(g,String(i+1),{x:155,y:-1,size:30,fill:COL.board,anchor:'middle',weight:700});T(g,s,{x:215,size:37,weight:600});tw(g,{x:0,o:1},m(k),.6);});}],+['wrap','Summary',m=>{const p=panel(0);fbTitle(p,'Four ideas to keep');[['Count equal pieces of ONE whole.','w1'],['Changing the form keeps the same amount.','w2'],['Simplify: divide both numbers by their GCF.','w3'],['Match piece sizes, then add or subtract.','w4']].forEach(([s,k],i)=>{const g=G(p,{x:180,y:290+i*145,o:0});mk('circle',{cx:155,cy:-12,r:26,fill:COL.task},g);T(g,String(i+1),{x:155,y:-1,size:30,fill:COL.board,anchor:'middle',weight:700});T(g,s,{x:215,size:42,weight:600});tw(g,{x:200,o:1},m(k),.6);});}],['final1','Chapter practice',()=>panel(0),{ask:done=>quiz(SCREEN,[-{id:'p-proper',prompt:['Classify ',$m(F('7','10')),'.'],build:choice(['Proper fraction','Improper fraction','Mixed number'],0,'7 is smaller than 10; seven tenths is less than one whole.',['','Improper fractions have numerator magnitude at least the denominator.','This is one fraction, with no separate whole-number part.'])},+{id:'p-proper',prompt:['Classify ',$m(F('7','10')),'.'],build:choice(['Proper fraction','Improper fraction','Mixed number'],0,'7 is smaller than 10; seven tenths is less than one whole.',['','An improper fraction has a numerator at least as big as its denominator.','This is one fraction, with no separate whole-number part.'])},{id:'p-improper',prompt:['Classify ',$m(F('12','7')),'.'],build:choice(['Proper fraction','Improper fraction','Mixed number'],1,'12 is greater than 7, so twelve sevenths is improper.',['12 is not smaller than 7.','','A mixed number writes a whole number and a proper fractional part.'])},-{id:'p-mixed',prompt:['Classify ',$m('3 ',F('2','5')),'.'],build:choice(['Proper fraction','Improper fraction','Mixed number'],2,'This notation combines three wholes with two fifths.',['The complete written number has a whole part.','An improper fraction is written as a single fraction.',''])},-{id:'p-sign',prompt:['Classify ',$m('−',F('13','8')),'. Compare magnitudes; the sign does not change the type.'],build:choice(['Proper fraction','Improper fraction','Mixed number'],1,'The numerator magnitude is 13 and the denominator is 8: this is improper.',['Compare absolute values: 13 is greater than 8.','','There is no separate whole-number part in this notation.'])}-],done,'Chapter practice 1 of 4')}],-['final2','Chapter practice',()=>panel(0),{ask:done=>quiz(SCREEN,[{id:'p-rename',prompt:'Convert and simplify. The mixed-number row has separate whole and proper-fraction boxes.',build:blanks([+{id:'p-mixed',prompt:['Classify ',$m('3 ',F('2','5')),'.'],build:choice(['Proper fraction','Improper fraction','Mixed number'],2,'This notation combines three wholes with two fifths.',['The complete written number has a whole part.','An improper fraction is written as a single fraction.',''])}+],done,'Chapter practice · set 1 of 4')}],+['final2','Chapter practice',()=>panel(0),{ask:done=>quiz(SCREEN,[{id:'p-rename',prompt:'Convert and simplify.',build:blanks([{parts:['Improper: 1 ',F('3','5'),' = ',{box:'8'},' / ',{box:'5'}],why:'One whole has five fifths; five plus three makes eight fifths.',hint:'Fill the numerator and denominator of a single fraction.'},{parts:['Mixed: ',F('17','6'),' = ',{box:'2'},' + ',{box:'5/6',lowest:true}],why:'Seventeen sixths make two whole groups of six, with five sixths left.',hint:'Fill the whole count and then the proper fractional part.'},{parts:['Lowest terms: ',F('14','21'),' = ',{box:'2/3',lowest:true}],why:'GCF(14,21)=7. Divide both counts by seven to get two thirds.'},{parts:['13 whole bars in 4 equal groups: remainder ',{box:'1'}],why:'13 = 4 × 3 + 1. Each group gets three whole bars; one remains.'}-])}],done,'Chapter practice 2 of 4')}],+])}],done,'Chapter practice · set 2 of 4')}],['final3','Chapter practice',()=>panel(0),{ask:done=>quiz(SCREEN,[{id:'p-calculate',prompt:'Calculate in lowest terms. Equivalent mixed numbers are accepted.',build:blanks([{parts:[F('3','11'),' + ',F('5','11'),' = ',{box:'8/11',lowest:true}],why:'Add the numerators: three plus five is eight. Keep eleven.'},{parts:[F('11','12'),' − ',F('5','12'),' = ',{box:'1/2',lowest:true}],why:'Six twelfths remain; divide both counts by six to get one half.'},{parts:[F('2','3'),' + ',F('3','4'),' = ',{box:'17/12',lowest:true}],why:'LCM(3,4)=12. Eight twelfths plus nine twelfths is seventeen twelfths, or one and five twelfths.'},{parts:[F('7','8'),' − ',F('1','3'),' = ',{box:'13/24',lowest:true}],why:'LCM(8,3)=24. Twenty-one twenty-fourths minus eight twenty-fourths is thirteen twenty-fourths.'}-])}],done,'Chapter practice 3 of 4')}],+])}],done,'Chapter practice · set 3 of 4')}],['final4','Chapter practice',()=>panel(0),{ask:done=>quiz(SCREEN,[{id:'p-ribbon',prompt:['Mina joins a ',$m(F('1','4')),' meter ribbon with a ',$m(F('3','8')),' meter ribbon. How long is the joined ribbon?'],build:blanks([{parts:[{box:'5/8',lowest:true},' meter'],why:'One meter is the unit whole. One fourth meter is two eighths; add three eighths to get five eighths meter.'}])},{id:'p-paint',prompt:['A jar holds ',$m(F('5','6')),' liter of paint. Sam uses ',$m(F('1','4')),' liter. How much paint remains?'],build:blanks([{parts:[{box:'7/12',lowest:true},' liter'],why:'One liter is the unit whole. Ten twelfths minus three twelfths leaves seven twelfths liter.'}])}-],done,'Chapter practice 4 of 4')}],+],done,'Chapter practice · set 4 of 4')}],['finish','Finished',()=>panel(0),{ask:finishCard}]].map(([id,title,run,extra])=>({id,title,run,...extra}));boot();diff --git a/site/math-notebook/ch07/index.html b/site/math-notebook/ch07/index.htmlindex 7b17c4a..4a80b70 100644--- a/site/math-notebook/ch07/index.html+++ b/site/math-notebook/ch07/index.html@@ -2,7 +2,7 @@<html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1"><title>Multiplying and Dividing Fractions — Elementary Mathematics</title><link rel="stylesheet" href="../lib/engine.css"><link rel="expect" href="#bar" blocking="render">-<style>.screen .blanks .line{gap:14px}.screen input.box{min-width:110px}</style></head><body>+<style>.screen .blanks .line{gap:14px}.screen input.box{min-width:110px}.screen .blanks .bline svg.m{zoom:1.5}.band .prompt svg.m{zoom:1.25}</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', next: '../ch08/' };@@ -17,10 +17,10 @@ function fmPieces(p,n,d,x,y,w,col,t=.2,h=80){return Array.from({length:n},(_,i)=function fmArea(p,{x=220,y=265,w=620,h=360,cols=4,rows=3,a=3,b=2,t=.2,vertical=t,horizontal=t,select=t}={}){const g=G(p,{x,y,o:0});mk('rect',{width:w,height:h,fill:COL.faint,'fill-opacity':.12},g);const blue=mk('rect',{width:w*a/cols,height:h,fill:FM_A,'fill-opacity':.48},g);- const picked=G(g,{o:0});mk('rect',{width:w*a/cols,height:h*b/rows,fill:COL.task,'fill-opacity':.85},picked);+ const picked=G(g,{y:h-h*b/rows,o:0});mk('rect',{width:w*a/cols,height:h*b/rows,fill:COL.task,'fill-opacity':.85},picked);const vs=[],hs=[];for(let i=1;i<cols;i++)vs.push(path(g,`M${i*w/cols} 0V${h}`,{stroke:COL.chalk,'stroke-width':2},{o:0}));for(let i=1;i<rows;i++)hs.push(path(g,`M0 ${i*h/rows}H${w}`,{stroke:COL.chalk,'stroke-width':2},{o:0}));mk('rect',{width:w,height:h,fill:'none',stroke:COL.chalk,'stroke-width':3},g);show(g,t);vs.forEach(e=>show(e,vertical));hs.forEach(e=>show(e,horizontal));show(picked,select+1.4,.6);- const selector=G(g,{y:h-h*b/rows,o:0});mk('rect',{width:w*a/cols,height:h*b/rows,fill:'none',stroke:FM_B,'stroke-width':5,'stroke-dasharray':'12 8'},selector);show(selector,select,.2);tw(selector,{y:0},select+.2,1.2,io);return {g,blue,picked,selector,vs,hs};+ const selector=G(g,{y:h-h*b/rows,o:0});mk('rect',{width:w*a/cols,height:h*b/rows,fill:'none',stroke:FM_B,'stroke-width':5,'stroke-dasharray':'12 8'},selector);show(selector,select,.2);[selector,picked].forEach(e=>tw(e,{y:0},select+.2,1.2,io));return {g,blue,picked,selector,vs,hs};}function fmPair(p,a,b,x,y,label,t=.2){const g=G(p,{o:0});mk('rect',{x,y,width:330,height:145,rx:18,fill:COL.board,stroke:COL.dim,'stroke-width':2},g);T(g,label,{x:x+165,y:y+38,size:27,anchor:'middle',fill:COL.dim});M(g,[a,' ↔ ',b],{x:x+165,y:y+103,size:48,anchor:'middle'});show(g,t);return {el:g,box:[x,y,330,145],label:label};}function fmGrouping(p,n,per,m,{x=350,y=290,w=260,d=4,gy=550,gxs=[310,770,1190],h=85}={}){@@ -32,37 +32,40 @@ function fmGrouping(p,n,per,m,{x=350,y=290,w=260,d=4,gy=550,gxs=[310,770,1190],hconst BEATS=[['intro','Multiply and divide',(m,D)=>{const g=G(scene,{o:0,y:24});T(g,'Unit 1 · The Number System · Chapter 7',{x:800,y:250,size:28,fill:COL.dim,anchor:'middle'});T(g,'Multiplying and',{x:800,y:365,size:82,weight:600,anchor:'middle'});T(g,'Dividing Fractions',{x:800,y:465,size:82,weight:600,anchor:'middle'});tw(g,{o:1,y:0},.2,1,out);fmBar(g,580,520,440,4,3,FM_A,.5,80);const s=fmText(scene,'Part of an amount · Number of groups',800,735,m('sub'),34,COL.dim,'middle');hide(g,D-.8,.7);hide(s,D-.8,.7);}],['of','A fraction of a fraction',m=>{const p=panel(0);fmTitle(p,'Two thirds OF three fourths','One outlined rectangle = one whole unit');const a=fmArea(p,{t:.2,vertical:m('blue'),horizontal:m('split'),select:m('take')});put(a.blue,{o:0});show(a.blue,m('blue'));fmMath(p,[F('3','4'),' of the whole'],1170,315,m('blue'),45,FM_A);fmText(p,'Take 2 of the 3 rows',1030,425,m('take'),32,FM_B);fmText(p,'inside the blue amount',1030,468,m('take'),28,COL.dim);fmText(p,'6 selected / 12 in ONE whole',1040,570,m('count'),29,COL.task);fmMath(p,[F('2','3'),' × ',F('3','4'),' = ',F('6','12'),' = ',F('1','2')],800,745,m('result'),61);}],-['multiply','Why top × top, bottom × bottom',m=>{const p=panel(0);fmTitle(p,'Three fifths × two sevenths','Different denominators work: split in both directions.');const a=fmArea(p,{cols:5,rows:7,a:3,b:2,vertical:m('vertical'),horizontal:m('horizontal'),select:m('cells')});put(a.blue,{o:0});show(a.blue,m('vertical'));fmText(p,'5 columns × 7 rows',1030,315,m('horizontal'),35,COL.dim);fmText(p,'35 equal cells in ONE whole',1030,365,m('cells'),28,COL.dim);fmText(p,'3 columns × 2 rows',1030,495,m('cells'),35,COL.task);fmText(p,'6 selected cells',1030,545,m('cells',1),29,COL.task);fmMath(p,[F('3','5'),' × ',F('2','7'),' = ',F('3 × 2','5 × 7'),' = ',F('6','35')],800,755,m('rule'),56);fmText(p,'Multiplication subdivides; addition combines same-size pieces.',800,835,m('rule',4),28,COL.dim,'middle');}],-['q1','Quick check',()=>{const p=panel(0);fmTitle(p,'Choose the result: two thirds of three fourths','Each outlined rectangle = one whole.');S.fmAreas=[3,6,8].map((n,i)=>{const x=150+i*480,g=G(p);fmBar(g,x,310,360,12,n,COL.task,.2,145);fmMath(g,[F(String(n),'12')],x+180,550,.2,52);return {el:g,box:[x-10,290,380,290],label:`${n} twelfths`};});},{ask:done=>quiz(BAND,[{id:'c-area',prompt:'Which area has TWO of THREE rows of the three-fourths amount?',build:pickEls(S.fmAreas,1,'Six twelfths equals one half: two selected rows each have three twelfth-sized cells.',i=>i===0?'Three twelfths is only one of the three rows of three fourths.':'Eight twelfths is two thirds of the entire whole. Take two thirds of the blue three-fourths amount.',()=>pulseFx(S.fmAreas[1].el,1.06))}],done)}],-['scale','Half a recipe',m=>{const p=panel(0);fmTitle(p,'Half of a recipe using ¾ cup of yogurt','Each outline = ONE cup');const a=fmBar(p,250,290,800,4,3,FM_A,.2,110);for(let i=1;i<8;i+=2)draw(path(a.g,`M${i*100} 0V110`,{stroke:COL.task,'stroke-width':2,'stroke-dasharray':'6 5'},{d:0}),m('split'),.7);fmBar(p,250,535,800,8,0,FM_A,.2,110);a.cells.forEach(e=>hide(e,m('take'),.1));const es=fmPieces(p,6,8,250,290,800,FM_A,m('take'),110);es.slice(0,3).forEach((e,i)=>tw(e,{x:250+i*100,y:535},m('take',.3)+i*.15,1.2));const before=fmText(p,'original recipe',1190,355,.2,30,FM_A,'middle');hide(before,m('take'),.3);fmText(p,'other half stays here',1210,355,m('take',1.5),30,FM_A,'middle');fmText(p,'half recipe',1190,600,m('take'),30,COL.task,'middle');fmMath(p,[F('1','2'),' × ',F('3','4'),' = ',F('3','8')],800,750,m('result'),62);fmText(p,'A multiplier between 0 and 1 shrinks a positive amount.',800,832,m('smaller'),30,COL.dim,'middle');}],-['cancel','Cross-cancel factors',m=>{const p=panel(0);fmTitle(p,'Five sixths × nine tenths','Cancel a TOP factor with a BOTTOM factor.');fmMath(p,[F('5','6'),' × ',F('9','10')],300,380,.2,70);fmMath(p,[F('5 × 9','6 × 10')],800,375,m('combine'),83);fmMath(p,[F('45','60')],1290,375,m('combine'),75);const diag1=path(p,'M709 330L891 414',{stroke:COL.task,'stroke-width':4},{d:0});draw(diag1,m('five'),.6);fmText(p,'5 → 1',665,235,m('five'),30,COL.task);fmText(p,'10 → 2',900,485,m('five'),30,COL.task);draw(path(p,'M890 330L710 414',{stroke:COL.task,'stroke-width':4},{d:0}),m('three'),.6);fmText(p,'9 → 3',900,235,m('three'),30,COL.task);fmText(p,'6 → 2',655,485,m('three'),30,COL.task);fmMath(p,[F('1 × 3','2 × 2'),' = ',F('3','4')],800,660,m('result'),68);fmText(p,'Divide the total numerator AND denominator by the same factor.',800,790,m('why'),31,COL.dim,'middle');}],-['q2','Quick check',()=>{const p=panel(0);fmTitle(p,'Which pair can cross-cancel?','A common factor must appear on TOP and BOTTOM.');fmMath(p,[F('4','9'),' × ',F('3','8')],800,285,.2,65);S.fmPairs=[fmPair(p,'4','3',160,410,'A · two numerators'),fmPair(p,'9','8',635,410,'B · two denominators'),fmPair(p,'3','9',1110,410,'C · top and bottom')];},{ask:done=>quiz(BAND,[{id:'c-cancel',prompt:'Choose a pair with a common factor that preserves the product when reduced.',build:pickEls(S.fmPairs,2,'3 on top and 9 on bottom share factor 3. Divide both by 3; 4 and 8 can also reduce by 4.',i=>i===0?'Both are numerators. Canceling them would change the product, and 4 and 3 have no common factor above 1.':'Both are denominators. Cross-cancel requires a numerator and denominator.',()=>pulseFx(S.fmPairs[2].el,1.04))}],done)}],+['multiply','Why top × top, bottom × bottom',m=>{const p=panel(0);fmTitle(p,'Three fifths × two sevenths','Different denominators work: split in both directions.');const a=fmArea(p,{cols:5,rows:7,a:3,b:2,vertical:m('vertical'),horizontal:m('horizontal'),select:m('horizontal',5.6)});put(a.blue,{o:0});show(a.blue,m('vertical'));fmText(p,'5 columns × 7 rows',1030,315,m('horizontal'),35,COL.dim);fmText(p,'35 equal cells in ONE whole',1030,365,m('cells'),30,COL.dim);fmText(p,'3 columns × 2 rows',1030,495,m('cells',4.3),35,COL.task);fmText(p,'6 selected cells',1030,545,m('cells',5.8),30,COL.task);fmMath(p,[F('3','5'),' × ',F('2','7'),' = ',F('3 × 2','5 × 7'),' = ',F('6','35')],800,755,m('rule'),60);fmText(p,'No matching denominators needed: we split the pieces smaller.',800,845,m('rule',10.2),30,COL.dim,'middle');}],+['q1','Quick check',()=>{const p=panel(0);fmTitle(p,'Choose the result: two thirds of three fourths','Each outlined rectangle = one whole. Blue = three fourths.');S.fmAreas=[[3,1],[3,2],[4,2]].map(([c,r],i)=>{const x=130+i*480,y=250,w=360,h=240,g=G(p);mk('rect',{x,y,width:w,height:h,fill:COL.faint,'fill-opacity':.12},g);mk('rect',{x,y,width:w*3/4,height:h,fill:FM_A,'fill-opacity':.48},g);mk('rect',{x,y,width:w*c/4,height:h*r/3,fill:COL.task,'fill-opacity':.85},g);for(let k=1;k<4;k++)path(g,`M${x+k*w/4} ${y}V${y+h}`,{stroke:COL.chalk,'stroke-width':2});for(let k=1;k<3;k++)path(g,`M${x} ${y+k*h/3}H${x+w}`,{stroke:COL.chalk,'stroke-width':2});mk('rect',{x,y,width:w,height:h,fill:'none',stroke:COL.chalk,'stroke-width':3},g);fmMath(g,[F(String(c*r),'12')],x+w/2,585,.2,56);return {el:g,box:[x-12,235,w+24,380],label:`${c*r} twelfths`};});},{ask:done=>quiz(BAND,[{id:'c-area',prompt:'Which picture takes TWO of the THREE rows of the blue amount?',build:pickEls(S.fmAreas,1,'Six twelfths equals one half: two selected rows each have three twelfth-sized cells.',i=>i===0?'Three twelfths is only one of the three rows of three fourths.':'Eight twelfths is two thirds of the entire whole. Take two thirds of the blue three-fourths amount.',()=>pulseFx(S.fmAreas[1].el,1.06))}],done)}],+['scale','Half a recipe',m=>{const p=panel(0);fmTitle(p,'Half of a recipe using ¾ cup of yogurt','Each outline = ONE cup');const a=fmBar(p,250,290,800,4,3,FM_A,.2,110);for(let i=1;i<8;i+=2)draw(path(a.g,`M${i*100} 0V110`,{stroke:COL.task,'stroke-width':2,'stroke-dasharray':'6 5'},{d:0}),m('split'),.7);fmBar(p,250,535,800,8,0,FM_A,.2,110);a.cells.forEach(e=>hide(e,m('take'),.1));const es=fmPieces(p,6,8,250,290,800,FM_A,m('take'),110);es.slice(0,3).forEach(e=>tw(e,{y:535},m('take',.3),1.2));es.slice(3).forEach((e,i)=>tw(e,{x:250+i*100},m('take',1.8),1));const before=fmText(p,'original recipe',1190,355,.2,30,FM_A,'middle');hide(before,m('take'),.3);fmText(p,'other half stays here',1210,355,m('take',2.6),30,FM_A,'middle');fmText(p,'half recipe',1190,600,m('take'),30,COL.task,'middle');fmMath(p,[F('1','2'),' × ',F('3','4'),' = ',F('3','8')],800,750,m('result'),62);fmText(p,'A multiplier between 0 and 1 shrinks a positive amount.',800,832,m('smaller'),30,COL.dim,'middle');}],+['cancel','Cross-cancel factors',m=>{const p=panel(0);fmTitle(p,'Five sixths × nine tenths','Cancel a TOP factor with a BOTTOM factor.');fmMath(p,[F('5','6'),' × ',F('9','10')],300,380,.2,70);// Product built digit by digit so each cancel slash and new value sits on its own digit.+const pr=G(p,{o:0});show(pr,m('combine'));const NY=345,DY=445,dig=(s,x,y)=>M(pr,[s],{x,y,size:80});[['5',730],['×',800],['9',870]].forEach(([s,x])=>dig(s,x,NY));[['6',730],['×',800],['10',880]].forEach(([s,x])=>dig(s,x,DY));path(pr,`M680 ${NY+27}H935`,{stroke:COL.chalk,'stroke-width':4,'stroke-linecap':'round'});fmMath(p,[F('45','60')],1290,375,m('combine'),75);+const cut=(x,y,hw,v,vy,t,tv)=>{draw(path(p,`M${x-hw} ${y+6}L${x+hw} ${y-56}`,{stroke:COL.task,'stroke-width':5,'stroke-linecap':'round'},{d:0}),t,.4);fmMath(p,[v],x,vy,tv,44,COL.task);};+cut(730,NY,22,'1',NY-78,m('five'),m('five',2.5));cut(880,DY,38,'2',DY+62,m('five',.4),m('five',2.5));cut(870,NY,22,'3',NY-78,m('three'),m('three',2));cut(730,DY,22,'2',DY+62,m('three',.4),m('three',2.8));fmMath(p,[F('1 × 3','2 × 2'),' = ',F('3','4')],800,660,m('result'),68);fmText(p,'Divide the total numerator AND denominator by the same factor.',800,790,m('why'),31,COL.dim,'middle');}],+['q2','Quick check',()=>{const p=panel(0);fmTitle(p,'Which pair can cross-cancel?','A common factor must appear on TOP and BOTTOM.');fmMath(p,[F('4','9'),' × ',F('3','8')],800,285,.2,65);S.fmPairs=[fmPair(p,'4','3',160,410,'A'),fmPair(p,'9','8',635,410,'B'),fmPair(p,'3','9',1110,410,'C')];},{ask:done=>quiz(BAND,[{id:'c-cancel',prompt:'Which pair of numbers can be cross-canceled?',build:pickEls(S.fmPairs,2,'3 on top and 9 on bottom share factor 3. Divide both by 3; 4 and 8 can also reduce by 4.',i=>i===0?'Both are numerators. Canceling them would change the product, and 4 and 3 have no common factor above 1.':'Both are denominators. Cross-cancel requires a numerator and denominator.',()=>pulseFx(S.fmPairs[2].el,1.04))}],done)}],['groups','Division counts groups',m=>{const p=panel(0);fmTitle(p,'1½ meters ÷ ¾ meter per piece','Blue = available ribbon · Coral outline = size of each group');fmGrouping(p,6,3,{group:m('group'),move:m('move')});fmMath(p,['1 ',F('1','2'),' ÷ ',F('3','4'),' = 2'],1100,320,m('count'),57);fmText(p,'six quarter-meter pieces',1090,235,m('units'),31,FM_A,'middle');fmText(p,'2 groups · each group is ¾ meter',800,780,m('count'),37,COL.task,'middle');}],['partial','A fraction of a group',m=>{const p=panel(0);fmTitle(p,'1¼ liters ÷ ½ liter per group','Keep the quarter-liter pieces the same size when moving.');fmGrouping(p,5,2,{group:m('groups'),move:m('move')},{gxs:[260,665,1070]});fmText(p,'five quarter-liter pieces',1090,235,m('quarters'),30,FM_A,'middle');fmText(p,'½ of a GROUP',1135,725,m('partial'),34,COL.task,'middle');fmText(p,'¼ liter ÷ ½ liter = ½ group',800,790,m('partial',2),33,COL.dim,'middle');fmMath(p,['1 ',F('1','4'),' ÷ ',F('1','2'),' = 2 ',F('1','2')],1120,320,m('answer'),52);}],-['q3','Quick check',()=>{const p=panel(0);fmTitle(p,'Choose the groups for 1½ ÷ ½','Each column contains the same total amount: 1½ units.');S.fmGroups=[{n:2,d:4,k:3,label:'A · 2 groups of ¾'},{n:3,d:2,k:1,label:'B · 3 groups of ½'},{n:6,d:4,k:1,label:'C · 6 groups of ¼'}].map((v,j)=>{const x=200+j*480,g=G(p),w=360;for(let i=0;i<v.n;i++){const y=265+i*52;mk('rect',{x,y,width:w*v.k/v.d,height:40,fill:FM_A,'fill-opacity':.65,stroke:FM_B,'stroke-width':3},g);}fmText(g,v.label,x,610,.2,30,COL.chalk);return {el:g,box:[x-15,250,390,390],label:v.label};});},{ask:done=>quiz(BAND,[{id:'c-groups',prompt:'The divisor is ONE HALF. Which picture uses half-sized groups?',build:pickEls(S.fmGroups,1,'Three half-sized groups fit into one and one half. The quotient is 3.',i=>i===0?'A uses three-fourths-sized groups. Match the group size to the divisor, one half.':'C uses quarter-sized groups. Two of those quarters make one half-sized group.',()=>pulseFx(S.fmGroups[1].el,1.05))}],done)}],-['reciprocal','Make the group size ONE',m=>{const p=panel(0);fmTitle(p,'Two thirds ÷ four fifths','Scale BOTH lengths by the same factor: group count stays the same.');const x=200,w=600;function row(y,n,d,col){const g=G(p,{x,y});mk('rect',{width:w,height:90,fill:'none',stroke:COL.dim,'stroke-width':2,'stroke-dasharray':'7 6'},g);const r=mk('rect',{width:w*n/d,height:90,fill:col,'fill-opacity':.65,stroke:col,'stroke-width':3},g);return r;}const a=row(310,4,5,FM_B),b=row(535,2,3,FM_A);fmText(p,'before: divisor 4/5',1090,370,m('divisor'),37,FM_B);fmText(p,'before: amount 2/3',1090,595,.2,37,FM_A);fmText(p,'× 5/4',500,250,m('stretch'),40,COL.task,'middle');tw(a,{a_width:600},m('stretch'),2,io);fmMath(p,[F('4','5'),' × ',F('5','4'),' = 1'],1115,450,m('stretch',2),44,FM_B);tw(b,{a_width:500},m('first'),2,io);fmMath(p,[F('2','3'),' × ',F('5','4'),' = ',F('5','6')],1115,680,m('first',2),44,FM_A);fmText(p,'new unit = ONE divisor-sized group',500,720,m('quotient'),28,COL.dim,'middle');fmMath(p,[F('2','3'),' ÷ ',F('4','5'),' = ',F('5','6'),' of a group'],800,820,m('quotient',1),48,COL.task);}],-['rule','Reciprocal means product ONE',m=>{const p=panel(0);fmTitle(p,'Keep · Multiply · Reciprocal','The divisor must be nonzero.');fmMath(p,[F('4','5'),' × ',F('5','4'),' = ',F('20','20'),' = 1'],800,300,m('one'),64);fmMath(p,[F('2','3'),' ÷ ',F('4','5')],490,500,.2,75);fmText(p,'keep',380,595,m('flip'),32,FM_A);fmText(p,'flip second',570,595,m('flip'),32,FM_B);fmMath(p,['= ',F('2','3'),' × ',F('5','4'),' = ',F('5','6')],1120,500,m('multiply'),62);fmText(p,'4 = 4/1 → reciprocal 1/4',800,720,m('multiply',5),34,COL.dim,'middle');fmText(p,'Zero has no reciprocal. Division by zero is undefined.',800,815,m('zero'),33,COL.task,'middle');}],+['q3','Quick check',()=>{const p=panel(0);fmTitle(p,'Choose the groups for 1½ ÷ ½','Dashed outline = 1 unit. Each picture holds 1½ units in groups.');S.fmGroups=[{n:2,d:4,k:3,label:'A'},{n:3,d:2,k:1,label:'B'},{n:6,d:4,k:1,label:'C'}].map((v,j)=>{const x=140+j*480,g=G(p),w=360;for(let i=0;i<v.n;i++){const y=265+i*52;path(g,`M${x} ${y}h${w}v40h-${w}Z`,{fill:'none',stroke:COL.dim,'stroke-width':2,'stroke-dasharray':'7 6'});mk('rect',{x,y,width:w*v.k/v.d,height:40,fill:FM_A,'fill-opacity':.65,stroke:FM_B,'stroke-width':3},g);}fmText(g,v.label,x+w/2,615,.2,40,COL.chalk,'middle');return {el:g,box:[x-15,250,390,390],label:v.label};});},{ask:done=>quiz(BAND,[{id:'c-groups',prompt:'The divisor is ONE HALF. Which picture uses half-sized groups?',build:pickEls(S.fmGroups,1,'Three half-sized groups fit into one and one half. The quotient is 3.',i=>i===0?'A uses three-fourths-sized groups. Match the group size to the divisor, one half.':'C uses quarter-sized groups. Two of those quarters make one half-sized group.',()=>pulseFx(S.fmGroups[1].el,1.05))}],done)}],+['reciprocal','Make the group size ONE',m=>{const p=panel(0);fmTitle(p,'Two thirds ÷ four fifths','Scale BOTH lengths by the same factor: group count stays the same.');const x=200,w=600;function row(y,n,d,col){const g=G(p,{x,y});mk('rect',{width:w,height:90,fill:'none',stroke:COL.dim,'stroke-width':2,'stroke-dasharray':'7 6'},g);const r=mk('rect',{width:w*n/d,height:90,fill:col,'fill-opacity':.65,stroke:col,'stroke-width':3},g);return r;}const a=row(310,4,5,FM_B),b=row(535,2,3,FM_A);const swap=(a,b,x,y,t0,t1,col)=>{const e=fmText(p,a,x,y,t0,37,col);hide(e,t1,.3);fmText(p,b,x,y,t1+.3,37,col);};swap('before: divisor 4/5','after: 1 (one group)',1060,370,m('divisor'),m('stretch',3.3),FM_B);swap('before: amount 2/3','after: 5/6',1060,595,.2,m('first',3),FM_A);fmText(p,'× 5/4',500,250,m('stretch'),40,COL.task,'middle');tw(a,{a_width:600},m('stretch'),2,io);fmMath(p,[F('4','5'),' × ',F('5','4'),' = 1'],1060,465,m('stretch',3.5),54,FM_B,'start');tw(b,{a_width:500},m('first'),2,io);fmMath(p,[F('2','3'),' × ',F('5','4'),' = ',F('5','6')],1060,690,m('first',3),54,FM_A,'start');fmText(p,'new unit = ONE divisor-sized group',500,720,m('quotient'),30,COL.dim,'middle');fmMath(p,[F('2','3'),' ÷ ',F('4','5'),' = ',F('5','6')],880,830,m('quotient',6.6),56,COL.task,'end');fmText(p,'of a group',900,830,m('quotient',6.6),40,COL.task);}],+['rule','Reciprocal means product ONE',m=>{const p=panel(0);fmTitle(p,'Keep · Multiply · Reciprocal','The divisor must be nonzero.');fmMath(p,[F('4','5'),' × ',F('5','4'),' = ',F('20','20'),' = 1'],800,300,m('one'),64);fmMath(p,[F('2','3'),' ÷ ',F('4','5')],490,500,.2,75);fmText(p,'keep',380,595,m('flip'),32,FM_A);fmText(p,'flip second',570,595,m('flip'),32,FM_B);fmMath(p,['= ',F('2','3'),' × ',F('5','4'),' = ',F('5','6')],1120,500,m('multiply'),62);fmText(p,'4 = 4/1 → reciprocal 1/4',800,720,m('multiply',7.6),34,COL.dim,'middle');fmText(p,'Zero has no reciprocal. Division by zero is undefined.',800,815,m('zero'),33,COL.task,'middle');}],['mixed','Convert mixed numbers FIRST',m=>{const p=panel(0);fmTitle(p,'One and one half ÷ one and one eighth');fmMath(p,['1 ',F('1','2'),' ÷ 1 ',F('1','8')],800,270,.2,70);fmMath(p,['= ',F('3','2'),' ÷ ',F('9','8')],800,420,m('convert'),65);fmMath(p,['= ',F('3','2'),' × ',F('8','9')],800,555,m('reciprocal'),65);fmText(p,'2 with 8 → 1 with 4 · 3 with 9 → 1 with 3',800,655,m('cancel'),30,COL.task,'middle');fmMath(p,['= ',F('1 × 4','1 × 3'),' = ',F('4','3'),' = 1 ',F('1','3')],800,770,m('answer'),60);fmText(p,'A mixed number means whole part PLUS fractional part.',800,850,m('answer',5),28,COL.dim,'middle');}],['compare','The operation changes the question',m=>{const p=panel(0);fmTitle(p,'Keep the first fraction. Flip the second for division.');fmMath(p,[F('3','4'),' ÷ ',F('1','2')],400,330,.2,65);fmMath(p,['= ',F('3','4'),' × ',F('2','1')],1110,330,m('second'),65);fmText(p,'first amount stays',330,430,m('first'),32,FM_A);fmText(p,'second becomes reciprocal',950,430,m('second'),32,FM_B);fmMath(p,[F('3','4'),' × ',F('1','2'),' = ',F('3','8')],430,610,m('size'),58);fmText(p,'half OF the amount',430,705,m('size'),31,FM_B,'middle');fmMath(p,[F('3','4'),' ÷ ',F('1','2'),' = 1 ',F('1','2')],1140,610,m('size',3),58);fmText(p,'number OF half-sized groups',1140,705,m('size',3),31,FM_B,'middle');fmText(p,'First decide: part of an amount, or number of groups?',800,835,m('size',7),32,COL.task,'middle');}],-['wrap','Summary',m=>{const p=panel(0);[['Multiply top × top and bottom × bottom.','w1'],['Cross-cancel TOP and BOTTOM factors.','w2'],['Divide: multiply by the NONZERO divisor’s reciprocal.','w3'],['Mixed → improper first. Simplify at the end.','w4']].forEach(([s,k],i)=>{const g=G(p,{x:-16,y:260+i*140,o:0});mk('circle',{cx:155,cy:-12,r:26,fill:COL.task},g);T(g,String(i+1),{x:155,y:-1,size:30,fill:COL.board,anchor:'middle',weight:700});T(g,s,{x:215,size:35,weight:600});tw(g,{x:0,o:1},m(k),.6);});}],+['wrap','Summary',m=>{const p=panel(0);fmTitle(p,'Four ideas to keep');[['Multiply top × top and bottom × bottom.','w1'],['Cross-cancel TOP and BOTTOM factors.','w2'],['Divide: multiply by the NONZERO divisor’s reciprocal.','w3'],['Mixed → improper first. Simplify at the end.','w4']].forEach(([s,k],i)=>{const g=G(p,{x:-16,y:300+i*150,o:0});mk('circle',{cx:290,cy:-13,r:30,fill:COL.task},g);T(g,String(i+1),{x:290,y:-1,size:34,fill:COL.board,anchor:'middle',weight:700});T(g,s,{x:355,size:38,weight:600});tw(g,{x:0,o:1},m(k),.6);});}],['final1','Chapter practice',()=>panel(0),{ask:done=>quiz(SCREEN,[{id:'p-multiply',prompt:'Multiply. Give answers in lowest terms; equivalent mixed numbers are accepted.',build:blanks([{parts:[F('2','5'),' × ',F('3','7'),' = ',{box:'6/35',lowest:true}],why:'Two times three is six; five times seven is thirty-five. No common factor remains.'},{parts:[F('7','12'),' × ',F('6','7'),' = ',{box:'1/2',lowest:true}],why:'Cancel the sevens, and reduce six with twelve. The product is one half.'},{parts:[F('3','8'),' × 4 = ',{box:'3/2',lowest:true}],why:'Write four as four over one. Twelve eighths simplifies to three halves, or one and one half.'}-])}],done,'Chapter practice 1 of 4')}],+])}],done,'Chapter practice · set 1 of 4')}],['final2','Chapter practice',()=>panel(0),{ask:done=>quiz(SCREEN,[{id:'p-divide',prompt:'The divisors are nonzero. Use their reciprocals; simplify.',build:blanks([{parts:['Reciprocal of ',F('7','9'),': ',{box:'9/7',lowest:true}],why:'Seven ninths times nine sevenths is one.'},{parts:[F('5','6'),' ÷ ',F('2','3'),' = ',{box:'5/4',lowest:true}],why:'Five sixths times three halves is fifteen twelfths, or five fourths.'},{parts:[F('3','5'),' ÷ 4 = ',{box:'3/20',lowest:true}],why:'The reciprocal of four is one fourth. Three fifths times one fourth is three twentieths.'}-])}],done,'Chapter practice 2 of 4')}],+])}],done,'Chapter practice · set 2 of 4')}],['final3','Chapter practice',()=>panel(0),{ask:done=>quiz(SCREEN,[{id:'p-mixed',prompt:'Convert mixed numbers to improper fractions first. Give a simplified fraction or mixed number.',build:blanks([{parts:['1 ',F('2','3'),' × 2 ',F('1','4'),' = ',{box:'15/4',lowest:true}],why:'Five thirds times nine fourths is forty-five twelfths, or fifteen fourths (three and three fourths).'},{parts:['2 ',F('2','5'),' ÷ 1 ',F('1','2'),' = ',{box:'8/5',lowest:true}],why:'Twelve fifths times two thirds is twenty-four fifteenths, or eight fifths (one and three fifths).'}-])}],done,'Chapter practice 3 of 4')}],+])}],done,'Chapter practice · set 3 of 4')}],['final4','Chapter practice',()=>panel(0),{ask:done=>quiz(SCREEN,[{id:'p-lengths',prompt:['A ',$m('2 ',F('3','4')),' meter ribbon is measured in ',$m(F('3','4')),' meter lengths. How many lengths is it, including a partial length?'],build:blanks([{parts:[{box:'11/3',lowest:true},' lengths'],why:'Eleven fourths divided by three fourths is eleven thirds. That is three complete lengths plus two thirds of another length.'}])},{id:'p-sharing',prompt:['Five friends share ',$m(F('5','6')),' kilogram of trail mix equally. How much does each friend receive?'],build:blanks([{parts:[{box:'1/6',lowest:true},' kilogram each'],why:'Five sixths divided by five is five sixths times one fifth, which equals one sixth kilogram.'}])}-],done,'Chapter practice 4 of 4')}],+],done,'Chapter practice · set 4 of 4')}],['finish','Finished',()=>panel(0),{ask:finishCard}]].map(([id,title,run,extra])=>({id,title,run,...extra}));boot();diff --git a/site/math-notebook/ch08/index.html b/site/math-notebook/ch08/index.htmlindex 820eccf..4848067 100644--- a/site/math-notebook/ch08/index.html+++ b/site/math-notebook/ch08/index.html@@ -10,7 +10,7 @@ function dcPiece(p,x,y,w,h,t=.2,col=COL.chalk){const e=G(p,{x,y,o:0});mk('rect',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}={}){+function dcBoard(p,{x=145,y=245,step=125,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}));@@ -28,43 +28,45 @@ 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 dcPickBoard(p,x,y,correct,letter=correct?'A':'B'){const g=G(p);dcText(g,letter,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:letter+(correct?': decimal points aligned':': 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');}],+['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,220,320,m('tenths'));strips.forEach((e,i)=>tw(e,{x:540+i*18},m('tenths',.9),1.4,io));dcText(p,'10 tenths',630,550,m('tenths',2.5),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');+ [['2.68',400],['=',515],['2',610],['+',700],['0.6',810],['+',920],['0.08',1040]].forEach(([v,x])=>dcMath(p,v,x,705,m('columns'),55));+ [['wholes',610],['tenths',810],['hundredths',1040]].forEach(([v,x])=>dcText(p,v,x,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,'A'),right=dcPickBoard(p,980,335,true,'B');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');}],+['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.');for(let j=0;j<3;j++)dcPiece(p,330+j*27,300,27,270,.2);dcText(p,'7 wholes + 3 tenths',370,625,.2,32,COL.dim,'middle');for(let j=0;j<3;j++)for(let i=1;i<10;i++)draw(path(p,`M${330+j*27} ${300+i*27}h27`,{stroke:COL.chalk,'stroke-width':1},{d:0}),m('split'),.5);dcText(p,'7 wholes + 30 hundredths',1030,370,m('split'),38,COL.task,'middle');dcMath(p,'7.300',1030,490,m('more'),72);dcText(p,'zero extra thousandths',1030,550,m('more'),30,COL.dim,'middle');dcMath(p,'5 = 5.00',1030,670,m('whole'),58);dcText(p,'7.03 ≠ 7.3 · moving the 3 changes its place',800,800,m('care'),34,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('combine',3.9),3.2,io));es.slice(10).forEach((e,i)=>tw(e,{x:1170+i*26,y:445},m('combine',3.9),3.2,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);}],+['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',2.4));show(b.ans[2],m('small',6.2));dcCarry(p,b,0,m('carry',4.2));show(b.ans[1],m('carry',3));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);}],+['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',8.8),m('right',7.7),m('right',5.1),m('right',2.4)]);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','Trade 1 whole for 10 tenths.');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);[1020,1100,1180].forEach(x=>{const o=G(p,{x:x-30,y:625,o:0});mk('rect',{width:60,height:60,fill:COL.chalk,'fill-opacity':.12,stroke:COL.chalk,'stroke-opacity':.5,'stroke-width':1.5},o);show(o,.2);});dcText(p,'3 other wholes stay in their column',1110,730,.2,28,COL.dim,'middle');dcText(p,'2 hundredths',1253,395,.2,26,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');}],+['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'],[2.9,2.3,1.7,1.1,.5].map(o=>m('answer',o)));dcMath(p,'20.000 − 3.485 = 16.515',800,780,m('answer',4.8),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,130,345+i*100,.2,36,COL.dim);show(T(p,v,{x:660,y:345+i*100,size:56,font:MATH,anchor:'end',o:0}),.2);});path(p,'M120 590H680',{stroke:COL.chalk,'stroke-width':3});dcText(p,'Total',130,665,m('total'),36,COL.dim);show(T(p,'$25.30',{x:660,y:665,size:56,font:MATH,anchor:'end',fill:COL.task,o:0}),m('total',11.8));dcMath(p,'75 + 60 + 95 = 230 cents = $2.30',1110,360,m('total',3.5),40);dcMath(p,'$40.00 − $25.30 = $14.70',1110,560,m('left'),47);dcText(p,'First TWO decimal places count cents.',1110,740,m('cents'),32,COL.task,'middle');dcText(p,'Later places: fractions of a cent.',1110,795,m('cents',1),30,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')}],+])}],done,'Chapter practice · set 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')}],+])}],done,'Chapter practice · set 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')}],+],done,'Chapter practice · set 3 of 3')}],['finish','Finished',()=>panel(0),{ask:finishCard}]].map(([id,title,run,extra])=>({id,title,run,...extra}));boot();diff --git a/site/math-notebook/ch09/index.html b/site/math-notebook/ch09/index.htmlindex eebcbf8..496a0a9 100644--- a/site/math-notebook/ch09/index.html+++ b/site/math-notebook/ch09/index.html@@ -9,17 +9,17 @@ const dmTitle=(p,s,sub='')=>{dmText(p,s,100,115,.1,43);if(sub)dmText(p,sub,100,1function dmArea(p,{x=210,y=275,size=400,cols=4,rows=3,unit=.1,tWidth=.2,tHeight=.2,tCells=.2,tGrid=.2,label=true}={}){const g=G(p,{x,y}),d=size/10,base=unit*10;mk('rect',{width:size,height:size,fill:'none',stroke:COL.chalk,'stroke-width':3},g);- const a=G(g,{o:0});mk('rect',{width:d*cols,height:size,fill:COL.whole,'fill-opacity':.22},a);show(a,tWidth);- const b=G(g,{o:0});mk('rect',{width:size,height:d*rows,fill:COL.nat,'fill-opacity':.22},b);show(b,tHeight);+ const a=G(g,{o:0});mk('rect',{width:d*cols,height:size,fill:COL.whole,'fill-opacity':.3},a);show(a,tWidth);+ const b=G(g,{o:0});mk('rect',{width:size,height:d*rows,fill:COL.nat,'fill-opacity':.45},b);show(b,tHeight);const c=G(g,{o:0});mk('rect',{width:d*cols,height:d*rows,fill:COL.task,'fill-opacity':.55,stroke:COL.task,'stroke-width':3},c);c.dataset.product=String(cols*rows*unit*unit);c.dataset.width=String(cols*unit);c.dataset.height=String(rows*unit);show(c,tCells);const grid=G(g,{o:0});for(let i=1;i<10;i++){path(grid,`M${i*d} 0V${size}`,{stroke:COL.chalk,'stroke-width':1,'stroke-opacity':.65});path(grid,`M0 ${i*d}H${size}`,{stroke:COL.chalk,'stroke-width':1,'stroke-opacity':.65});}show(grid,tGrid);- if(label){dmText(g,`${base===1?'1':base.toFixed(1)} unit wide`,size/2,-32,.2,27,COL.dim,'middle');dmText(g,`${base===1?'1':base.toFixed(1)} unit high`,size/2,size+40,.2,27,COL.dim,'middle');}+ if(label){dmText(g,`${base===1?'1':base.toFixed(1)} unit wide`,size/2,-32,.2,27,COL.dim,'middle');put(dmText(g,`${base===1?'1':base.toFixed(1)} unit high`,0,0,.2,27,COL.dim,'middle'),{x:-24,y:size/2,r:-90});}return {g,a,b,c,grid,d};}-function dmPlace(p,digits,{x=330,y=400,t=.2,places=['ones','tenths','hundredths','thousandths'],step=160,size=72}={}){+function dmPlace(p,digits,{x=330,y=400,t=.2,places=['ones','tenths','hundredths','thousandths'],step=160,size=72,tDigits=null,tDot=null,boxW=.86}={}){const g=G(p,{x,y,o:0});show(g,t);const ones=Math.max(0,places.indexOf('ones'));- places.forEach((s,i)=>{const numeric=places[0]==='1',hy=numeric&&i%2===0?-122:-90;T(g,s,{x:i*step,y:hy,size:numeric?22:places.length>6?19:24,anchor:'middle',fill:COL.dim});if(numeric)path(g,`M${i*step} ${hy+10}V-68`,{stroke:COL.faint,'stroke-width':1});mk('rect',{x:i*step-step*.43,y:-65,width:step*.86,height:95,rx:12,fill:'none',stroke:COL.faint,'stroke-width':2},g);T(g,digits[i]??'',{x:i*step,y:10,size,font:'monospace',anchor:'middle'});});- T(g,'.',{x:(ones+.5)*step,y:10,size,font:'monospace',anchor:'middle',fill:COL.task});return g;+ places.forEach((s,i)=>{const numeric=places[0]==='1',stag=numeric||places.length>6,hy=stag&&i%2===0?-122:-90;T(g,s,{x:i*step,y:hy,size:numeric?22:places.length>6?21:24,anchor:'middle',fill:COL.dim});if(stag)path(g,`M${i*step} ${hy+10}V-68`,{stroke:COL.faint,'stroke-width':1});mk('rect',{x:i*step-step*boxW/2,y:-65,width:step*boxW,height:95,rx:12,fill:'none',stroke:COL.faint,'stroke-width':2},g);const dg=T(g,digits[i]??'',{x:i*step,y:10,size,font:'monospace',anchor:'middle',o:0});show(dg,tDigits?tDigits(i):0);});+ const dot=T(g,'.',{x:(ones+.5)*step,y:10,size,font:'monospace',anchor:'middle',fill:COL.task,o:0});show(dot,tDot??0);return g;}function dmWhole(p,{x=470,y=280,t=.2,tOnes=.2,tTens=.2,tSum=.2,wrong=false,mini=false}={}){const g=G(p,{x,y}),size=mini?49:68,dy=mini?72:96,end=mini?285:350;@@ -29,24 +29,24 @@ function dmWhole(p,{x=470,y=280,t=.2,tOnes=.2,tTens=.2,tSum=.2,wrong=false,mini=if(!mini){path(g,`M${end-5*size*.6} ${dy*3+28}H${end+20}`,{stroke:COL.chalk,'stroke-width':3});dmText(g,'5184',end,dy*4+24,tSum,size,COL.task,'end');}return g;}-function dmPatch(p,x,cols,rows,label){const g=G(p);dmText(g,label,x+130,255,.2,31,COL.dim,'middle');const model=dmArea(g,{x,y:315,size:260,cols,rows,unit:.1,tWidth:0,tHeight:0,tCells:.2,tGrid:.2,label:false});put(model.a,{o:0});put(model.b,{o:0});dmText(g,cols*rows+' hundredths',x+130,625,.2,28,COL.task,'middle');return {el:g,box:[x-15,270,290,375],label:`${label}: ${cols*rows} hundredths`};}-function dmZeroChart(p,x,ds,label){const g=G(p);dmText(g,label,x+205,255,.2,30,COL.dim,'middle');dmPlace(g,ds,{x:x+20,y:415,t:.2,places:['1','0.1','0.01','0.001','0.0001','0.00001'],step:70,size:48});dmText(g,'0.'+ds.slice(1).join(''),x+200,560,.2,45,COL.task,'middle');return {el:g,box:[x-15,290,450,315],label:'0.'+ds.slice(1).join('')};}+function dmPatch(p,x,cols,rows,label){const g=G(p);dmText(g,label,x+130,255,.2,31,COL.dim,'middle');const model=dmArea(g,{x,y:315,size:260,cols,rows,unit:.1,tWidth:99,tHeight:99,tCells:.2,tGrid:.2,label:false});dmText(g,cols*rows+' hundredths',x+130,625,.2,28,COL.task,'middle');return {el:g,box:[x-15,270,290,375],label:`${label}: ${cols*rows} hundredths`};}+function dmZeroChart(p,x,ds,label){const g=G(p);dmText(g,label,x+225,255,.2,30,COL.dim,'middle');dmPlace(g,ds,{x:x+20,y:415,t:.2,places:['1','0.1','0.01','0.001','0.0001','0.00001'],step:82,size:50,boxW:.78});dmText(g,'0.'+ds.slice(1).join(''),x+225,560,.2,45,COL.task,'middle');return {el:g,box:[x-15,290,490,315],label:'0.'+ds.slice(1).join('')};}const BEATS=[['intro','Products have scale',(m,D)=>{const g=G(scene,{o:0,y:24});T(g,'Unit 1 · The Number System · Chapter 9',{x:800,y:265,size:28,fill:COL.dim,anchor:'middle'});T(g,'Multiplying',{x:800,y:375,size:82,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);dmMath(g,'0.4 × 0.3',800,590,.6,60);const s=dmText(scene,'The decimal point has a reason.',800,710,m('sub'),34,COL.dim,'middle');hide(g,D-.8,.7);hide(s,D-.8,.7);}],-['area','Tenths times tenths',m=>{const p=panel(0);dmTitle(p,'0.4 × 0.3','One full square = 1 square unit');const a=dmArea(p,{tWidth:m('width'),tHeight:m('height'),tCells:m('cells'),tGrid:m('cells')});dmText(p,'width: 4 tenths',1050,290,m('width'),36,COL.whole,'middle');dmText(p,'height: 3 tenths',1050,375,m('height'),36,COL.nat,'middle');dmText(p,'4 × 3 = 12 cells',1050,495,m('cells'),38,COL.task,'middle');dmText(p,'each cell = 1 hundredth',1050,565,m('cells',2),31,COL.dim,'middle');dmMath(p,'0.4 × 0.3 = 0.12',1050,675,m('answer'),53);}],+['area','Tenths times tenths',m=>{const p=panel(0);dmTitle(p,'0.4 × 0.3','One full square = 1 square unit');const a=dmArea(p,{tWidth:m('width'),tHeight:m('height'),tCells:m('height',5.235),tGrid:m('cells')});dmText(p,'width: 4 tenths',1050,290,m('width'),36,COL.whole,'middle');dmText(p,'height: 3 tenths',1050,375,m('height'),36,COL.nat,'middle');dmText(p,'4 × 3 = 12 cells',1050,495,m('cells',7.735),38,COL.task,'middle');dmText(p,'each cell = 1 hundredth',1050,565,m('cells',2.5),31,COL.dim,'middle');dmMath(p,'0.4 × 0.3 = 0.12',1050,675,m('answer'),53);}],['fraction','Why the places add',m=>{const p=panel(0);dmTitle(p,'One tenth × one tenth = one hundredth');dmArea(p,{x:170,y:300,size:330});dmMath(p,[F('4','10'),' × ',F('3','10')],1060,325,m('frac'),58);dmMath(p,[F('4 × 3','10 × 10'),' = ',F('12','100')],1060,505,m('denom'),58);dmMath(p,'0.12',1060,660,m('result'),66,COL.task);dmText(p,'1 place + 1 place = 2 fractional places',800,800,m('result',2),35,COL.task,'middle');}],['q1','Quick check',()=>{const p=panel(0);dmTitle(p,'Which patch represents 0.4 × 0.3?','All three full squares represent 1 square unit.');S.dmPatch=[dmPatch(p,180,4,3,'A'),dmPatch(p,670,7,10,'B'),dmPatch(p,1160,4,10,'C')];},{ask:done=>quiz(BAND,[{id:'c-area',prompt:'Choose the product area: four tenths wide and three tenths high.',build:pickEls(S.dmPatch,0,'A contains 4 × 3 = 12 hundredth cells: 0.12.',i=>i===1?'B shows 70 hundredths, or 0.7, the sum of 0.4 and 0.3. Multiplication selects an overlap.':'C shows 40 hundredths, or 0.4. We need only three tenths of that height.',()=>pulseFx(S.dmPatch[0].el,1.03))}],done)}],['scale','Multiply and restore the scale',m=>{const p=panel(0);dmTitle(p,'3.24 × 1.6','Decimals are fractions with powers of ten as denominators.');dmMath(p,['3.24 = ',F('324','100')],390,325,m('first'),56);dmText(p,'2 fractional places',390,420,m('first'),31,COL.whole,'middle');dmMath(p,['1.6 = ',F('16','10')],1120,325,m('second'),56);dmText(p,'1 fractional place',1120,420,m('second'),31,COL.nat,'middle');dmMath(p,[F('324 × 16','100 × 10'),' = ',F('5184','1000')],800,620,m('multiply'),58);dmText(p,'2 + 1 = 3 places → divide by 1000',800,780,m('count'),38,COL.task,'middle');}],-['whole','The whole-number calculation',m=>{const p=panel(0);dmTitle(p,'324 × 16','Align whole-number ones. Each row keeps its place value.');dmWhole(p,{x:170,y:265,tOnes:m('ones'),tTens:m('tens'),tSum:m('sum')});dmText(p,'324 × 6 = 1944',1060,450,m('ones'),36,COL.chalk,'middle');dmText(p,'carry 2, then carry 1',1060,505,m('ones',2),28,COL.dim,'middle');dmText(p,'324 × 10 = 3240',1060,590,m('tens'),36,COL.task,'middle');dmText(p,'The 1 in 16 means ONE TEN.',1060,650,m('tens',2),29,COL.dim,'middle');dmText(p,'1944 + 3240 = 5184',1060,760,m('sum'),36,COL.task,'middle');}],-['point','Three fractional places',m=>{const p=panel(0);dmTitle(p,'5184 ÷ 1000','Restore the scales used in 3.24 × 1.6.');dmMath(p,'2 places + 1 place = 3',800,260,.2,48);dmPlace(p,['5','1','8','4'],{x:480,y:495,t:m('restore'),step:210});dmText(p,'4 → thousandths 8 → hundredths 1 → tenths',800,620,m('count'),32,COL.dim,'middle');dmMath(p,'3.24 × 1.6 = 5.184',800,765,m('result'),62,COL.task);}],-['estimate','Check the size',m=>{const p=panel(0);dmTitle(p,'3.24 × 1.6','A reasonable range helps catch a misplaced point.');dmMath(p,'3 < 3.24 < 4',800,285,.2,59);dmMath(p,'4.8 < 3.24 × 1.6 < 6.4',800,435,m('bound'),59);const x=350,y=555,w=900;path(p,`M${x} ${y}H${x+w}`,{stroke:COL.dim,'stroke-width':3});[4.8,5.184,6.4].forEach((v,i)=>{const px=x+(v-4.8)/1.6*w;mk('circle',{cx:px,cy:y,r:i===1?12:7,fill:i===1?COL.task:COL.chalk,opacity:0},p);const e=p.lastChild;show(e,i===1?m('correct'):m('bound'));dmText(p,String(v),px,610,i===1?m('correct'):m('bound'),31,i===1?COL.task:COL.dim,'middle');});dmText(p,'0.5184: too small 51.84: too large',800,755,m('reject'),38,COL.task,'middle');}],-['q2','Quick check',()=>{const p=panel(0);dmTitle(p,'The 1 in 16 is in the TENS place.','Which partial-product board preserves that value?');S.dmWhole=[0,1].map(j=>{const x=170+j*780,g=dmWhole(p,{x,y:280,mini:true,wrong:j===1});dmText(p,j?'B':'A',x+190,235,.2,31,COL.dim,'middle');dmText(p,j?'324 × 1':'324 × 10',x+190,590,.2,32,COL.task,'middle');return {el:g,box:[x-5,260,410,370],label:j?'B: partial product 324':'A: partial product 3240'};});},{ask:done=>quiz(BAND,[{id:'c-shift',prompt:'Choose the board with the correct tens-row partial product.',build:pickEls(S.dmWhole,0,'A uses 324 × 10 = 3240. The tens digit needs a shifted row or a zero in the ones place.',()=> 'B uses 324 × 1. But the 1 in 16 means ten, so the partial product must be 3240.',()=>pulseFx(S.dmWhole[0].el,1.03))}],done)}],+['whole','The whole-number calculation',m=>{const p=panel(0);dmTitle(p,'324 × 16','Align whole-number ones. Each row keeps its place value.');dmWhole(p,{x:170,y:265,tOnes:m('ones'),tTens:m('tens',2.318),tSum:m('sum')});dmText(p,'324 × 6 = 1944',1060,450,m('ones'),36,COL.chalk,'middle');dmText(p,'carry 2, then carry 1',1060,505,m('ones',2),28,COL.dim,'middle');dmText(p,'324 × 10 = 3240',1060,590,m('tens',2.318),36,COL.task,'middle');dmText(p,'The 1 in 16 means ONE TEN.',1060,650,m('tens'),29,COL.dim,'middle');dmText(p,'1944 + 3240 = 5184',1060,760,m('sum'),36,COL.task,'middle');}],+['point','Three fractional places',m=>{const p=panel(0);dmTitle(p,'5184 ÷ 1000','Restore the scales used in 3.24 × 1.6.');dmMath(p,'2 places + 1 place = 3',800,260,.2,48);dmPlace(p,['5','1','8','4'],{x:480,y:495,t:m('restore'),tDot:m('count',5.742),step:210});dmText(p,'4 → thousandths 8 → hundredths 1 → tenths',800,620,m('count'),32,COL.dim,'middle');dmMath(p,'3.24 × 1.6 = 5.184',800,765,m('result'),62,COL.task);}],+['estimate','Check the size',m=>{const p=panel(0);dmTitle(p,'3.24 × 1.6','A reasonable range helps catch a misplaced point.');dmMath(p,'3 < 3.24 < 4',800,285,.2,59);dmMath(p,'4.8 < 3.24 × 1.6 < 6.4',800,435,m('bound'),59);const x=350,y=555,w=900;path(p,`M${x} ${y}H${x+w}`,{stroke:COL.dim,'stroke-width':3});[4.8,5.184,6.4].forEach((v,i)=>{const px=x+(v-4.8)/1.6*w;mk('circle',{cx:px,cy:y,r:i===1?12:7,fill:i===1?COL.task:COL.chalk,opacity:0},p);const e=p.lastChild;show(e,i===1?m('correct'):m('bound'));dmText(p,String(v),px,610,i===1?m('correct'):m('bound'),31,i===1?COL.task:COL.dim,'middle');});dmText(p,'51.84: too large',480,755,m('reject'),38,COL.task,'middle');dmText(p,'0.5184: too small',1120,755,m('reject',3.347),38,COL.task,'middle');}],+['q2','Quick check',()=>{const p=panel(0);dmTitle(p,'The 1 in 16 is in the TENS place.','Which partial-product board preserves that value?');S.dmWhole=[0,1].map(j=>{const x=170+j*780,g=dmWhole(p,{x,y:280,mini:true,wrong:j===1});dmText(p,j?'B':'A',x+225,200,.2,31,COL.dim,'middle');dmText(p,j?'324 × 1':'324 × 10',x+225,590,.2,32,COL.task,'middle');return {el:g,box:[x-5,260,410,370],label:j?'B: partial product 324':'A: partial product 3240'};});},{ask:done=>quiz(BAND,[{id:'c-shift',prompt:'Choose the board with the correct tens-row partial product.',build:pickEls(S.dmWhole,0,'A uses 324 × 10 = 3240. The tens digit needs a shifted row or a zero in the ones place.',()=> 'B uses 324 × 1. But the 1 in 16 means ten, so the partial product must be 3240.',()=>pulseFx(S.dmWhole[0].el,1.03))}],done)}],['small','A product smaller than both factors',m=>{const p=panel(0);dmTitle(p,'0.06 × 0.04','Reference square: 0.1 × 0.1 = 0.01 square unit · drawn larger');dmArea(p,{x:165,y:285,size:400,cols:6,rows:4,unit:.01,tWidth:m('sides'),tHeight:m('sides'),tCells:m('grid'),tGrid:m('grid')});dmText(p,'width 0.06 · height 0.04',1060,285,m('sides'),32,COL.dim,'middle');dmText(p,'each cell = 0.01 × 0.01',1060,390,m('grid'),32,COL.dim,'middle');dmText(p,'24 ten-thousandths',1060,475,m('grid',2),37,COL.task,'middle');dmMath(p,'24 ÷ 10000 = 0.0024',1060,615,m('result'),46,COL.task);dmText(p,'2 + 2 = 4 fractional places',1060,700,m('result'),30,COL.dim,'middle');dmText(p,'Leading zeros keep the 2 in the thousandths place.',800,815,m('zeros'),31,COL.task,'middle');}],-['tiny','Make room for leading zeros',m=>{const p=panel(0);dmTitle(p,'0.004 × 0.012','An exact product: no rounding.');dmMath(p,[F('4','1000'),' × ',F('12','1000')],800,310,m('fractions'),58);dmMath(p,[F('48','1000000')],800,435,m('product'),54);dmPlace(p,['0','0','0','0','0','4','8'],{x:230,y:625,t:m('pad'),places:['ones','tenths','hundredths','thousandths','ten-thousandths','hundred-thousandths','millionths'],step:190,size:64});dmMath(p,'0.000048',800,795,m('exact'),66,COL.task);}],+['tiny','Make room for leading zeros',m=>{const p=panel(0);dmTitle(p,'0.004 × 0.012','An exact product: no rounding.');dmMath(p,[F('4','1000'),' × ',F('12','1000')],800,310,m('fractions'),58);dmMath(p,[F('48','1000000')],800,435,m('product'),54);dmPlace(p,['0','0','0','0','0','4','8'],{x:230,y:625,t:m('pad'),tDigits:i=>i<5?m('pad',5.8):m('pad',3.3),places:['ones','tenths','hundredths','thousandths','ten-thousandths','hundred-thousandths','millionths'],step:190,size:64});dmMath(p,'0.000048',800,795,m('exact'),66,COL.task);}],['trailing','Keep all the written digits',m=>{const p=panel(0);dmTitle(p,'0.250 × 0.60','Route A: keep every written fractional digit.');dmMath(p,'250 × 60 = 15000',800,310,m('keep'),58);dmText(p,'3 places + 2 places = 5 places',800,425,m('count'),38,COL.task,'middle');dmMath(p,[F('15000','100000'),' = 0.15000'],800,605,m('result'),59);dmMath(p,'0.15000 = 0.15',800,780,m('simplify'),58,COL.task);}],['trim','Or simplify the factors FIRST',m=>{const p=panel(0);dmTitle(p,'0.250 × 0.60','Route B: shorten the factors before multiplying.');dmMath(p,'0.25 × 0.6',800,305,m('factors'),65);dmMath(p,'25 × 6 = 150',800,435,m('whole'),58);dmText(p,'2 places + 1 place = 3 places',800,555,m('count'),38,COL.task,'middle');dmMath(p,'150 ÷ 1000 = 0.150 = 0.15',800,720,m('same'),57,COL.task);dmText(p,'Matching integers + matching place count',800,815,m('same',2),31,COL.dim,'middle');}],['integer','A whole-number zero has value',m=>{const p=panel(0);dmTitle(p,'240 × 0.003','240 has ZERO fractional places.');dmMath(p,['240 × ',F('3','1000')],800,305,m('fraction'),59);dmMath(p,'240 × 3 = 720',800,440,m('whole'),59);dmMath(p,'720 ÷ 1000 = 0.720 = 0.72',800,615,m('answer'),57,COL.task);dmText(p,'240 ≠ 24',800,740,m('care'),41,COL.task,'middle');dmText(p,'Dropping an integer zero makes the answer ten times too small.',800,805,m('care',2),31,COL.dim,'middle');}],-['q3','Quick check',()=>{const p=panel(0);dmTitle(p,'0.06 × 0.04 = 24 ÷ 10000','Chart headings show each digit’s place value. Extra trailing zeros are fine.');S.dmZero=[dmZeroChart(p,105,['0','0','0','2','4','0'],'A'),dmZeroChart(p,585,['0','0','2','4','0','0'],'B'),dmZeroChart(p,1065,['0','0','0','0','2','4'],'C')];},{ask:done=>quiz(BAND,[{id:'c-small',prompt:'Choose the product chart. Leading zeros must preserve place value.',build:pickEls(S.dmZero,0,'A shows 24 ten-thousandths: 0.0024. The first nonzero digit is in the thousandths place.',i=>i===1?'B shows 0.024, ten times too large. Two places plus two places requires four fractional places.':'C shows 0.00024, ten times too small. Its 2 starts one place too far right.',()=>pulseFx(S.dmZero[0].el,1.02))}],done)}],+['q3','Quick check',()=>{const p=panel(0);dmTitle(p,'0.06 × 0.04 = 24 ÷ 10000','Chart headings show each digit’s place value.');S.dmZero=[dmZeroChart(p,50,['0','0','0','2','4'],'A'),dmZeroChart(p,570,['0','0','2','4'],'B'),dmZeroChart(p,1090,['0','0','0','0','2','4'],'C')];},{ask:done=>quiz(BAND,[{id:'c-small',prompt:'Choose the product chart. Leading zeros must preserve place value.',build:pickEls(S.dmZero,0,'A shows 24 ten-thousandths: 0.0024. The first nonzero digit is in the thousandths place.',i=>i===1?'B shows 0.024, ten times too large. Two places plus two places requires four fractional places.':'C shows 0.00024, ten times too small. Its 2 starts one place too far right.',()=>pulseFx(S.dmZero[0].el,1.02))}],done)}],['context','Price times amount',m=>{const p=panel(0);dmTitle(p,'Ribbon · $6.40 per meter × 2.75 meters','The price for each meter is multiplied by the number of meters.');dmText(p,'rate × amount = total price',800,290,.2,38,COL.dim,'middle');dmMath(p,'640 × 275 = 176000',800,420,m('multiply'),58);dmText(p,'2 + 2 = 4 written fractional places',800,540,m('places'),36,COL.task,'middle');dmMath(p,'176000 ÷ 10000 = 17.6000',800,650,m('places',2),54);dmMath(p,'$17.60',800,780,m('money'),70,COL.task);}],['wrap','Four reliable moves',m=>{const p=panel(0);[['Multiply whole numbers; shift each partial product.','w1'],['Add the fractional places of the digits you used.','w2'],['Keep leading zeros. Check the size.','w3'],['Trim fractional zeros carefully; keep scales matched.','w4']].forEach(([s,k],i)=>{const g=G(p,{x:-16,y:235+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-products',prompt:'Multiply exactly. Equivalent trailing zeros are accepted.',build:blanks([@@ -54,19 +54,19 @@ const BEATS=[{parts:['36 × 0.025 = ',{box:'0.9'}],why:'36 × 25 = 900. Zero plus three fractional places gives 0.900 = 0.9.'},{parts:['0.08 × 0.07 = ',{box:'0.0056'}],why:'8 × 7 = 56, with four fractional places: 0.0056.'},{parts:['0.006 × 0.013 = ',{box:'0.000078'}],why:'6 × 13 = 78, with six fractional places: 0.000078.',hint:'Pad the places before 78 with leading zeros.'}-])}],done,'Chapter practice 1 of 3')}],+])}],done,'Chapter practice · set 1 of 3')}],['final2','Chapter practice',()=>panel(0),{ask:done=>quiz(SCREEN,[{id:'p-zeros',prompt:'Keep the product and the place count consistent.',build:blanks([{parts:['0.420 × 0.50 = ',{box:'0.21'}],why:'420 × 50 = 21000 with five places: 0.21000 = 0.21. Or trim FIRST: 42 × 5 = 210 with three places.'},{parts:['520 × 0.0003 = ',{box:'0.156'}],why:'520 × 3 = 1560, with four fractional places: 0.1560. The integer zero stays.'},{parts:['0.30 × 0.40 = ',{box:'0.12'}],why:'30 × 40 = 1200, with four fractional places: 0.1200 = 0.12.'},{parts:['235 × 14: tens-row partial = ',{box:'2350'}],why:'The 1 in 14 means ten. The partial product is 235 × 10 = 2350, then add the ones-row 940.'}-])}],done,'Chapter practice 2 of 3')}],+])}],done,'Chapter practice · set 2 of 3')}],['final3','Chapter practice',()=>panel(0),{ask:done=>quiz(SCREEN,[{id:'p-price',prompt:'Cloth costs $4.80 per meter. You buy 3.25 meters. Find the total price.',build:blanks([{parts:['$',{box:'15.60'}],why:'4.80 × 3.25 = 15.6000, displayed as $15.60.'}])},{id:'p-map',prompt:'Each centimeter on a map represents 2.4 meters. What distance do 3.75 centimeters represent?',build:blanks([{parts:[{box:'9'},' meters'],why:'2.4 × 3.75 = 9.000 = 9 meters.'}])},{id:'p-distance',prompt:'A walker travels 0.18 kilometers per minute for 7.5 minutes. Find the distance.',build:blanks([{parts:[{box:'1.35'},' kilometers'],why:'0.18 × 7.5 = 1.350 = 1.35 kilometers.'}])},{id:'p-volume',prompt:'A straight-sided container holds 0.025 liters for each centimeter of water height. It is filled to 0.4 centimeter. Find the volume.',build:blanks([{parts:[{box:'0.01'},' liters'],why:'0.025 × 0.4 = 0.0100 = 0.01 liters. Four fractional places before simplification.'}])}-],done,'Chapter practice 3 of 3')}],+],done,'Chapter practice · set 3 of 3')}],['finish','Finished',()=>panel(0),{ask:finishCard}]].map(([id,title,run,extra])=>({id,title,run,...extra}));boot();diff --git a/site/math-notebook/ch10/index.html b/site/math-notebook/ch10/index.htmlindex 737b055..ce747ba 100644--- a/site/math-notebook/ch10/index.html+++ b/site/math-notebook/ch10/index.html@@ -6,7 +6,7 @@ const CHAPTER={number:10,title:'Dividing Decimals',minutes:10,language:'en', nexconst ddText=(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 ddMath=(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;};const ddTitle=(p,s,sub='')=>{ddText(p,s,100,115,.1,43);if(sub)ddText(p,sub,100,165,.15,27,COL.dim);};-function ddBar(p,{x=220,y=360,w=1080,h=110,n=6,total='1.8',group='0.3',t=0}={}){+function ddBar(p,{x=260,y=360,w=1080,h=130,n=6,total='1.8',group='0.3',t=0}={}){const g=G(p,{x,y,o:0});g.dataset.groups=String(n);g.dataset.total=total;g.dataset.divisor=group;show(g,t);for(let i=0;i<n;i++)mk('rect',{x:i*w/n,y:0,width:w/n,height:h,fill:COL.whole,'fill-opacity':i%2?.22:.38,stroke:COL.whole,'stroke-width':2},g);path(g,`M0 -25V-38H${w}V-25`,{stroke:COL.chalk,'stroke-width':2});@@ -15,62 +15,67 @@ function ddBar(p,{x=220,y=360,w=1080,h=110,n=6,total='1.8',group='0.3',t=0}={}){}function ddScale(p,digits,label,{x=520,y=330,step=125,shift=1,t=0,tm=1}={}){const g=G(p,{x,y,o:0});show(g,t);ddText(g,label,-240,10,t,29,COL.dim);- digits.forEach((d,i)=>{mk('rect',{x:i*step-48,y:-64,width:96,height:99,rx:9,fill:'none',stroke:COL.faint,'stroke-width':2},g);T(g,d,{x:i*step,y:10,size:66,font:'monospace',anchor:'middle',fill:i>2?COL.dim:COL.chalk});});+ const lead=digits.findIndex(d=>d!=='0');// leading zeros left of the new point fade once it has moved+ digits.forEach((d,i)=>{const r=mk('rect',{x:i*step-48,y:-64,width:96,height:99,rx:9,fill:'none',stroke:COL.faint,'stroke-width':2},g),e=T(g,d,{x:i*step,y:10,size:66,font:'monospace',anchor:'middle',fill:i>2?COL.dim:COL.chalk});if(i<lead&&i<=shift)[r,e].forEach(z=>tw(z,{o:.25},tm+1.4,.5));});const dot=T(g,'.',{x:step*.5,y:10,size:76,font:'monospace',fill:COL.task,anchor:'middle'});dot.dataset.shift=String(shift);dot.dataset.origin=String(step*.5);dot.dataset.target=String((shift+.5)*step);tw(dot,{x:(shift+.5)*step},tm,1.4,io);const a=path(g,`M${step*.5} 64H${(shift+.5)*step}m-12 -8 12 8-12 8`,{stroke:COL.task,'stroke-width':3},{d:0});draw(a,tm,1.4);ddText(g,'× '+10**shift,700,8,tm,33,COL.task);return {g,dot};}-function ddBoard(p,j,top,bot){const x=125+j*490,g=G(p);ddText(g,String.fromCharCode(65+j),x+200,265,.1,29,COL.dim,'middle');ddMath(g,top+' ÷ '+bot,x+200,415,.1,51);ddText(g,j===0?'×10 to both':j===1?'×10 to dividend only':'×100 and ×10',x+200,535,.1,28,COL.task,'middle');return {el:g,box:[x-5,290,415,300],label:top+' divided by '+bot};}+function ddBoard(p,j,top,bot){const x=125+j*490,g=G(p);ddText(g,String.fromCharCode(65+j),x+200,285,.1,32,COL.dim,'middle');ddMath(g,top+' ÷ '+bot,x+200,450,.1,64);return {el:g,box:[x-5,310,415,250],label:top+' divided by '+bot};}function ddLong(p,stage=0,times={}){- const g=G(p,{x:220,y:225}),sz=55,xs=[340,430,520,610],rows=[125,210,290,370,450,530,610];+ // Fewer rows on screen → larger board; centred at x 500, top ~215, last row clear of the caption box (y < 770).+ const s=[1.8,1.5,1.25,1][stage],top=[260,225,205,210][stage],g=G(p,{x:500-s*447.5,y:top+s*20,s}),sz=55,xs=[340,430,520,610],rows=[110,180,250,320,390,460,530];g.dataset.dividend='2.700';g.dataset.divisor='4';g.dataset.quotient='0.675';const digit=(s,i,y,t=0,col=COL.chalk)=>ddText(g,s,xs[i],y,t,sz,col,'middle');- ddText(g,'4',225,rows[0],0,sz);path(g,`M280 140V44H670`,{stroke:COL.chalk,'stroke-width':3});+ ddText(g,'4',225,rows[0],0,sz);path(g,`M280 125V44H670`,{stroke:COL.chalk,'stroke-width':3});['2','7','0','0'].forEach((s,i)=>digit(s,i,rows[0],i>1?(times.zero??0):0,i>1?COL.dim:COL.chalk));- ddText(g,'.',385,rows[0],0,sz,COL.task,'middle');digit('0',0,20,times.point??0);ddText(g,'.',385,20,times.point??0,sz,COL.task,'middle');- path(g,'M385 35V95',{stroke:COL.task,'stroke-width':1.5,'stroke-dasharray':'5 5'});+ ddText(g,'.',385,rows[0],0,sz,COL.task,'middle');digit('0',0,20,times.ones??0);ddText(g,'.',385,20,times.point??0,sz,COL.task,'middle');+ path(g,'M385 35V80',{stroke:COL.task,'stroke-width':1.5,'stroke-dasharray':'5 5'});+ // bring-down arrows stop above the digit they bring down, so the 0 is not struck through+ const down=(x,r,t)=>{const a=path(g,`M${x} 130V${rows[r]-50}m-8 -12 8 12 8-12`,{stroke:COL.task,'stroke-width':2},{d:0});draw(a,t,.7);};+ const ul=(x,r,t)=>{const ln=path(g,`M${x} ${rows[r]+20}H${x+156}`,{stroke:COL.chalk,'stroke-width':2},{d:0});draw(ln,t,.3);};const ts=n=>stage===n?(times.subtract??0):0,td=n=>stage===n?(times.digit??0):0,te=n=>stage===n?(times.exchange??0):0;- if(stage>=1){digit('6',1,20,td(1),COL.task);digit('2',0,rows[1],ts(1));digit('4',1,rows[1],ts(1));ddText(g,'−',265,rows[1],ts(1),sz);const ln=path(g,'M310 233H466',{stroke:COL.chalk,'stroke-width':2},{d:0});draw(ln,ts(1),.3);digit('3',1,rows[2],ts(1));digit('0',2,rows[2],te(1),COL.task);const a=path(g,'M520 150V270m-8 -12 8 12 8-12',{stroke:COL.task,'stroke-width':2},{d:0});draw(a,te(1),.7);}- if(stage>=2){digit('7',2,20,td(2),COL.task);digit('2',1,rows[3],ts(2));digit('8',2,rows[3],ts(2));ddText(g,'−',355,rows[3],ts(2),sz);const ln=path(g,'M400 393H556',{stroke:COL.chalk,'stroke-width':2},{d:0});draw(ln,ts(2),.3);digit('2',2,rows[4],ts(2));digit('0',3,rows[4],te(2),COL.task);const a=path(g,'M610 150V430m-8 -12 8 12 8-12',{stroke:COL.task,'stroke-width':2},{d:0});draw(a,te(2),.7);}- if(stage>=3){digit('5',3,20,td(3),COL.task);digit('2',2,rows[5],ts(3));digit('0',3,rows[5],ts(3));ddText(g,'−',445,rows[5],ts(3),sz);const ln=path(g,'M490 553H646',{stroke:COL.chalk,'stroke-width':2},{d:0});draw(ln,ts(3),.3);digit('0',3,rows[6],ts(3),COL.task);}+ if(stage>=1){digit('6',1,20,td(1),COL.task);digit('2',0,rows[1],ts(1));digit('4',1,rows[1],ts(1));ddText(g,'−',265,rows[1],ts(1),sz);ul(310,1,ts(1));digit('3',1,rows[2],ts(1));digit('0',2,rows[2],te(1),COL.task);down(520,2,te(1));}+ if(stage>=2){digit('7',2,20,td(2),COL.task);digit('2',1,rows[3],ts(2));digit('8',2,rows[3],ts(2));ddText(g,'−',355,rows[3],ts(2),sz);ul(400,3,ts(2));digit('2',2,rows[4],ts(2));digit('0',3,rows[4],te(2),COL.task);down(610,4,te(2));}+ if(stage>=3){digit('5',3,20,td(3),COL.task);digit('2',2,rows[5],ts(3));digit('0',3,rows[5],ts(3));ddText(g,'−',445,rows[5],ts(3),sz);ul(490,5,ts(3));digit('0',3,rows[6],ts(3),COL.task);}return g;}function ddQuotient(p,j,ds){const x=155+j*495,g=G(p),step=72;ddText(g,String.fromCharCode(65+j),x+150,245,.1,29,COL.dim,'middle');ds.forEach((d,i)=>ddText(g,d,x+i*step,365,.1,54,COL.task,'middle'));['2','7','0','0'].forEach((d,i)=>ddText(g,d,x+i*step,490,.1,54,COL.chalk,'middle'));ddText(g,'.',x+step*.5,365,.1,54,COL.task,'middle');ddText(g,'.',x+step*.5,490,.1,54,COL.task,'middle');path(g,`M${x-40} 405H${x+328}`,{stroke:COL.chalk,'stroke-width':2});ddText(g,'dividend 2.700',x+140,585,.1,28,COL.dim,'middle');return {el:g,box:[x-40,280,368,330],label:['0.675','6.75','0.0675'][j]};}const BEATS=[['intro','Same-sized groups',(m,D)=>{const g=G(scene,{o:0,y:24});T(g,'Unit 1 · The Number System · Chapter 10',{x:800,y:265,size:28,fill:COL.dim,anchor:'middle'});T(g,'Dividing',{x:800,y:375,size:82,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);ddMath(g,'1.8 ÷ 0.3',800,590,.6,60);const s=ddText(scene,'How many groups fit?',800,710,m('sub'),34,COL.dim,'middle');hide(g,D-.8,.7);hide(s,D-.8,.7);}],-['terms','Three jobs in division',m=>{const p=panel(0);ddTitle(p,'1.8 meters ÷ 0.3 meter per piece');ddBar(p);ddText(p,'dividend · total amount',420,240,m('dividend'),32,COL.chalk,'middle');ddText(p,'divisor · size of one group',1150,240,m('divisor'),32,COL.task,'middle');ddMath(p,'1.8 ÷ 0.3 = 6',800,665,m('groups'),64);ddText(p,'quotient · number of pieces',800,750,m('groups',2),34,COL.dim,'middle');}],-['same','Count the same ribbon in tenths',m=>{const p=panel(0);ddTitle(p,'Scale the total AND each group','Same ribbon · same six sections · different counting unit');const b=ddBar(p);hide(b.a,m('scale'),.5);hide(b.b,m('scale'),.5);ddText(b.g,'18 tenths',540,-58,m('scale',.5),45,COL.chalk,'middle');ddText(b.g,'3 tenths',90,158,m('scale',.5),36,COL.task,'middle');ddMath(p,'1.8 ÷ 0.3 = 18 ÷ 3 = 6',800,675,m('answer'),57);ddText(p,'×10 to BOTH → same number of groups',800,785,m('scale',1),34,COL.task,'middle');}],-['q1','Quick check',()=>{const p=panel(0);ddTitle(p,'Original: 1.8 ÷ 0.3 = 6','Which option scales BOTH labels by ten and keeps six groups?');S.ddBars=[0,1,2].map(j=>{const x=150+j*500,b=ddBar(p,{x,y:345,w:310,h:105,total:j===0?'18':j===1?'18':'1.8',group:j===0?'3':j===1?'0.3':'3'});ddText(p,String.fromCharCode(65+j)+' · proposed labels',x+155,245,0,27,COL.dim,'middle');ddText(p,j===0?'18 ÷ 3':j===1?'18 ÷ 0.3':'1.8 ÷ 3',x+155,570,0,39,COL.chalk,'middle');return {el:b.g,box:[x-30,260,370,355],label:['18 divided by 3','18 divided by 0.3','1.8 divided by 3'][j]};});ddText(p,'Candidate labels must agree with the six equal sections.',800,635,0,26,COL.dim,'middle');},{ask:done=>quiz(BAND,[{id:'c-scale',prompt:'Choose the correctly relabelled bar.',build:pickEls(S.ddBars,0,'A multiplies BOTH numbers by 10: 18÷3=6. Each of the six sections is 3 tenths.',i=>i===1?'B scales only the total. 18÷0.3=60, so those labels do not describe six equal groups.':'C scales only the divisor. 1.8÷3=0.6, not six groups.',()=>pulseFx(S.ddBars[0].el,1.02))}],done)}],+['terms','Three jobs in division',m=>{const p=panel(0);ddTitle(p,'1.8 meters ÷ 0.3 meter per piece');ddBar(p);ddText(p,'dividend · total amount',800,240,m('dividend'),32,COL.chalk,'middle');ddText(p,'divisor · size of one group',410,538,m('divisor'),32,COL.task);ddMath(p,'1.8 ÷ 0.3 = 6',800,665,m('groups'),64);ddText(p,'quotient · number of pieces',800,750,m('groups',2),34,COL.dim,'middle');}],+['same','Count the same ribbon in tenths',m=>{const p=panel(0);ddTitle(p,'Scale the total AND each group','Same ribbon · same six sections · different counting unit');const b=ddBar(p);hide(b.a,m('scale'),.5);hide(b.b,m('scale'),.5);ddText(b.g,'18 tenths',b.w/2,-58,m('scale',.5),45,COL.chalk,'middle');ddText(b.g,'3 tenths',90,b.h+48,m('scale',.5),36,COL.task,'middle');ddMath(p,'1.8 ÷ 0.3 = 18 ÷ 3 = 6',800,675,m('answer'),57);ddText(p,'×10 to BOTH → same number of groups',800,785,m('scale',1),34,COL.task,'middle');}],+['q1','Quick check',()=>{const p=panel(0);ddTitle(p,'Original: 1.8 ÷ 0.3 = 6','Which bar has BOTH numbers multiplied by ten?');S.ddBars=[0,1,2].map(j=>{const x=150+j*500,b=ddBar(p,{x,y:345,w:310,h:105,total:j===0?'18':j===1?'18':'1.8',group:j===0?'3':j===1?'0.3':'3'});ddText(p,String.fromCharCode(65+j),x+155,215,0,32,COL.dim,'middle');ddText(p,j===0?'18 ÷ 3':j===1?'18 ÷ 0.3':'1.8 ÷ 3',x+155,570,0,39,COL.chalk,'middle');return {el:b.g,box:[x-30,260,370,355],label:['18 divided by 3','18 divided by 0.3','1.8 divided by 3'][j]};});},{ask:done=>quiz(BAND,[{id:'c-scale',prompt:'Which bar still shows six groups, with both numbers ×10?',build:pickEls(S.ddBars,0,'A multiplies BOTH numbers by 10: 18 ÷ 3 = 6. Each of the six sections is 3 tenths.',i=>i===1?'B scales only the total. 18 ÷ 0.3 = 60, so that bar would need 60 groups, not 6.':'C scales only the divisor. 1.8 ÷ 3 = 0.6, not six groups.',()=>pulseFx(S.ddBars[0].el,1.02))}],done)}],['rule','Why the quotient stays the same',m=>{const p=panel(0);ddTitle(p,'Same factor on top and bottom','Dividend a · divisor b · b ≠ 0');frac(p,['a'],['b'],590,350,m('both'),{size:63,anchor:'middle'});ddMath(p,'=',740,375,m('both'),63);frac(p,['a × 10',E('k')],['b × 10',E('k')],990,350,m('both'),{size:63,anchor:'middle'});ddText(p,'same nonzero factor',800,520,m('both'),34,COL.task,'middle');ddText(p,'The common factor cancels.',800,625,m('cancel'),38,COL.chalk,'middle');ddText(p,'Divisor 0: undefined',800,780,m('nonzero'),38,COL.task,'middle');}],['shift','Both decimal points move together',m=>{const p=panel(0);ddTitle(p,'4.68 ÷ 0.12','Faint trailing zeros keep the value unchanged.');S.ddShift=[ddScale(p,['4','6','8','0','0'],'dividend',{shift:2,tm:m('move')}),ddScale(p,['0','1','2','0','0'],'divisor',{y:520,shift:2,tm:m('move')})];ddText(p,'468 ÷ 12',800,710,m('whole'),53,COL.chalk,'middle');ddText(p,'468 ÷ 12 = 39',800,805,m('answer'),53,COL.task,'middle');}],['minimum','Make the divisor whole',m=>{const p=panel(0);ddTitle(p,'0.27 ÷ 0.4','Only ONE shift is needed for the divisor.');S.ddShift=[ddScale(p,['0','2','7','0','0'],'dividend',{shift:1,tm:m('move')}),ddScale(p,['0','4','0','0','0'],'divisor',{y:520,shift:1,tm:m('move')})];ddMath(p,'2.7 ÷ 4',800,710,m('whole'),59,COL.task);ddText(p,'A decimal dividend is fine.',800,805,m('whole',2),36,COL.dim,'middle');}],-['q2','Quick check',()=>{const p=panel(0);ddTitle(p,'0.27 ÷ 0.4','Which transformation multiplies BOTH numbers by ten?');S.ddBoards=[ddBoard(p,0,'2.7','4'),ddBoard(p,1,'2.7','0.4'),ddBoard(p,2,'27','4')];},{ask:done=>quiz(BAND,[{id:'c-move',prompt:'Choose the equivalent division with a whole divisor.',build:pickEls(S.ddBoards,0,'A uses ×10 on both numbers. 2.7÷4 has exactly the original quotient.',i=>i===1?'B moves only the dividend’s point. You must multiply the divisor by ten too.':'C multiplies the dividend by 100 but the divisor by 10. Both factors must match.',()=>pulseFx(S.ddBoards[0].el,1.02))}],done)}],-['longstart','Place the point before dividing',m=>{const p=panel(0);ddTitle(p,'2.7 ÷ 4','After scaling 0.27÷0.4 by 10');ddLong(p,0,{point:m('point'),zero:m('zero')});ddText(p,'quotient point directly above',1210,320,m('point'),29,COL.task,'middle');ddText(p,'dividend point',1210,370,m('point'),29,COL.dim,'middle');ddMath(p,'2.7 = 2.700',1210,565,m('zero'),47);ddText(p,'same value · smaller units available',1210,640,m('zero',2),26,COL.dim,'middle');}],-['tenths','Six tenths per group',m=>{const p=panel(0);ddTitle(p,'27 tenths shared among 4 groups');ddLong(p,1,{digit:m('digit'),subtract:m('subtract'),exchange:m('exchange')});ddText(p,'27 tenths − 24 tenths',1210,350,m('subtract'),32,COL.chalk,'middle');ddText(p,'= 3 tenths',1210,425,m('subtract'),36,COL.task,'middle');ddText(p,'3 tenths = 30 hundredths',1210,580,m('exchange'),32,COL.task,'middle');ddText(p,'One tenth exchanges for 10 hundredths.',1210,660,m('exchange',2),25,COL.dim,'middle');}],-['hundredths','Seven hundredths per group',m=>{const p=panel(0);ddTitle(p,'30 hundredths shared among 4 groups');ddLong(p,2,{digit:m('digit'),subtract:m('subtract'),exchange:m('exchange')});ddText(p,'30 hundredths − 28 hundredths',1210,390,m('subtract'),29,COL.chalk,'middle');ddText(p,'= 2 hundredths',1210,465,m('subtract'),36,COL.task,'middle');ddText(p,'2 hundredths = 20 thousandths',1210,625,m('exchange'),29,COL.task,'middle');ddText(p,'Bring down 0: record the exchange.',1210,700,m('exchange',2),26,COL.dim,'middle');}],-['thousandths','Five thousandths; remainder zero',m=>{const p=panel(0);ddTitle(p,'20 thousandths shared among 4 groups');ddLong(p,3,{digit:m('digit'),subtract:m('subtract')});ddText(p,'20−20=0 thousandths',1210,400,m('subtract'),34,COL.task,'middle');ddMath(p,'0.675 × 4 = 2.7',1210,585,m('check'),43);ddText(p,'0.27 ÷ 0.4 = 0.675',1210,735,m('check',2),39,COL.task,'middle');}],+['q2','Quick check',()=>{const p=panel(0);ddTitle(p,'0.27 ÷ 0.4','Which one multiplies BOTH numbers by ten?');S.ddBoards=[ddBoard(p,0,'2.7','4'),ddBoard(p,1,'2.7','0.4'),ddBoard(p,2,'27','4')];},{ask:done=>quiz(BAND,[{id:'c-move',prompt:'Which division gives the same answer as 0.27 ÷ 0.4?',build:pickEls(S.ddBoards,0,'A uses ×10 on both numbers, so 2.7 ÷ 4 has exactly the same answer.',i=>i===1?'B moves only the dividend’s point. You must multiply the divisor by ten too.':'C multiplies the dividend by 100 but the divisor by 10. Both factors must match.',()=>pulseFx(S.ddBoards[0].el,1.02))}],done)}],+['longstart','Place the point before dividing',m=>{const p=panel(0);ddTitle(p,'2.7 ÷ 4','After scaling 0.27 ÷ 0.4 by 10');ddLong(p,0,{point:m('point'),ones:m('point',8.3),zero:m('zero')});ddText(p,'quotient point directly above',1230,300,m('point'),34,COL.task,'middle');ddText(p,'the dividend point',1230,360,m('point'),34,COL.dim,'middle');ddText(p,'0 wholes in the ones place',1230,460,m('point',8.3),34,COL.chalk,'middle');ddMath(p,'2.7 = 2.700',800,660,m('zero'),64);ddText(p,'same value · smaller units available',800,750,m('zero',2),32,COL.dim,'middle');}],+['tenths','Six tenths per group',m=>{const p=panel(0);ddTitle(p,'27 tenths shared among 4 groups');ddLong(p,1,{digit:m('digit',5.7),subtract:m('subtract'),exchange:m('exchange')});ddText(p,'27 tenths − 24 tenths',1210,350,m('subtract'),38,COL.chalk,'middle');ddText(p,'= 3 tenths',1210,430,m('subtract'),42,COL.task,'middle');ddText(p,'3 tenths = 30 hundredths',1210,590,m('exchange'),38,COL.task,'middle');ddText(p,'1 tenth = 10 hundredths',1210,670,m('exchange',2),32,COL.dim,'middle');}],+['hundredths','Seven hundredths per group',m=>{const p=panel(0);ddTitle(p,'30 hundredths shared among 4 groups');ddLong(p,2,{digit:m('digit'),subtract:m('subtract'),exchange:m('exchange')});ddText(p,'30 hundredths − 28 hundredths',1180,390,m('subtract'),34,COL.chalk,'middle');ddText(p,'= 2 hundredths',1180,470,m('subtract'),42,COL.task,'middle');ddText(p,'2 hundredths = 20 thousandths',1180,620,m('exchange'),34,COL.task,'middle');ddText(p,'Bring down 0 to show the exchange.',1180,700,m('exchange',2),30,COL.dim,'middle');}],+['thousandths','Five thousandths; remainder zero',m=>{const p=panel(0);ddTitle(p,'20 thousandths shared among 4 groups');ddLong(p,3,{digit:m('digit'),subtract:m('subtract')});ddText(p,'20 − 20 = 0 thousandths',1150,400,m('subtract'),38,COL.task,'middle');ddMath(p,'0.675 × 4 = 2.7',1150,560,m('check'),52);ddText(p,'0.27 ÷ 0.4 = 0.675',1150,700,m('check',2),44,COL.task,'middle');}],['q3','Quick check',()=>{const p=panel(0);ddTitle(p,'2.700 ÷ 4','Choose the quotient row. The point stays above the dividend point.');S.ddQ=[ddQuotient(p,0,['0','6','7','5']),ddQuotient(p,1,['6','7','5']),ddQuotient(p,2,['0','0','6','7','5'])];},{ask:done=>quiz(BAND,[{id:'c-point',prompt:'Which row gives 0.675 with every digit in its correct place?',build:pickEls(S.ddQ,0,'A has 0 ones, 6 tenths, 7 hundredths, 5 thousandths. Its point is directly above the dividend point.',i=>i===1?'B places 6 in the ones column instead of the tenths column. Its quotient is ten times too large.':'C places 6 in the hundredths column. Its quotient is ten times too small.',()=>pulseFx(S.ddQ[0].el,1.02))}],done)}],-['sizes','The size of the group matters',m=>{const p=panel(0);ddTitle(p,'Division can make a positive number larger or smaller');const b=ddBar(p,{x:250,y:330,w:324,h:90,total:'1.2',group:'0.2',t:m('small')});ddMath(p,'1.2 ÷ 0.2 = 6',430,600,m('small'),49);ddText(p,'six small groups',430,690,m('small'),30,COL.dim,'middle');const g=G(p,{x:930,y:330,o:0});g.dataset.groupSize='2';g.dataset.amount='1.2';show(g,m('large'));mk('rect',{width:540,height:90,fill:'none',stroke:COL.whole,'stroke-width':3},g);mk('rect',{width:324,height:90,fill:COL.whole,'fill-opacity':.38,stroke:COL.task,'stroke-width':2},g);for(let i=1;i<10;i++)path(g,`M${i*54} 0V90`,{stroke:COL.faint,'stroke-width':1});ddText(g,'one whole group= 2',270,-45,m('large'),31,COL.chalk,'middle');ddText(g,'amount 1.2 fills 6/10 of the group',270,145,m('large'),26,COL.task,'middle');ddMath(p,'1.2 ÷ 2 = 0.6',1200,600,m('large'),49);ddText(p,'six tenths of one larger group',1200,690,m('large'),29,COL.dim,'middle');}],+['sizes','The size of the group matters',m=>{const p=panel(0);ddTitle(p,'Division can make a positive number larger or smaller');const b=ddBar(p,{x:250,y:330,w:324,h:130,total:'1.2',group:'0.2',t:m('small')});ddMath(p,'1.2 ÷ 0.2 = 6',412,640,m('small'),56);ddText(p,'six small groups',412,730,m('small'),32,COL.dim,'middle');const g=G(p,{x:900,y:330,o:0});g.dataset.groupSize='2';g.dataset.amount='1.2';show(g,m('large'));mk('rect',{width:540,height:130,fill:'none',stroke:COL.whole,'stroke-width':3},g);mk('rect',{width:324,height:130,fill:COL.whole,'fill-opacity':.38,stroke:COL.task,'stroke-width':2},g);for(let i=1;i<10;i++)path(g,`M${i*54} 0V130`,{stroke:COL.faint,'stroke-width':1});ddText(g,'one whole group = 2',270,-45,m('large'),34,COL.chalk,'middle');ddText(g,'1.2 fills 6/10 of the group',270,180,m('large'),32,COL.task,'middle');ddMath(p,'1.2 ÷ 2 = 0.6',1170,640,m('large'),56);ddText(p,'six tenths of one larger group',1170,730,m('large'),32,COL.dim,'middle');}],['unequal','Unequal decimal lengths are fine',m=>{const p=panel(0);ddTitle(p,'0.063 ÷ 0.15');ddMath(p,'0.063 ÷ 0.15',800,300,.2,65);ddText(p,'×100 to both numbers',800,425,m('scale'),36,COL.task,'middle');ddMath(p,'6.3 ÷ 15 = 0.42',800,560,m('answer'),61);ddMath(p,'15 × 0.42 = 6.3',800,740,m('check'),57,COL.task);ddText(p,'Only the divisor’s two fractional places determine the shift.',800,815,m('scale',2),29,COL.dim,'middle');}],['rate','How many liters per minute?',m=>{const p=panel(0);ddTitle(p,'A pump transfers 9.6 liters in 2.5 minutes.','Find the average rate.');ddText(p,'total liters ÷ total minutes',800,295,m('divide'),39,COL.dim,'middle');ddMath(p,'9.6 ÷ 2.5 = 96 ÷ 25',800,435,m('divide'),57);ddText(p,'3.84 liters per minute',800,580,m('answer'),49,COL.task,'middle');ddMath(p,'3.84 × 2.5 = 9.6',800,735,m('check'),57);ddText(p,'liters/minute × minutes = liters',800,815,m('check',2),29,COL.dim,'middle');}],['wrap','Four reliable habits',m=>{const p=panel(0);[['Name the terms. Keep the divisor nonzero.','w1'],['Multiply BOTH numbers by the same power of ten.','w2'],['Align points. Exchange remainders; append zeros.','w3'],['Multiply to check the quotient and its units.','w4']].forEach(([s,k],i)=>{const g=G(p,{x:-16,y:235+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-basic',prompt:'Divide exactly. Equivalent trailing zeros are accepted.',build:blanks([-{parts:['6.3 ÷ 0.9 = ',{box:'7'}],why:'Multiply both by 10: 63÷9=7.'},-{parts:['8.64 ÷ 1.2 = ',{box:'7.2'}],why:'Multiply both by 10: 86.4÷12=7.2. Check 7.2×1.2=8.64.'},-{parts:['0.045 ÷ 0.15 = ',{box:'0.3'}],why:'Multiply both by 100: 4.5÷15=0.3.'},-{parts:['0.0084 ÷ 0.07 = ',{box:'0.12'}],why:'Multiply both by 100: 0.84÷7=0.12. The dividend may stay decimal.'}-])}],done,'Chapter practice 1 of 3')}],+{parts:['6.3 ÷ 0.9 = ',{box:'7'}],why:'Multiply both by 10: 63 ÷ 9 = 7.'},+{parts:['8.64 ÷ 1.2 = ',{box:'7.2'}],why:'Multiply both by 10: 86.4 ÷ 12 = 7.2. Check: 7.2 × 1.2 = 8.64.'},+{parts:['0.045 ÷ 0.15 = ',{box:'0.3'}],why:'Multiply both by 100: 4.5 ÷ 15 = 0.3.'},+{parts:['0.0084 ÷ 0.07 = ',{box:'0.12'}],why:'Multiply both by 100: 0.84 ÷ 7 = 0.12. The dividend may stay a decimal.'}+])}],done,'Chapter practice · set 1 of 3')}],['final2','Chapter practice',()=>panel(0),{ask:done=>quiz(SCREEN,[{id:'p-precision',prompt:'Use the divisor to choose the shift. Do not round.',build:blanks([-{parts:['0.18 ÷ 0.8 = ',{box:'0.225'}],why:'1.8÷8=0.225. Append zeros to continue exactly;0.225×0.8=0.18.'},-{parts:['2.16 ÷ 3.6 = ',{box:'0.6'}],why:'21.6÷36=0.6. The dividend is smaller than the divisor, so the quotient is below 1.'},-{parts:['1.755 ÷ 0.03 = ',{box:'58.5'}],why:'175.5÷3=58.5. The divisor needs two shifts; both numbers get×100.'},-{parts:['7.2 ÷ 0.025 = ',{box:'288'}],why:'7200÷25= 288. Both numbers get×1000;288×0.025=7.2.'}-])}],done,'Chapter practice 2 of 3')}],+{parts:['0.18 ÷ 0.8 = ',{box:'0.225'}],why:'1.8 ÷ 8 = 0.225. Append zeros to keep dividing exactly; 0.225 × 0.8 = 0.18.'},+{parts:['2.16 ÷ 3.6 = ',{box:'0.6'}],why:'21.6 ÷ 36 = 0.6. The dividend is smaller than the divisor, so the quotient is below 1.'},+{parts:['1.755 ÷ 0.03 = ',{box:'58.5'}],why:'175.5 ÷ 3 = 58.5. The divisor needs two shifts; both numbers get × 100.'},+{parts:['7.2 ÷ 0.025 = ',{box:'288'}],why:'7200 ÷ 25 = 288. Both numbers get × 1000; 288 × 0.025 = 7.2.'}+])}],done,'Chapter practice · set 2 of 3')}],['final3','Chapter practice',()=>panel(0),{ask:done=>quiz(SCREEN,[-{id:'p-speed',prompt:'A cyclist travels 14.4 kilometers in 1.8 hours. Find the average speed.',build:blanks([{parts:[{box:'8'},' kilometers per hour'],why:'14.4÷1.8=144÷18=8 kilometers per hour.'}])},-{id:'p-pump',prompt:'A pump transfers 6.3 liters in 2.4 minutes. Find its average rate.',build:blanks([{parts:[{box:'2.625'},' liters per minute'],why:'6.3÷2.4=63÷24= 2.625 liters per minute. The quotient is exact.'}])},-{id:'p-packets',prompt:'There are 0.84 kilogram of seeds. Each packet holds 0.07 kilogram. How many complete packets can be filled?',build:blanks([{parts:[{box:'12'},' packets'],why:'0.84÷0.07=84÷7=12 complete packets.'}])},-{id:'p-rope',prompt:'A 3.6 meter rope is cut into 5 equal pieces. Find the length of each piece.',build:blanks([{parts:[{box:'0.72'},' meter per piece'],why:'3.6÷5=0.72. Appending a zero gives 3.60;0.72×5= 3.6.'}])}-],done,'Chapter practice 3 of 3')}],+{id:'p-speed',prompt:'A cyclist travels 14.4 kilometers in 1.8 hours. Find the average speed.',build:blanks([{parts:[{box:'8'},' kilometers per hour'],why:'14.4 ÷ 1.8 = 144 ÷ 18 = 8 kilometers per hour.'}])},+{id:'p-pump',prompt:'A pump transfers 6.3 liters in 2.4 minutes. Find its average rate.',build:blanks([{parts:[{box:'2.625'},' liters per minute'],why:'6.3 ÷ 2.4 = 63 ÷ 24 = 2.625 liters per minute. The quotient is exact.'}])},+{id:'p-packets',prompt:'There are 0.84 kilogram of seeds. Each packet holds 0.07 kilogram. How many complete packets can be filled?',build:blanks([{parts:[{box:'12'},' packets'],why:'0.84 ÷ 0.07 = 84 ÷ 7 = 12 complete packets.'}])},+{id:'p-rope',prompt:'A 3.6 meter rope is cut into 5 equal pieces. Find the length of each piece.',build:blanks([{parts:[{box:'0.72'},' meter per piece'],why:'3.6 ÷ 5 = 0.72. Appending a zero gives 3.60; 0.72 × 5 = 3.6.'}])}+],done,'Chapter practice · set 3 of 3')}],['finish','Finished',()=>panel(0),{ask:finishCard}]].map(([id,title,run,extra])=>({id,title,run,...extra}));boot();diff --git a/site/math-notebook/ch11/index.html b/site/math-notebook/ch11/index.htmlindex 1f947fd..bed7d31 100644--- a/site/math-notebook/ch11/index.html+++ b/site/math-notebook/ch11/index.html@@ -8,48 +8,49 @@ const saSigned=v=>v>0?'+'+v:num(v);const saText=(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 saMath=(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;};const saTitle=(p,s,sub='')=>{saText(p,s,100,110,.1,43);if(sub)saText(p,sub,100,162,.15,27,COL.dim);};-function saEq(p,a,b,c,t=0,y=750,xEq=800,size=60){const row=tokens(p,[{t:num(a),fill:saColor(a)},' + ',{t:b<0?'('+num(b)+')':num(b),fill:saColor(b)}],{x:xEq-size*.5,y,size,anchor:'end'});row.push(saMath(p,'=',xEq,y,t,size),saMath(p,num(c),xEq+size*.65,y,t,size,saColor(c),'start'));row.slice(0,3).forEach(e=>{put(e,{o:0});show(e,t)});return row;}+function saEq(p,a,b,c,t=0,y=750,xEq=800,size=60){const row=tokens(p,[{t:num(a),fill:saColor(a)},' + ',{t:b<0?'('+num(b)+')':num(b),fill:saColor(b)}],{x:xEq-size*.65,y,size,anchor:'end'});row.push(saMath(p,'=',xEq,y,t,size),saMath(p,num(c),xEq+size*.65,y,t,size,saColor(c),'start'));row.slice(0,3).forEach(e=>{put(e,{o:0});show(e,t)});return row;}function saLine(p,lo=-8,hi=8,u=76,o=800){const y=560;const g=G(p);g.dataset.lineLo=lo;g.dataset.lineHi=hi;g.dataset.unit=u;g.dataset.origin=o;path(g,`M${o+(lo-.55)*u} ${y}H${o+(hi+.55)*u}`,{stroke:COL.chalk,'stroke-width':3});for(const [v,d] of [[lo-.55,-1],[hi+.55,1]])path(g,`M${o+v*u-12*d} ${y-9}L${o+v*u} ${y}L${o+v*u-12*d} ${y+9}`,{stroke:COL.chalk,'stroke-width':3});for(let v=lo;v<=hi;v++){path(g,`M${o+v*u} ${y-9}V${y+9}`,{stroke:COL.dim,'stroke-width':2});T(g,num(v),{x:o+v*u,y:y+45,size:28,font:MATH,anchor:'middle',fill:v===0?COL.chalk:COL.dim});}const dot=G(g,{x:o,y});const circle=mk('circle',{r:11,fill:COL.chalk,stroke:COL.board,'stroke-width':2},dot);return {g,y,u,o,dot,circle,x:v=>o+u*v};}function saMove(l,a,b,y,t){const c=saColor(b-a),dur=1.4,x1=l.x(a),x2=l.x(b),d=Math.sign(b-a),g=G(l.g);g.dataset.moveFrom=a;g.dataset.moveTo=b;g.dataset.startX=x1;g.dataset.endX=x2;const ln=path(g,`M${x1} ${y}H${x2}`,{stroke:c,'stroke-width':5},{d:0});draw(ln,t,dur);const h=path(g,`M${x2-14*d} ${y-10}L${x2} ${y}L${x2-14*d} ${y+10}`,{stroke:c,'stroke-width':5},{o:0});show(h,t+dur-.12,.15);saText(g,saSigned(b-a),(x1+x2)/2,y-22,t+.1,35,c,'middle');const drop=path(g,`M${x2} ${y+12}V${l.y-15}`,{stroke:c,'stroke-width':2,'stroke-dasharray':'5 5'},{o:0});show(drop,t+dur,.2);tw(l.dot,{x:x2},t,dur,lin);tw(l.circle,{c_fill:saColor(b)},t,dur,lin);return g;}-function saTile(p,sign,id,x,y,t=0){const e=tile(p,sign,x,y);e.dataset.tileId=id;e.dataset.value=sign;tw(e,{o:1,s:1},t,.35,back);return e;}-function saCancel(p,a,b,tPair,tCancel){const n=Math.min(a.length,b.length);a.slice(0,n).forEach((e,i)=>{const f=b[i],x=st(e).x,y=st(e).y;tw(f,{x,y:y+75},tPair+i*.1,.6);const ring=G(p,{x,y:y+37.5,o:0});ring.dataset.zeroPair=e.dataset.tileId+','+f.dataset.tileId;mk('rect',{x:-37,y:-68,width:74,height:136,rx:16,fill:'none',stroke:COL.chalk,'stroke-width':2,'stroke-dasharray':'6 5'},ring);show(ring,tPair+.65+i*.1);[e,f,ring].forEach(k=>hide(k,tCancel+i*.12,.5));});return n;}-function saModel(p,a,b,m,{first=0,second=.15}={}){const g=G(p);g.dataset.addends=a+','+b;g.dataset.sum=a+b;const xs=i=>330+i*92;const A=Array.from({length:Math.abs(a)},(_,i)=>saTile(g,Math.sign(a),'a'+i,xs(i),320,first+i*.05));const B=Array.from({length:Math.abs(b)},(_,i)=>saTile(g,Math.sign(b),'b'+i,xs(i),490,second+i*.05));saText(g,'Input: '+saSigned(a),1120,325,first,36,saColor(a));saText(g,'Input: '+saSigned(b),1120,495,second,36,saColor(b));let n=0;if(a*b<0){n=saCancel(g,A,B,m('pair'),m('cancel'));g.dataset.pairs=n;const rem=[...A.slice(n),...B.slice(n)];rem.forEach((e,i)=>tw(e,{x:800+(i-(rem.length-1)/2)*92,y:385},m('left'),.7));saText(g,n+' zero pairs removed · total value unchanged',800,640,m('cancel'),30,COL.dim,'middle');}return {g,A,B,n};}-function saTape(p,a,b,tPair=99,tLeft=99){const g=G(p),scale=4,x=400,y=310,n=Math.min(Math.abs(a),Math.abs(b));g.dataset.tapeAddends=a+','+b;g.dataset.scale=scale;for(const [v,yy] of [[a,y],[b,y+145]]){saText(g,saSigned(v),x-85,yy+36,0,39,saColor(v),'middle');const pair=G(g,{x,y:yy});pair.dataset.matchedValue=Math.sign(v)*n;mk('rect',{width:n*scale,height:58,fill:saColor(v),'fill-opacity':.25,stroke:saColor(v),'stroke-width':2},pair);hide(pair,tPair,.7);if(Math.abs(v)>n){const rem=G(g,{x:x+n*scale,y:yy});rem.dataset.remainingValue=Math.sign(v)*(Math.abs(v)-n);mk('rect',{width:(Math.abs(v)-n)*scale,height:58,fill:saColor(v),'fill-opacity':.5,stroke:saColor(v),'stroke-width':3},rem);tw(rem,{x:650,y:410},tLeft,.8);saText(g,'leftover: '+saSigned(a+b),800,570,tLeft,42,saColor(a+b),'middle');}}-saText(g,'Exact scale: 4 pixels per unit of magnitude',800,660,0,27,COL.dim,'middle');return g;}+function saTile(p,sign,id,x,y,t=0,k=1){const e=tile(p,sign,x,y);e.dataset.tileId=id;e.dataset.value=sign;tw(e,{o:1,s:k},t,.35,back);return e;}+function saCancel(p,a,b,tPair,tCancel,{k=1,dim=false}={}){const n=Math.min(a.length,b.length),dy=75*k;a.slice(0,n).forEach((e,i)=>{const f=b[i],x=st(e).x,y=st(e).y;tw(f,{x,y:y+dy},tPair+i*.1,.6);const ring=G(p,{x,y:y+dy/2,o:0});ring.dataset.zeroPair=e.dataset.tileId+','+f.dataset.tileId;mk('rect',{x:-37*k,y:-68*k,width:74*k,height:136*k,rx:16,fill:'none',stroke:COL.chalk,'stroke-width':2,'stroke-dasharray':'6 5'},ring);show(ring,tPair+.65+i*.1);(dim?[e,f]:[e,f,ring]).forEach(q=>tw(q,{o:dim?.3:0},tCancel+i*.12,.5));});return n;}+function saModel(p,a,b,m,{first=0,second=.15}={}){const g=G(p);g.dataset.addends=a+','+b;g.dataset.sum=a+b;const k=1.2,sp=110,x0=800-(Math.max(Math.abs(a),Math.abs(b))-1)*sp/2-60,xs=i=>x0+i*sp;const A=Array.from({length:Math.abs(a)},(_,i)=>saTile(g,Math.sign(a),'a'+i,xs(i),320,first+i*.05,k));const B=Array.from({length:Math.abs(b)},(_,i)=>saTile(g,Math.sign(b),'b'+i,xs(i),490,second+i*.05,k));for(const [v,y,t] of [[a,320,first],[b,490,second]])hide(saText(g,saSigned(v),xs(Math.abs(v)-1)+sp/2+30,y+15,t,46,saColor(v)),m('cancel'),.4);let n=0;if(a*b<0){n=saCancel(g,A,B,m('pair'),m('cancel'),{k});g.dataset.pairs=n;const rem=[...A.slice(n),...B.slice(n)];rem.forEach((e,i)=>tw(e,{x:800+(i-(rem.length-1)/2)*130,y:400,s:1.6},m('left'),.7));saText(g,n+' zero pairs removed · total value unchanged',800,640,m('cancel'),30,COL.dim,'middle');}return {g,A,B,n};}+function saTape(p,a,b,{scale=4,unit='',tB=0,tPair=99,tLeft=99}={}){const g=G(p),x=400,y=300,gap=120,h=58,n=Math.min(Math.abs(a),Math.abs(b)),lab=v=>(v<0?'−':'+')+unit+Math.abs(v);g.dataset.tapeAddends=a+','+b;g.dataset.scale=scale;let other=y;for(const [v,yy,t0] of [[a,y,0],[b,y+gap,tB]]){const row=G(g,{o:t0?0:1});if(t0)show(row,t0);saText(row,lab(v),x-30,yy+42,0,40,saColor(v),'end');const pair=G(row,{x,y:yy});pair.dataset.matchedValue=Math.sign(v)*n;mk('rect',{width:n*scale,height:h,fill:saColor(v),'fill-opacity':.25},pair);tw(pair,{o:.3},tLeft,.6);if(Math.abs(v)>n){const rem=G(row,{x:x+n*scale,y:yy});rem.dataset.remainingValue=Math.sign(v)*(Math.abs(v)-n);mk('rect',{width:(Math.abs(v)-n)*scale,height:h,fill:saColor(v),'fill-opacity':.25},rem);const hl=G(row,{x:x+n*scale,y:yy,o:0});mk('rect',{width:(Math.abs(v)-n)*scale,height:h,fill:saColor(v),'fill-opacity':.35,stroke:saColor(v),'stroke-width':3},hl);show(hl,tPair);}else other=yy;mk('rect',{x,y:yy,width:Math.abs(v)*scale,height:h,fill:'none',stroke:saColor(v),'stroke-width':2},row);}+const ring=G(g,{o:0});ring.dataset.zeroPair=n;mk('rect',{x:x-12,y:y-12,width:n*scale+24,height:gap+h+24,rx:16,fill:'none',stroke:COL.chalk,'stroke-width':2.5,'stroke-dasharray':'8 6'},ring);T(ring,n+' cancels '+n,{x:x+n*scale/2,y:y+gap+h+62,size:36,anchor:'middle'});show(ring,tPair);+saText(g,lab(a+b)+' left over',x+n*scale+36,other+42,tLeft,40,saColor(a+b));return g;}// Reuse chapter 2's signed-answer normalization, leaving exact grading to the engine.const saBlanks=rows=>(body,api)=>{const ctl=blanks(rows)(body,api),check=ctl.check;ctl.check=()=>{body.querySelectorAll('input.box').forEach(b=>{b.value=b.value.replace(/^\s*\+\s*/,'').replace(/(\d),(?=\d{3}\b)/g,'$1');});check();};return ctl;};const BEATS=[['intro','Combine signed changes',(m,D)=>{const g=G(scene,{o:0,y:24});T(g,'Unit 1 · The Number System · Chapter 11',{x:800,y:235,size:28,fill:COL.dim,anchor:'middle'});T(g,'Adding Positive',{x:800,y:345,size:72,weight:600,anchor:'middle'});T(g,'and Negative Numbers',{x:800,y:440,size:72,weight:600,anchor:'middle'});tw(g,{o:1,y:0},.2,1,out);saTile(g,1,'intro-plus',730,570,.4);saTile(g,-1,'intro-minus',870,570,.5);saText(g,'Directions · zero pairs · magnitudes',800,705,m('sub'),34,COL.dim,'middle');hide(g,D-.8,.7);}],['direction','A sign gives a direction',m=>{const p=panel(0);saTitle(p,'3 + (−4)','Begin at zero. Each new move starts at the current position.');S.saLine=saLine(p);saMove(S.saLine,0,3,325,m('positive'));saMove(S.saLine,3,-1,440,m('negative'));saEq(p,3,-4,-1,m('result'));}],-['lineMixed','Opposing moves',m=>{const p=panel(0);saTitle(p,'−6 + 4');S.saLine=saLine(p);saMove(S.saLine,0,-6,325,m('first'));saMove(S.saLine,-6,-2,440,m('second'));saEq(p,-6,4,-2,m('result'));}],+['lineMixed','Opposing moves',m=>{const p=panel(0);saTitle(p,'−6 + 4');S.saLine=saLine(p);saMove(S.saLine,0,-6,325,m('first'));saMove(S.saLine,-6,-2,440,m('second'));[6.25,7.51,8.75,10.2].forEach((dt,i)=>{const r=mk('circle',{cx:S.saLine.x(-5+i),cy:S.saLine.y,r:17,fill:'none',stroke:POS,'stroke-width':4},S.saLine.g);put(r,{o:0});show(r,m('second',dt),.2);});saEq(p,-6,4,-2,m('result'));}],['lineSame','Two leftward changes',m=>{const p=panel(0);saTitle(p,'−2 + (−3)');S.saLine=saLine(p);saMove(S.saLine,0,-2,325,m('first'));saMove(S.saLine,-2,-5,440,m('second'));saEq(p,-2,-3,-5,m('result'));saText(p,'Magnitude: 2 + 3 = 5',800,825,m('result'),31,COL.task,'middle');}],['q1','Quick check',()=>{const p=panel(0);saTitle(p,'−5 + 2','The first move is shown. Where does the second move end?');const l=saLine(p);saMove(l,0,-5,330,0);S.saPoints=[-7,-3,3].map(v=>{const g=G(p,{x:l.x(v),y:l.y});mk('circle',{r:17,fill:COL.board,stroke:COL.task,'stroke-width':3},g);return {el:g,box:[l.x(v)-34,l.y-35,68,70],label:num(v)};});},{ask:done=>quiz(BAND,[{id:'c-endpoint',prompt:'Choose the endpoint after a move of +2.',build:pickEls(S.saPoints,1,'From −5, move two units RIGHT: −4, then −3.',i=>i===0?'−7 is two units left. A positive addend moves right.':'Start the +2 move at −5, not at zero.',()=>pulseFx(S.saPoints[1].el,1.25))}],done)}],-['tileUnit','Tiles have signed values',m=>{const p=panel(0);saTitle(p,'One tile = one signed unit');for(let i=0;i<3;i++)saTile(p,1,'unit-p'+i,420+i*92,335,i===0?0:m('positive')+i*.08);for(let i=0;i<2;i++)saTile(p,-1,'unit-n'+i,420+i*92,490,m('negative')+i*.08);saText(p,'3 × (+1) = +3',1050,350,m('positive'),43,POS,'middle');saText(p,'2 × (−1) = −2',1050,505,m('negative'),43,NEG,'middle');saEq(p,3,-2,1,m('total'));}],-['tilePair','A zero pair preserves value',m=>{const p=panel(0);saTitle(p,'+1 and −1 make a ZERO pair');const a=saTile(p,1,'pair-positive',610,330),b=saTile(p,-1,'pair-negative',990,510);saCancel(p,[a],[b],m('pair'),m('cancel'));saEq(p,1,-1,0,m('zero'),330,1120,46);saText(p,'Remove a value of 0',800,645,m('cancel'),42,COL.chalk,'middle');saText(p,'The total value stays the same.',800,745,m('cancel',1),35,COL.dim,'middle');}],+['tileUnit','Tiles have signed values',m=>{const p=panel(0);saTitle(p,'One tile = one signed unit');for(let i=0;i<3;i++)saTile(p,1,'unit-p'+i,420+i*92,335,i===0?0:m('positive')+i*.08);for(let i=0;i<2;i++)saTile(p,-1,'unit-n'+i,420+i*92,490,m('negative')+i*.08);saText(p,'(+1) + (+1) + (+1) = +3',1080,350,m('positive',3),43,POS,'middle');saText(p,'(−1) + (−1) = −2',1080,505,m('negative',3.2),43,NEG,'middle');saEq(p,3,-2,1,m('total'));}],+['tilePair','A zero pair preserves value',m=>{const p=panel(0);saTitle(p,'+1 and −1 make a ZERO pair');const a=saTile(p,1,'pair-positive',800,310,0,1.3),b=saTile(p,-1,'pair-negative',1150,480,0,1.3);saCancel(p,[a],[b],m('pair'),m('cancel'),{k:1.3,dim:true});saEq(p,1,-1,0,m('zero'),580,830,56);saText(p,'This pair is worth 0',800,680,m('cancel'),42,COL.chalk,'middle');saText(p,'The total value stays the same.',800,765,m('cancel',1),35,COL.dim,'middle');}],['tileMixed','Remove three zero pairs',m=>{const p=panel(0);saTitle(p,'−5 + 3','Every pair uses one original positive tile and one original negative tile.');S.saTiles=saModel(p,-5,3,m);saEq(p,-5,3,-2,m('left'));}],['q2','Quick check',()=>{const p=panel(0);saTitle(p,'−5 + 3','Choose the leftover tiles after removing every zero pair.');for(let i=0;i<5;i++)saTile(p,-1,'q2n'+i,515+i*75,255);for(let i=0;i<3;i++)saTile(p,1,'q2p'+i,515+i*75,350);S.saOptions=[[-1,2],[1,2],[-1,8]].map(([sign,n],j)=>{const g=G(p,{x:315+j*490,y:515});g.dataset.optionValue=sign*n;for(let i=0;i<n;i++)saTile(g,sign,'option'+j+'-'+i,(i%4-(Math.min(n,4)-1)/2)*67,Math.floor(i/4)*65,0);saText(g,String.fromCharCode(65+j),0,-70,0,30,COL.dim,'middle');return {el:g,box:[135+j*490,420,360,200],label:n+' '+(sign>0?'positive':'negative')+' tiles'};});},{ask:done=>quiz(BAND,[{id:'c-tiles',prompt:'Which original signed value remains?',build:pickEls(S.saOptions,0,'Three zero pairs remove three negatives and three positives. Two negative tiles remain.',i=>i===1?'The negative group has the larger magnitude, so the leftover tiles must be negative.':'Counting eight objects ignores their signed values. Three positive-negative pairs have value zero.',()=>pulseFx(S.saOptions[0].el,1.08))}],done)}],-['sameSigns','Same signs: add magnitudes',m=>{const p=panel(0);saTitle(p,'−2 + (−4)','No opposite tiles means no zero pairs.');const g=G(p);const A=Array.from({length:2},(_,i)=>saTile(g,-1,'same-a'+i,400+i*92,335)),B=Array.from({length:4},(_,i)=>saTile(g,-1,'same-b'+i,860+i*92,335));[...A,...B].forEach((e,i)=>tw(e,{x:570+i*92,y:400},m('join'),.8));saMath(p,'|−2| + |−4| = 2 + 4 = 6',800,570,m('magnitude'),48,COL.task);saEq(p,-2,-4,-6,m('result'),685);saEq(p,3,5,8,m('positive'),815);}],+['sameSigns','Same signs: add magnitudes',m=>{const p=panel(0);saTitle(p,'−2 + (−4)','No opposite tiles means no zero pairs.');const g=G(p);const A=Array.from({length:2},(_,i)=>saTile(g,-1,'same-a'+i,400+i*92,280)),B=Array.from({length:4},(_,i)=>saTile(g,-1,'same-b'+i,860+i*92,280));[...A,...B].forEach((e,i)=>tw(e,{x:570+i*92},m('join'),.8));saMath(p,'|−2| + |−4| = 2 + 4 = 6',800,410,m('magnitude'),46,COL.task);saEq(p,-2,-4,-6,m('result'),505,800,54);for(let i=0;i<8;i++)saTile(g,1,'same-p'+i,480+i*80+(i>2?40:0),640,m('positive',i>2?3.8:3.4)+(i%5)*.06);saEq(p,3,5,8,m('positive',4.5),775,800,54);}],['differentSigns','Different signs: count leftovers',m=>{const p=panel(0);saTitle(p,'−3 + 7');S.saTiles=saModel(p,-3,7,m);saEq(p,-3,7,4,m('left'),745);saText(p,'7 − 3 = 4 · larger magnitude is POSITIVE',800,830,m('rule'),31,COL.task,'middle');}],['opposites','Equal opposites give zero',m=>{const p=panel(0);saTitle(p,'4 + (−4)');const g=G(p);const A=Array.from({length:4},(_,i)=>saTile(g,1,'opp-p'+i,480+i*92,280)),B=Array.from({length:4},(_,i)=>saTile(g,-1,'opp-n'+i,480+i*92,450));saCancel(g,A,B,m('pair'),m('cancel'));hide(g,m('line'),.5);const l=saLine(p);put(l.g,{o:0});show(l.g,m('line'));saMove(l,0,4,340,m('line'));saMove(l,4,0,445,m('line',2));saEq(p,4,-4,0,m('cancel'));}],-['large','Magnitudes work for large numbers',m=>{const p=panel(0);saTitle(p,'−140 + 90');S.saTape=saTape(p,-140,90,m('pair'),m('left'));saMath(p,'|−140| = 140 |90| = 90',800,230,m('absolute'),42,COL.task);saEq(p,-140,90,-50,m('result'),790);}],-['q3','Quick check',()=>{const p=panel(0);saTitle(p,'−45 + 120','Compare magnitudes. Choose the signed LEFTOVER tape.');const x=500,sc=4;for(const [v,y] of [[-45,265],[120,370]]){mk('rect',{x,y,width:Math.abs(v)*sc,height:45,fill:saColor(v),'fill-opacity':.35,stroke:saColor(v),'stroke-width':2},p);saText(p,saSigned(v),x-80,y+35,0,36,saColor(v),'middle');}saText(p,'Input tapes: 4 pixels per magnitude unit',800,465,0,26,COL.dim,'middle');S.saTapeOptions=[-75,75,165].map((v,j)=>{const g=G(p,{x:200+j*480,y:550});g.dataset.optionValue=v;g.dataset.scale=1.5;mk('rect',{width:Math.abs(v)*1.5,height:48,fill:saColor(v),'fill-opacity':.45,stroke:saColor(v),'stroke-width':3},g);saText(g,String.fromCharCode(65+j)+' · '+saSigned(v),120,-24,0,34,saColor(v),'middle');return {el:g,box:[150+j*480,490,365,130],label:saSigned(v)};});saText(p,'Answer tapes: 1.5 pixels per magnitude unit',800,642,0,24,COL.dim,'middle');},{ask:done=>quiz(BAND,[{id:'c-magnitude',prompt:'Which answer tape has the correct magnitude AND sign?',build:pickEls(S.saTapeOptions,1,'120−45=75. The positive addend has larger magnitude, so +75 remains.',i=>i===0?'75 is the correct magnitude, but 120 is positive and larger in magnitude than −45.':'Opposite signs cancel. Subtract the smaller magnitude from the larger; do not add 120 and 45.',()=>pulseFx(S.saTapeOptions[1].el,1.08))}],done)}],+['large','Magnitudes work for large numbers',m=>{const p=panel(0);saTitle(p,'−140 + 90');S.saTape=saTape(p,-140,90,{scale:6,tPair:m('pair'),tLeft:m('left')});saMath(p,'|−140| = 140 |90| = 90',800,230,m('absolute'),42,COL.task);saEq(p,-140,90,-50,m('result'),720,800,64);}],+['q3','Quick check',()=>{const p=panel(0);saTitle(p,'−45 + 120','Compare magnitudes. Choose the signed LEFTOVER tape.');const x=500,sc=2.5;for(const [v,y] of [[-45,265],[120,370]]){mk('rect',{x,y,width:Math.abs(v)*sc,height:45,fill:saColor(v),'fill-opacity':.35,stroke:saColor(v),'stroke-width':2},p);saText(p,saSigned(v),x-80,y+35,0,36,saColor(v),'middle');}S.saTapeOptions=[-75,75,165].map((v,j)=>{const g=G(p,{x:130+j*480,y:550});g.dataset.optionValue=v;g.dataset.scale=sc;mk('rect',{width:Math.abs(v)*sc,height:48,fill:saColor(v),'fill-opacity':.45,stroke:saColor(v),'stroke-width':3},g);saText(g,String.fromCharCode(65+j)+' · '+saSigned(v),120,-24,0,34,saColor(v),'middle');return {el:g,box:[100+j*480,490,460,130],label:saSigned(v)};});},{ask:done=>quiz(BAND,[{id:'c-magnitude',prompt:'Which answer tape has the correct magnitude AND sign?',build:pickEls(S.saTapeOptions,1,'120−45=75. The positive addend has larger magnitude, so +75 remains.',i=>i===0?'75 is the correct magnitude, but 120 is positive and larger in magnitude than −45.':'Opposite signs cancel. Subtract the smaller magnitude from the larger; do not add 120 and 45.',()=>pulseFx(S.saTapeOptions[1].el,1.08))}],done)}],['zero','Zero changes nothing',m=>{const p=panel(0);saTitle(p,'Adding zero');for(let i=0;i<7;i++)saTile(p,-1,'zero-n'+i,505+i*92,310);saEq(p,-7,0,-7,m('zero'),475);for(let i=0;i<5;i++)saTile(p,1,'zero-p'+i,600+i*92,615,m('other'));saEq(p,0,5,5,m('other'),730);saText(p,'a + 0 = a',800,835,m('rule'),42,COL.chalk,'middle');}],-['three','Carry the signed partial sum',m=>{const p=panel(0);saTitle(p,'−4 + 7 + (−2)','Two stages. The surviving positive tiles keep their identities.');const g=G(p);const A=Array.from({length:4},(_,i)=>saTile(g,-1,'three-a'+i,360+i*82,290)),B=Array.from({length:7},(_,i)=>saTile(g,1,'three-b'+i,360+i*82,490));saCancel(g,A,B,m('pair'),m('first')-.7);const survivors=B.slice(4);survivors.forEach((e,i)=>tw(e,{x:700+i*92,y:340},m('first'),.7));saEq(p,-4,7,3,m('first'),330,1270,35);const C=Array.from({length:2},(_,i)=>saTile(g,-1,'three-c'+i,700+i*92,490,m('next')));survivors.slice(0,2).forEach((e,i)=>{const f=C[i],x=700+i*92;tw(f,{x,y:415},m('next',1),.6);const ring=G(g,{x,y:377.5,o:0});ring.dataset.zeroPair=e.dataset.tileId+','+f.dataset.tileId;mk('rect',{x:-37,y:-68,width:74,height:136,rx:16,fill:'none',stroke:COL.chalk,'stroke-width':2,'stroke-dasharray':'6 5'},ring);show(ring,m('next',1.7));[e,f,ring].forEach(k=>hide(k,m('result')-.6,.5));});saEq(p,3,-2,1,m('result'),520,1270,35);tokens(p,[{t:'−4',fill:NEG},' + ',{t:'7',fill:POS},' + ',{t:'(−2)',fill:NEG},' = ',{t:'1',fill:POS}],{x:800,y:755,size:57,anchor:'middle',o:0}).forEach(e=>show(e,m('result')));S.saThree={A,B,C,survivors};}],+['three','Carry the signed partial sum',m=>{const p=panel(0);saTitle(p,'−4 + 7 + (−2)','First add −4 and 7, then add −2.');const g=G(p);const A=Array.from({length:4},(_,i)=>saTile(g,-1,'three-a'+i,360+i*82,290)),B=Array.from({length:7},(_,i)=>saTile(g,1,'three-b'+i,360+i*82,490));saCancel(g,A,B,m('pair'),m('first')-.7);const survivors=B.slice(4);survivors.forEach((e,i)=>tw(e,{x:540+i*92,y:340},m('first'),.7));saEq(p,-4,7,3,m('first'),355,1010,46);const C=Array.from({length:2},(_,i)=>saTile(g,-1,'three-c'+i,540+i*92,490,m('next')));survivors.slice(0,2).forEach((e,i)=>{const f=C[i],x=540+i*92;tw(f,{x,y:415},m('next',1),.6);const ring=G(g,{x,y:377.5,o:0});ring.dataset.zeroPair=e.dataset.tileId+','+f.dataset.tileId;mk('rect',{x:-37,y:-68,width:74,height:136,rx:16,fill:'none',stroke:COL.chalk,'stroke-width':2,'stroke-dasharray':'6 5'},ring);show(ring,m('next',1.7));[e,f,ring].forEach(k=>hide(k,m('result')-.6,.5));});saEq(p,3,-2,1,m('result'),520,1010,46);tokens(p,[{t:'−4',fill:NEG},' + ',{t:'7',fill:POS},' + ',{t:'(−2)',fill:NEG},' = ',{t:'1',fill:POS}],{x:800,y:755,size:57,anchor:'middle',o:0}).forEach(e=>show(e,m('result')));S.saThree={A,B,C,survivors};}],['temperature','A starting value and a change',m=>{const p=panel(0);saTitle(p,'−7°C, then a rise of 12°C','Find the final temperature.');const l=saLine(p,-10,10,62);saMove(l,0,-7,325,m('start'));saMove(l,-7,5,440,m('rise'));saEq(p,-7,12,5,m('result'));saText(p,'Final temperature: 5°C',800,825,m('result'),34,POS,'middle');}],-['balance','Balance versus amount owed',m=>{const p=panel(0);saTitle(p,'Signed balance −$32 · payment +$21','A negative balance means money is owed.');saTape(p,-32,21,m('payment'),m('balance'));saText(p,'Signed balance: −$11',800,745,m('balance'),44,NEG,'middle');saText(p,'Amount still owed: $11',800,830,m('owed'),44,COL.chalk,'middle');}],+['balance','Balance versus amount owed',m=>{const p=panel(0);saTitle(p,'Signed balance −$32 · payment +$21','A negative balance means money is owed.');saTape(p,-32,21,{scale:20,unit:'$',tB:m('payment'),tPair:m('payment',4.1),tLeft:m('balance')});saText(p,'Signed balance: −$11',800,745,m('balance'),44,NEG,'middle');saText(p,'Amount still owed: $11',800,830,m('owed'),44,COL.chalk,'middle');}],['wrap','Four reliable ideas',m=>{const p=panel(0);[['Move from the CURRENT position: + right, − left.','w1'],['Zero pairs cancel while preserving the total value.','w2'],['Same signs: add magnitudes; keep the shared sign.','w3'],['Different signs: subtract magnitudes; use the larger’s sign.','w4']].forEach(([s,k],i)=>{const g=G(p,{x:-16,y:235+i*145,o:0});mk('circle',{cx:130,cy:-10,r:26,fill:COL.task},g);T(g,String(i+1),{x:130,y:0,size:30,anchor:'middle',fill:COL.board});T(g,s,{x:195,size:i===3?31:33});tw(g,{x:0,o:1},m(k),.6);});saText(p,'Equal opposite magnitudes → 0',800,850,m('w4',2),31,COL.chalk,'middle');}],['final1','Chapter practice',()=>panel(0),{ask:done=>quiz(SCREEN,[{id:'p-basic',prompt:'Add. Same signs, opposites, and zero.',build:saBlanks([{parts:['−8 + (−5) = ',{box:'-13'}],why:'Add magnitudes 8+5=13; keep the negative sign.'},{parts:['6 + 9 = ',{box:'15'}],why:'Both positive: 6+9=15.'},{parts:['−12 + 12 = ',{box:'0'}],why:'Twelve zero pairs leave no units.'},{parts:['−18 + 0 = ',{box:'-18'}],why:'Adding zero does not change the value.'}-])}],done,'Chapter practice 1 of 3')}],+])}],done,'Chapter practice · set 1 of 3')}],['final2','Chapter practice',()=>panel(0),{ask:done=>quiz(SCREEN,[{id:'p-mixed',prompt:'Compare magnitudes. For three addends, track the signed partial sum.',build:saBlanks([{parts:['−17 + 12 = ',{box:'-5'}],why:'17−12=5; the negative addend has larger magnitude.'},{parts:['23 + (−9) = ',{box:'14'}],why:'23−9=14; the positive addend has larger magnitude.'},{parts:['−640 + 385 = ',{box:'-255'}],why:'640−385=255; retain the negative sign.'},{parts:['−6 + 11 + (−3) = ',{box:'2'}],why:'−6+11=5; then 5+(−3)=2.'}-])}],done,'Chapter practice 2 of 3')}],+])}],done,'Chapter practice · set 2 of 3')}],['final3','Chapter practice',()=>panel(0),{ask:done=>quiz(SCREEN,[{id:'p-temp',prompt:'The temperature is 0°C. It changes by −18°C, then +5°C. Find the final temperature.',build:saBlanks([{parts:[{box:'-13'},' °C'],why:'0+(−18)+5=−13. A five-degree rise does not undo the full eighteen-degree drop.'}])},{id:'p-balance',prompt:'A signed balance of −$40 improves by +$24 after a payment. Find the NEW SIGNED BALANCE.',build:saBlanks([{parts:[{box:'-16'},' dollars'],why:'−40+24=−16 dollars. The balance remains negative.'}])},@@ -58,7 +59,7 @@ const BEATS=[{parts:[{box:'5'},' zero pairs are removed.'],why:'Each of the five negative tiles pairs with one positive tile.'},{parts:['Remaining signed value = ',{box:'2'}],why:'Two positive tiles remain, giving signed value +2.'}])}-],done,'Chapter practice 3 of 3')}],+],done,'Chapter practice · set 3 of 3')}],['finish','Finished',()=>panel(0),{ask:finishCard}]].map(([id,title,run,extra])=>({id,title,run,...extra}));boot();diff --git a/site/math-notebook/ch12/audio/en/temperature.mp3 b/site/math-notebook/ch12/audio/en/temperature.mp3index 0db85f6..26c4afe 100644Binary files a/site/math-notebook/ch12/audio/en/temperature.mp3 and b/site/math-notebook/ch12/audio/en/temperature.mp3 differdiff --git a/site/math-notebook/ch12/audio/en/timings.js b/site/math-notebook/ch12/audio/en/timings.jsindex 6271bef..5d8b2f1 100644--- a/site/math-notebook/ch12/audio/en/timings.js+++ b/site/math-notebook/ch12/audio/en/timings.js@@ -629,51 +629,51 @@ window.TIMINGS = {]},"temperature": {- "dur": 42.936,+ "dur": 39.936,"marks": {- "change": 7.812,- "gap": 20.182,- "labels": 31.289+ "change": 6.901,+ "gap": 17.969,+ "labels": 28.75},"cues": [[- 0.091,+ 0.104,"A thermometer starts at eight degrees and later reads negative six degrees."],[- 5.755,+ 4.948,"We can ask two different questions."],[- 7.812,+ 6.901,"The signed change is the final reading minus the initial reading: negative six minus eight."],[- 14.31,+ 12.409,"This equals negative fourteen degrees."],[- 17.07,+ 15.117,"The negative sign tells us the temperature fell."],[- 20.182,+ 17.969,"The positive gap between the readings is fourteen degrees, the magnitude of that change."],[- 25.768,- "On the line, eight units down reach zero and six more reach negative six."+ 23.542,+ "On the line, eight units left reach zero and six more reach negative six."],[- 31.289,+ 28.75,"A fourteen-degree fall has signed change negative fourteen."],[- 35.013,+ 32.305,"A fourteen-degree gap is a positive distance."],[- 37.995,+ 35.352,"Read the question carefully so your answer describes the requested quantity."]]diff --git a/site/math-notebook/ch12/index.html b/site/math-notebook/ch12/index.htmlindex 5a85883..754d382 100644--- a/site/math-notebook/ch12/index.html+++ b/site/math-notebook/ch12/index.html@@ -8,23 +8,23 @@ const saSigned=v=>v>0?'+'+v:num(v);const saText=(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 saMath=(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;};const saTitle=(p,s,sub='')=>{saText(p,s,100,110,.1,43);if(sub)saText(p,sub,100,162,.15,27,COL.dim);};-function saEq(p,a,b,c,t=0,y=750,xEq=800,size=60){const row=tokens(p,[{t:num(a),fill:saColor(a)},' + ',{t:b<0?'('+num(b)+')':num(b),fill:saColor(b)}],{x:xEq-size*.5,y,size,anchor:'end'});row.push(saMath(p,'=',xEq,y,t,size),saMath(p,num(c),xEq+size*.65,y,t,size,saColor(c),'start'));row.slice(0,3).forEach(e=>{put(e,{o:0});show(e,t)});return row;}+function saEq(p,a,b,c,t=0,y=750,xEq=800,size=60,tR=t){const row=tokens(p,[{t:num(a),fill:saColor(a)},' + ',{t:b<0?'('+num(b)+')':num(b),fill:saColor(b)}],{x:xEq-size*.65,y,size,anchor:'end'});row.push(saMath(p,'=',xEq,y,tR,size),saMath(p,num(c),xEq+size*.65,y,tR,size,saColor(c),'start'));row.slice(0,3).forEach(e=>{put(e,{o:0});show(e,t)});return row;}function saLine(p,lo=-8,hi=8,u=76,o=800){const y=560;const g=G(p);g.dataset.lineLo=lo;g.dataset.lineHi=hi;g.dataset.unit=u;g.dataset.origin=o;path(g,`M${o+(lo-.55)*u} ${y}H${o+(hi+.55)*u}`,{stroke:COL.chalk,'stroke-width':3});for(const [v,d] of [[lo-.55,-1],[hi+.55,1]])path(g,`M${o+v*u-12*d} ${y-9}L${o+v*u} ${y}L${o+v*u-12*d} ${y+9}`,{stroke:COL.chalk,'stroke-width':3});for(let v=lo;v<=hi;v++){path(g,`M${o+v*u} ${y-9}V${y+9}`,{stroke:COL.dim,'stroke-width':2});T(g,num(v),{x:o+v*u,y:y+45,size:28,font:MATH,anchor:'middle',fill:v===0?COL.chalk:COL.dim});}const dot=G(g,{x:o,y});const circle=mk('circle',{r:11,fill:COL.chalk,stroke:COL.board,'stroke-width':2},dot);return {g,y,u,o,dot,circle,x:v=>o+u*v};}function saMove(l,a,b,y,t){const c=saColor(b-a),dur=1.4,x1=l.x(a),x2=l.x(b),d=Math.sign(b-a),g=G(l.g);g.dataset.moveFrom=a;g.dataset.moveTo=b;g.dataset.startX=x1;g.dataset.endX=x2;const ln=path(g,`M${x1} ${y}H${x2}`,{stroke:c,'stroke-width':5},{d:0});draw(ln,t,dur);const h=path(g,`M${x2-14*d} ${y-10}L${x2} ${y}L${x2-14*d} ${y+10}`,{stroke:c,'stroke-width':5},{o:0});show(h,t+dur-.12,.15);saText(g,saSigned(b-a),(x1+x2)/2,y-22,t+.1,35,c,'middle');const drop=path(g,`M${x2} ${y+12}V${l.y-15}`,{stroke:c,'stroke-width':2,'stroke-dasharray':'5 5'},{o:0});show(drop,t+dur,.2);tw(l.dot,{x:x2},t,dur,lin);tw(l.circle,{c_fill:saColor(b)},t,dur,lin);return g;}function saTile(p,sign,id,x,y,t=0){const e=tile(p,sign,x,y);e.dataset.tileId=id;e.dataset.value=sign;tw(e,{o:1,s:1},t,.35,back);return e;}const saBlanks=rows=>(body,api)=>{const ctl=blanks(rows)(body,api),check=ctl.check;ctl.check=()=>{body.querySelectorAll('input.box').forEach(b=>{b.value=b.value.replace(/^\s*\+\s*/,'').replace(/(\d),(?=\d{3}\b)/g,'$1');});check();};return ctl;};// A display row separates signed operands from the operation. All equals signs align.-function ssEq(p,parts,t=0,y=790,xEq=800,size=52){const k=parts.indexOf(' = '),left=tokens(p,parts.slice(0,k),{x:xEq-size*.5,y,size,anchor:'end'});left.forEach(e=>{put(e,{o:0});show(e,t)});saMath(p,'=',xEq,y,t,size);const right=tokens(p,parts.slice(k+1),{x:xEq+size*.65,y,size,anchor:'start'});right.forEach(e=>{put(e,{o:0});show(e,t)});return [...left,...right];}+function ssEq(p,parts,t=0,y=790,xEq=800,size=52,tR=t){const k=parts.indexOf(' = '),left=tokens(p,parts.slice(0,k),{x:xEq-size*.65,y,size,anchor:'end'});left.forEach(e=>{put(e,{o:0});show(e,t)});saMath(p,'=',xEq,y,tR,size);const right=tokens(p,parts.slice(k+1),{x:xEq+size*.65,y,size,anchor:'start'});right.forEach(e=>{put(e,{o:0});show(e,tR)});return [...left,...right];}const ssV=v=>({t:num(v),fill:saColor(v)});const ssOperand=v=>({t:v<0?'('+num(v)+')':num(v),fill:saColor(v)});-function ssSubtract(p,a,b,result,t=0,y=790,size=56){return ssEq(p,[ssV(a),' − ',ssOperand(b),' = ',ssV(result)],t,y,800,size);}+function ssSubtract(p,a,b,result,t=0,y=790,size=56,tR=t){return ssEq(p,[ssV(a),' − ',ssOperand(b),' = ',ssV(result)],t,y,800,size,tR);}// Actual signed tiles move. Added zero pairs appear before any requested tile is removed.function ssRemoval(p,a,b,m,hasPairs=true){const g=G(p),initial=[],positive=[],negative=[],pairs=[];mk('rect',{x:130,y:245,width:950,height:335,rx:22,fill:'none',stroke:COL.dim,'stroke-width':2},g);mk('rect',{x:1160,y:245,width:360,height:335,rx:22,fill:'none',stroke:COL.dim,'stroke-width':2,'stroke-dasharray':'8 6'},g);- saText(g,'Working collection',605,230,0,27,COL.chalk,'middle');saText(g,'Removed from start',1340,230,0,27,COL.dim,'middle');+ saText(g,'Our tiles',605,230,0,29,COL.chalk,'middle');saText(g,'Taken away',1340,230,0,29,COL.dim,'middle');for(let i=0;i<Math.abs(a);i++){const e=saTile(g,Math.sign(a),'initial-'+i,210+i*82,385,i*.04);initial.push(e);(a>0?positive:negative).push(e);}const available=Math.sign(a)===Math.sign(b)?Math.abs(a):0,k=Math.max(0,Math.abs(b)-available);for(let i=0;i<k;i++){@@ -37,32 +37,31 @@ function ssRemoval(p,a,b,m,hasPairs=true){removed.forEach((e,i)=>tw(e,{x:1245+(i%3)*82,y:315+Math.floor(i/3)*90,o:.38},m('remove')+i*.12,.8));survivors.forEach((e,i)=>tw(e,{x:605+(i-(survivors.length-1)/2)*82,y:385},m('result'),.8));saText(g,'Start: '+saSigned(a),130,630,0,32,saColor(a));- if(k)saText(g,'After adding '+k+' × 0: '+saSigned(a),130,690,m('unchanged'),32,saColor(a));- else saText(g,'Enough requested tiles are already here.',130,690,0,29,COL.dim);- saText(g,'After removal: '+saSigned(a-b),1120,660,m('result'),32,saColor(a-b),'middle');- saText(g,'Removed value: '+saSigned(b),1340,610,m('remove'),27,saColor(b),'middle');- ssSubtract(p,a,b,a-b,m('result'),815);+ if(k)saText(g,'Add '+k+' zero '+(k===1?'pair':'pairs')+': still '+saSigned(a),130,690,m('unchanged'),32,saColor(a));+ saText(g,'Left: '+saSigned(a-b),130,750,m('result'),32,saColor(a-b));+ saText(g,'Taken away: '+saSigned(b),1340,630,m('remove'),32,saColor(b),'middle');+ ssSubtract(p,a,b,a-b,m('result'),750);return {g,initial,positive,negative,pairs,removed,survivors};}function ssTileOptions(p,groups,y=525){return groups.map(([sign,n],j)=>{const g=G(p,{x:310+j*490,y});for(let i=0;i<n;i++)saTile(g,sign,'answer-'+j+'-'+i,(i-(n-1)/2)*74,0);saText(g,String.fromCharCode(65+j),0,-62,0,29,COL.dim,'middle');return {el:g,box:[130+j*490,y-100,360,175],label:n+' '+(sign>0?'positive':'negative')+' tiles'};});}const BEATS=[['intro','Remove a signed amount',(m,D)=>{const g=G(scene,{o:0,y:24});T(g,'Unit 1 · The Number System · Chapter 12',{x:800,y:215,size:28,fill:COL.dim,anchor:'middle'});T(g,'Subtracting Positive',{x:800,y:325,size:72,weight:600,anchor:'middle'});T(g,'and Negative Numbers',{x:800,y:420,size:72,weight:600,anchor:'middle'});tw(g,{o:1,y:0},.2,1,out);saTile(g,1,'intro-plus',730,550,.4);saTile(g,-1,'intro-minus',870,550,.5);saText(g,'Remove signed tiles · add the opposite',800,690,m('sub'),34,COL.dim,'middle');hide(g,D-.8,.7);}],-['opposite','Find the additive inverse',m=>{const p=panel(0);saTitle(p,'Opposites have sum zero','Same magnitude · opposite sign');const l=saLine(p,-6,6,94);S.ssLine=l;const pg=G(p,{x:l.x(4),y:l.y,o:0}),ng=G(p,{x:l.x(-4),y:l.y,o:0});mk('circle',{r:15,fill:POS},pg);mk('circle',{r:15,fill:NEG},ng);show(pg,m('positive'));show(ng,m('positive'));saText(p,'+4',l.x(4),480,m('positive'),44,POS,'middle');saText(p,'−4',l.x(-4),480,m('positive'),44,NEG,'middle');const arc=path(p,`M${l.x(-4)} 410 Q800 235 ${l.x(4)} 410`,{stroke:COL.dim,'stroke-width':3,fill:'none'},{d:0});draw(arc,m('negative'),1.2);saText(p,'Opposite of −4: +4',800,280,m('negative'),39,POS,'middle');saEq(p,4,-4,0,m('zero'),760);saText(p,'Opposite of 0: 0',800,845,m('zero',2),30,COL.chalk,'middle');}],+['opposite','Find the additive inverse',m=>{const p=panel(0);saTitle(p,'Opposites have sum zero','Same magnitude · opposite sign');const l=saLine(p,-6,6,94);S.ssLine=l;const pg=G(p,{x:l.x(4),y:l.y,o:0}),ng=G(p,{x:l.x(-4),y:l.y,o:0});mk('circle',{r:15,fill:POS},pg);mk('circle',{r:15,fill:NEG},ng);show(pg,m('positive'));show(ng,m('positive'));saText(p,'+4',l.x(4),480,m('positive'),44,POS,'middle');saText(p,'−4',l.x(-4),480,m('positive'),44,NEG,'middle');const arc=path(p,`M${l.x(-4)} 410 Q800 265 ${l.x(4)} 410`,{stroke:COL.dim,'stroke-width':3,fill:'none'},{d:0});draw(arc,m('negative'),1.2);for(const [v,t,c] of [[4,m('negative',1.1),POS],[-4,m('negative',3.5),NEG]]){const x=l.x(v),L=Math.hypot(x-800,145),dx=(x-800)/L,dy=145/L,h=path(p,`M${x-18*dx-9*dy} ${410-18*dy+9*dx}L${x} 410L${x-18*dx+9*dy} ${410-18*dy-9*dx}`,{stroke:c,'stroke-width':3,fill:'none'},{o:0});show(h,t,.2);}saText(p,'Opposite of −4: +4',800,235,m('negative'),39,POS,'middle');saText(p,'Opposite of +4: −4',800,295,m('negative',3.5),39,NEG,'middle');saEq(p,4,-4,0,m('zero'),760);saText(p,'Opposite of 0: 0',800,845,m('zero',2),30,COL.chalk,'middle');}],['removePositive','Subtract positive tiles',m=>{const p=panel(0);saTitle(p,'6 − 2','Subtract +2: remove two positive tiles.');S.ssModel=ssRemoval(p,6,2,m,false);}],['missingPositive','Add zero pairs first',m=>{const p=panel(0);saTitle(p,'2 − 5','Not enough positive tiles? Add zero pairs BEFORE removing.');S.ssModel=ssRemoval(p,2,5,m);}],['q1','Quick check',()=>{const p=panel(0);saTitle(p,'−2 − 3','Start with two negative tiles. How many zero pairs are NEEDED?');saTile(p,-1,'q1-start0',760,235);saTile(p,-1,'q1-start1',850,235);S.ssPairOptions=[1,3,5].map((n,j)=>{const g=G(p,{x:300+j*490,y:450});for(let i=0;i<n;i++){saTile(g,1,'q1-'+j+'-p'+i,(i-(n-1)/2)*65,-45);saTile(g,-1,'q1-'+j+'-n'+i,(i-(n-1)/2)*65,45);}saText(g,String.fromCharCode(65+j)+' · '+n+' zero '+(n===1?'pair':'pairs'),0,135,0,29,COL.dim,'middle');return {el:g,box:[100+j*490,325,400,290],label:n+' zero pairs'};});},{ask:done=>quiz(BAND,[{id:'c-zero-pairs',prompt:'Choose the MINIMUM zero pairs needed to remove 3 positive tiles.',build:pickEls(S.ssPairOptions,1,'Three zero pairs supply three positives to remove. Before removal, −2 + 3 − 3 is still −2.',i=>i===0?'One pair supplies only one positive tile. We must remove three.':'Five pairs would work, but the question asks for the minimum. Three provide exactly three positive tiles.',()=>pulseFx(S.ssPairOptions[1].el,1.05))}],done)}],['removeNegative','Subtract a negative amount',m=>{const p=panel(0);saTitle(p,'3 − (−2)','Subtract −2: remove two NEGATIVE tiles.');S.ssModel=ssRemoval(p,3,-2,m);}],['negativeStart','A negative start can increase',m=>{const p=panel(0);saTitle(p,'−4 − (−2)','We already have the two negative tiles to remove.');S.ssModel=ssRemoval(p,-4,-2,m,false);}],['q2','Quick check',()=>{const p=panel(0);saTitle(p,'−5 − (−7)','Two zero pairs have been added. Remove seven NEGATIVE tiles.');for(let i=0;i<5;i++)saTile(p,-1,'q2-initial'+i,380+i*76,265);for(let i=0;i<2;i++){saTile(p,1,'q2-pairp'+i,930+i*90,245);saTile(p,-1,'q2-pairn'+i,930+i*90,330);}saText(p,'Starting value is still −5: −7 + 2 = −5',800,410,0,30,COL.dim,'middle');S.ssTileChoices=ssTileOptions(p,[[1,2],[-1,2],[-1,5]],555);},{ask:done=>quiz(BAND,[{id:'c-remainder',prompt:'Which tiles remain after all seven negatives are removed?',build:pickEls(S.ssTileChoices,0,'The five original negatives and two added negatives leave. The two added positives remain: +2.',i=>i===1?'Subtracting −7 removes negative tiles, so the two leftover tiles here are positive.':'The starting value is −5, but removing seven negative units increases it to +2.',()=>pulseFx(S.ssTileChoices[0].el,1.1))}],done)}],-['rewrite','Subtract means add the opposite',m=>{const p=panel(0);saTitle(p,'Keep the start · add the opposite');saMath(p,'a − b = a + (−b)',800,270,m('rule'),69);saText(p,'Keep a',435,350,m('rule'),29,COL.dim,'middle');saText(p,'Replace b with its opposite',1070,350,m('rule'),29,COL.dim,'middle');ssSubtract(p,3,-2,5,m('example'),475);saEq(p,3,2,5,m('example',1.5),560);ssSubtract(p,-4,2,-6,m('other'),705);saEq(p,-4,-2,-6,m('other',1.5),795);}],-['lineNegative','Subtract negative: move right',m=>{const p=panel(0);saTitle(p,'2 − (−5)','Rewrite first. The move starts at +2.');S.ssLine=saLine(p);saMove(S.ssLine,0,2,315,m('start'));saEq(p,2,5,7,m('opposite'),245,800,46);saMove(S.ssLine,2,7,440,m('move'));ssSubtract(p,2,-5,7,m('result'));}],-['linePositive','Subtract positive: move left',m=>{const p=panel(0);saTitle(p,'−3 − 4','The first number keeps its sign.');S.ssLine=saLine(p);saMove(S.ssLine,0,-3,315,m('start'));saEq(p,-3,-4,-7,m('opposite'),245,800,46);saMove(S.ssLine,-3,-7,440,m('move'));ssSubtract(p,-3,4,-7,m('result'));}],-['q3','Quick check',()=>{const p=panel(0);saTitle(p,'−2 − (−6)','The start is shown. Add the opposite of −6.');const l=saLine(p);S.ssLine=l;saMove(l,0,-2,330,0);S.ssPoints=[-8,4,8].map(v=>{const g=G(p,{x:l.x(v),y:l.y});mk('circle',{r:17,fill:COL.board,stroke:COL.task,'stroke-width':3},g);return {el:g,box:[l.x(v)-34,l.y-35,68,70],label:num(v)};});},{ask:done=>quiz(BAND,[{id:'c-endpoint',prompt:'Choose the endpoint of −2 + 6.',build:pickEls(S.ssPoints,1,'From −2, move six units RIGHT to +4. Subtracting −6 adds +6.',i=>i===0?'−8 comes from moving left. The opposite of −6 is +6, so move right.':'Keep the starting sign: −2 + 6 is 4. Changing −2 to +2 would incorrectly give 8.',()=>pulseFx(S.ssPoints[1].el,1.25))}],done)}],-['crossZero','Remove beyond the original negatives',m=>{const p=panel(0);saTitle(p,'−5 − (−8)','Three zero pairs make eight negative tiles available.');S.ssModel=ssRemoval(p,-5,-8,m);saText(p,'Same result as −5 + 8',800,745,m('result'),31,COL.dim,'middle');}],-['zero','Useful zero checks',m=>{const p=panel(0);saTitle(p,'Zero fits the same rule');ssSubtract(p,-7,0,-7,m('keep'),330);saText(p,'Subtract zero: unchanged',800,395,m('keep'),30,COL.dim,'middle');ssSubtract(p,0,-4,4,m('from'),545);saText(p,'0 + 4 = 4',800,615,m('from'),35,POS,'middle');ssSubtract(p,-6,-6,0,m('same'),770);saText(p,'Equal opposites add to zero',800,845,m('same'),30,COL.dim,'middle');}],+['rewrite','Subtract means add the opposite',m=>{const p=panel(0);saTitle(p,'Keep the start · add the opposite');saMath(p,'a − b = a + (−b)',800,270,m('rule'),69);saText(p,'Keep a',576,350,m('rule'),29,COL.dim,'middle');saText(p,'Replace b with its opposite',973,350,m('rule',3.5),29,COL.dim,'middle');ssSubtract(p,3,-2,5,m('example'),475,56,m('example',3.6));saEq(p,3,2,5,m('example',1.5),560,800,60,m('example',3.6));ssSubtract(p,-4,2,-6,m('other'),705,56,m('other',5.2));saEq(p,-4,-2,-6,m('other',1.5),795,800,60,m('other',5.2));}],+['lineNegative','Subtract negative: move right',m=>{const p=panel(0);saTitle(p,'2 − (−5)','Rewrite first. The move starts at +2.');S.ssLine=saLine(p);saMove(S.ssLine,0,2,315,m('start'));saEq(p,2,5,7,m('opposite'),230,800,46,m('result'));saMove(S.ssLine,2,7,440,m('move'));ssSubtract(p,2,-5,7,m('result'));}],+['linePositive','Subtract positive: move left',m=>{const p=panel(0);saTitle(p,'−3 − 4','The first number keeps its sign.');S.ssLine=saLine(p);saMove(S.ssLine,0,-3,315,m('start'));saEq(p,-3,-4,-7,m('opposite'),230,800,46,m('move',2.7));saMove(S.ssLine,-3,-7,440,m('move'));ssSubtract(p,-3,4,-7,m('result'));}],+['q3','Quick check',()=>{const p=panel(0);saTitle(p,'−2 − (−6)','The start is shown. Add the opposite of −6.');const l=saLine(p,-9,9,70);S.ssLine=l;saMove(l,0,-2,330,0);S.ssPoints=[-8,4,8].map(v=>{const g=G(p,{x:l.x(v),y:l.y});mk('circle',{r:17,fill:COL.board,stroke:COL.task,'stroke-width':3},g);return {el:g,box:[l.x(v)-34,l.y-35,68,70],label:num(v)};});},{ask:done=>quiz(BAND,[{id:'c-endpoint',prompt:'Choose the endpoint of −2 + 6.',build:pickEls(S.ssPoints,1,'From −2, move six units RIGHT to +4. Subtracting −6 adds +6.',i=>i===0?'−8 comes from moving left. The opposite of −6 is +6, so move right.':'Keep the starting sign: −2 + 6 is 4. Changing −2 to +2 would incorrectly give 8.',()=>pulseFx(S.ssPoints[1].el,1.25))}],done)}],+['crossZero','Remove beyond the original negatives',m=>{const p=panel(0);saTitle(p,'−5 − (−8)','Three zero pairs make eight negative tiles available.');S.ssModel=ssRemoval(p,-5,-8,m);saText(p,'same as −5 + 8',1340,750,m('result',6.9),31,COL.dim,'middle');}],+['zero','Useful zero checks',m=>{const p=panel(0);saTitle(p,'Zero fits the same rule');ssSubtract(p,-7,0,-7,m('keep'),330,56,m('keep',6));saText(p,'Subtract zero: unchanged',800,395,m('keep'),30,COL.dim,'middle');ssSubtract(p,0,-4,4,m('from'),545,56,m('from',5.3));saText(p,'0 + 4 = 4',800,615,m('from',5.3),35,POS,'middle');ssSubtract(p,-6,-6,0,m('same'),770);saText(p,'Equal opposites add to zero',800,845,m('same'),30,COL.dim,'middle');}],['chain','Track the signed partial sum',m=>{const p=panel(0);saTitle(p,'−6 − (−10) + (−3)','Work from left to right after rewriting.');const lines=[[[ssV(-6),' − ',ssOperand(-10),' + ',ssOperand(-3),' = ',ssV(-6),' + ',ssV(10),' + ',ssOperand(-3)],'rewrite',340,47],[[ssV(-6),' + ',ssV(10),' = ',ssV(4)],'first',520,58],[[ssV(4),' + ',ssOperand(-3),' = ',ssV(1)],'last',715,58]];lines.forEach(([parts,k,y,size])=>ssEq(p,parts,m(k),y,750,size));saText(p,'The initial −6 stays −6.',800,845,m('last'),30,COL.dim,'middle');}],-['temperature','Signed change or positive gap?',m=>{const p=panel(0);saTitle(p,'Initial 8°C → final −6°C','Two questions; two meanings.');const l=saLine(p,-8,8,75);S.ssLine=l;put(l.dot,{x:l.x(8)});put(l.circle,{c_fill:POS});saText(p,'initial: 8°C',l.x(8),305,0,30,POS,'middle');saText(p,'final: −6°C',l.x(-6),305,0,30,NEG,'middle');saMove(l,8,-6,420,m('change'));ssEq(p,[ssV(-6),' − ',ssV(8),' = ',ssV(-14)],m('change'),700,800,52);saText(p,'Signed change: −14°C (a fall)',800,755,m('change'),32,NEG,'middle');const tape=G(p,{o:0});path(tape,`M${l.x(-6)} 340H${l.x(8)}`,{stroke:COL.task,'stroke-width':8});for(const v of [-6,8])path(tape,`M${l.x(v)} 329V351`,{stroke:COL.task,'stroke-width':3});saText(tape,'14°C gap',800,310,0,30,COL.task,'middle');show(tape,m('gap'));saText(p,'Positive gap: 14°C',800,835,m('labels'),32,COL.task,'middle');}],-['altitude','Upper height minus lower height',m=>{const p=panel(0);saTitle(p,'Drone +35 m · diver −18 m','How far apart vertically? Upper minus lower.');const g=G(p),x=500,y0=565,s=6,yt=y0-35*s,yb=y0+18*s;path(g,`M${x} 300V710`,{stroke:COL.dim,'stroke-width':3});path(g,'M190 565H1450',{stroke:COL.chalk,'stroke-width':2,'stroke-dasharray':'8 6'});saText(g,'Sea level: 0 m',1350,550,0,28,COL.chalk,'middle');for(const v of [-20,-10,0,10,20,30,40]){const y=y0-v*s;path(g,`M${x-9} ${y}H${x+9}`,{stroke:COL.dim,'stroke-width':2});saText(g,num(v),x-28,y+9,0,26,COL.dim,'end');}const drone=G(g,{x:720,y:yt,o:0});path(drone,'M-35 0H35M-16 -10L16 10M-16 10L16 -10',{stroke:POS,'stroke-width':5});for(const dx of [-35,35])mk('ellipse',{cx:dx,cy:-8,rx:23,ry:6,fill:'none',stroke:POS,'stroke-width':3},drone);show(drone,m('upper'));saText(g,'+35 m',825,yt+10,m('upper'),35,POS);const diver=G(g,{x:720,y:yb,o:0});mk('circle',{cx:-18,cy:-6,r:10,fill:'none',stroke:NEG,'stroke-width':3},diver);path(diver,'M-8 -4L24 3L48 -7M18 1L42 17',{stroke:NEG,'stroke-width':5});show(diver,m('lower'));saText(g,'−18 m',825,yb+10,m('lower'),35,NEG);const tape=G(g,{o:0});path(tape,`M1080 ${yt}V${yb}`,{stroke:COL.task,'stroke-width':8});for(const yy of [yt,y0,yb])path(tape,`M1067 ${yy}H1093`,{stroke:COL.task,'stroke-width':3});saText(tape,'35 m',1115,(yt+y0)/2+10,0,31,COL.task);saText(tape,'18 m',1115,(y0+yb)/2+10,0,31,COL.task);saText(tape,'53 m',1260,(yt+yb)/2+10,0,44,COL.task);show(tape,m('gap'));ssSubtract(p,35,-18,53,m('gap'),790,52);saText(p,'Vertical separation: 53 meters',800,850,m('result'),33,COL.task,'middle');S.ssAltitude={g,x,y0,s,yt,yb,tape};}],+['temperature','Signed change or positive gap?',m=>{const p=panel(0);saTitle(p,'Initial 8°C → final −6°C','Two questions; two meanings.');const l=saLine(p,-8,8,75);S.ssLine=l;put(l.dot,{x:l.x(8)});put(l.circle,{c_fill:POS});saText(p,'initial: 8°C',l.x(8),305,0,30,POS,'middle');saText(p,'final: −6°C',l.x(-6),305,0,30,NEG,'middle');saMove(l,8,-6,420,m('change',5.5));ssEq(p,[ssV(-6),' − ',ssV(8),' = ',ssV(-14)],m('change'),700,800,52,m('change',5.5));saText(p,'Signed change: −14°C (a fall)',800,755,m('change',5.5),32,NEG,'middle');const tape=G(p,{o:0});path(tape,`M${l.x(-6)} 340H${l.x(8)}`,{stroke:COL.task,'stroke-width':8});for(const v of [-6,8])path(tape,`M${l.x(v)} 329V351`,{stroke:COL.task,'stroke-width':3});saText(tape,'14°C gap',800,310,0,30,COL.task,'middle');show(tape,m('gap'));for(const [a,b,t,d] of [[8,0,6.6,1.15],[0,-6,8.66,.8]]){const seg=path(p,`M${l.x(a)} 340H${l.x(b)}`,{stroke:COL.chalk,'stroke-width':4},{d:0});draw(seg,m('gap',t),d);const ring=mk('circle',{cx:l.x(b),cy:l.y,r:17,fill:'none',stroke:COL.task,'stroke-width':4},p);put(ring,{o:0});show(ring,m('gap',t+d),.2);}saText(p,'Positive gap: 14°C',800,835,m('labels'),32,COL.task,'middle');}],+['altitude','Upper height minus lower height',m=>{const p=panel(0);saTitle(p,'Drone +35 m · diver −18 m','How far apart vertically? Upper minus lower.');const g=G(p),x=500,y0=565,s=6,yt=y0-35*s,yb=y0+18*s;path(g,`M${x} 300V710`,{stroke:COL.dim,'stroke-width':3});path(g,'M530 565H1450',{stroke:COL.chalk,'stroke-width':2,'stroke-dasharray':'8 6'});saText(g,'Sea level: 0 m',1450,605,0,28,COL.chalk,'end');for(const v of [-20,-10,0,10,20,30,40]){const y=y0-v*s;path(g,`M${x-9} ${y}H${x+9}`,{stroke:COL.dim,'stroke-width':2});saText(g,num(v),x-28,y+9,0,26,COL.dim,'end');}const drone=G(g,{x:720,y:yt,o:0});mk('rect',{x:-20,y:-8,width:40,height:16,rx:5,fill:POS},drone);path(drone,'M-16 -3L-40 -14M16 -3L40 -14M-40 -14V-20M40 -14V-20M-12 8L-18 19M12 8L18 19',{stroke:POS,'stroke-width':4,'stroke-linecap':'round'});for(const dx of [-40,40])mk('ellipse',{cx:dx,cy:-21,rx:25,ry:5,fill:POS,'fill-opacity':.45,stroke:POS,'stroke-width':2},drone);show(drone,m('upper'));saText(g,'+35 m',825,yt+10,m('upper'),35,POS);const diver=G(g,{x:720,y:yb,o:0});mk('circle',{cx:-40,cy:0,r:11,fill:NEG},diver);mk('ellipse',{cx:0,cy:2,rx:28,ry:10,fill:NEG},diver);mk('rect',{x:-16,y:-17,width:28,height:9,rx:4,fill:'none',stroke:NEG,'stroke-width':3},diver);path(diver,'M-24 6L-54 16M24 -1L52 -6M24 6L52 12',{stroke:NEG,'stroke-width':5,'stroke-linecap':'round'});path(diver,'M52 -6L68 -14L66 -2ZM52 12L68 20L66 8Z',{fill:NEG,stroke:NEG,'stroke-width':2});show(diver,m('lower'));saText(g,'−18 m',825,yb+10,m('lower'),35,NEG);const tape=G(g,{o:0});path(tape,`M1080 ${yt}V${yb}`,{stroke:COL.task,'stroke-width':8});for(const yy of [yt,y0,yb])path(tape,`M1067 ${yy}H1093`,{stroke:COL.task,'stroke-width':3});saText(tape,'35 m',1055,(yt+y0)/2+10,0,31,COL.task,'end');saText(tape,'18 m',1055,(y0+yb)/2+10,0,31,COL.task,'end');show(tape,m('gap'));saText(g,'53 m',1115,(yt+yb)/2+15,m('gap',10),48,COL.task);ssSubtract(p,35,-18,53,m('gap'),790,52,m('gap',10));saText(p,'Vertical separation: 53 meters',800,850,m('result'),33,COL.task,'middle');S.ssAltitude={g,x,y0,s,yt,yb,tape};}],['wrap','Four reliable ideas',m=>{const p=panel(0);saTitle(p,'Subtract signed numbers with a reason');[['Keep the start; add the opposite of the subtracted number.','w1'],['Remove tiles of the SIGN you are subtracting.','w2'],['Add zero pairs FIRST if those tiles are missing.','w3'],['Signed change = final − initial; a gap is positive distance.','w4']].forEach(([s,k],i)=>{const g=G(p,{x:-16,y:270+i*145,o:0});mk('circle',{cx:130,cy:-10,r:26,fill:COL.task},g);T(g,String(i+1),{x:130,y:0,size:30,anchor:'middle',fill:COL.board});T(g,s,{x:195,size:31});tw(g,{x:0,o:1},m(k),.6);});}],['final1','Chapter practice',()=>panel(0),{ask:done=>quiz(SCREEN,[{id:'p-basic',prompt:'Subtract. Keep the first number; add the opposite of the second.',build:saBlanks([{parts:['7 − (−6) = ',{box:'13'}],why:'7 + 6 = 13. Subtracting −6 adds +6.'},@@ -71,13 +70,13 @@ const BEATS=[{parts:['−9 − 33 = ',{box:'-42'}],why:'−9 + (−33) = −42.'},{parts:['−8 − 0 = ',{box:'-8'}],why:'Subtracting zero leaves the starting value unchanged: −8 + 0 = −8.'},{parts:['0 − (−9) = ',{box:'9'}],why:'The opposite of −9 is +9, so 0 + 9 = 9.'}- ])}],done,'Chapter practice 1 of 3')}],+ ])}],done,'Chapter practice · set 1 of 3')}],['final2','Chapter practice',()=>panel(0),{ask:done=>quiz(SCREEN,[{id:'p-mixed',prompt:'Subtract. Track the signed partial sum for the last row.',build:saBlanks([{parts:['−16 − (−7) = ',{box:'-9'}],why:'−16 + 7 = −9.'},{parts:['−150 − (−151) = ',{box:'1'}],why:'−150 + 151 = 1; subtracting the larger negative crosses zero.'},{parts:['76 − 173 = ',{box:'-97'}],why:'76 + (−173) = −97.'},{parts:['−13 − (−5) + 8 = ',{box:'0'}],why:'−13 + 5 = −8; then −8 + 8 = 0.'}- ])}],done,'Chapter practice 2 of 3')}],+ ])}],done,'Chapter practice · set 2 of 3')}],['final3','Chapter practice',()=>panel(0),{ask:done=>quiz(SCREEN,[{id:'p-change',prompt:'Temperature changes from 11°C to −8°C. Find the SIGNED CHANGE: final minus initial.',build:saBlanks([{parts:[{box:'-19'},' °C'],why:'−8 − 11 = −19°C. The negative sign shows a fall.'}])},{id:'p-gap',prompt:'For those same readings, 11°C and −8°C, find the POSITIVE GAP.',build:saBlanks([{parts:[{box:'19'},' °C'],why:'The distance between the readings is 19°C, the magnitude of the signed change.'}])},@@ -86,7 +85,7 @@ const BEATS=[{parts:[{box:'3'},' zero pairs added.'],why:'Three pairs supply the three missing negative tiles and preserve starting value +2.'},{parts:['Remaining signed value = ',{box:'5'}],why:'Two original positives plus three added positives remain: +5.'}])}- ],done,'Chapter practice 3 of 3')}],+ ],done,'Chapter practice · set 3 of 3')}],['finish','Finished',()=>panel(0),{ask:finishCard}]].map(([id,title,run,extra])=>({id,title,run,...extra}));boot();diff --git a/site/math-notebook/ch13/audio/en/timings.js b/site/math-notebook/ch13/audio/en/timings.jsindex 7365efd..5ac3ff6 100644--- a/site/math-notebook/ch13/audio/en/timings.js+++ b/site/math-notebook/ch13/audio/en/timings.js@@ -146,6 +146,7 @@ window.TIMINGS = {"marks": {"zero": 6.745,"split": 17.344,+ "gives": 24.557,"opposite": 32.695},"cues": [@@ -352,7 +353,10 @@ window.TIMINGS = {"dur": 40.512,"marks": {"same": 5.625,- "different": 18.034+ "four": 12.656,+ "groups": 14.271,+ "different": 18.034,+ "neg4": 25.286},"cues": [[@@ -417,7 +421,10 @@ window.TIMINGS = {"dur": 44.184,"marks": {"decimal": 5.794,- "divide": 27.904+ "sign": 12.995,+ "order": 19.766,+ "divide": 27.904,+ "sign2": 34.232},"cues": [[diff --git a/site/math-notebook/ch13/index.html b/site/math-notebook/ch13/index.htmlindex 22a1e13..86663c7 100644--- a/site/math-notebook/ch13/index.html+++ b/site/math-notebook/ch13/index.html@@ -8,35 +8,38 @@ const smV=v=>({t:num(v),fill:smColor(v)}),smOperand=v=>({t:v<0?'('+num(v)+')':nuconst smText=(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 smMath=(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;};const smTitle=(p,s,sub='')=>{smText(p,s,100,110,.1,43);if(sub)smText(p,sub,100,162,.15,27,COL.dim);};-function smEq(p,parts,t=0,y=780,xEq=800,size=52){const k=parts.indexOf(' = '),a=tokens(p,parts.slice(0,k),{x:xEq-size*.5,y,size,anchor:'end'}),b=tokens(p,parts.slice(k+1),{x:xEq+size*.65,y,size,anchor:'start'});[...a,...b].forEach(e=>{put(e,{o:0});show(e,t)});smMath(p,'=',xEq,y,t,size);return [...a,...b];}-const smCalc=(p,a,op,b,c,t=0,y=780,size=56)=>smEq(p,[smV(a),' '+op+' ',smOperand(b),' = ',smV(c)],t,y,800,size);+function smEq(p,parts,t=0,y=780,xEq=800,size=52){const k=parts.indexOf(' = '),a=tokens(p,parts.slice(0,k),{x:xEq-size*.65,y,size,anchor:'end'}),b=tokens(p,parts.slice(k+1),{x:xEq+size*.65,y,size,anchor:'start'}),r=[...a,...b];r.forEach(e=>{put(e,{o:0});show(e,t)});r.eq=smMath(p,'=',xEq,y,t,size);return r;}+const smCalc=(p,a,op,b,c,t=0,y=780,size=56,xEq=800)=>smEq(p,[op==='×'?smOperand(a):smV(a),' '+op+' ',smOperand(b),' = ',smV(c)],t,y,xEq,size);+// The equation with '?' from t0; at t1 the answer takes its place. Tokens that keep their text and place stay put.+function smAsk(p,parts,ans,t0,t1,y,xEq=800,size=52){const fill=x=>x==='?'?ans:x,key=x=>JSON.stringify(x),q=smEq(p,parts.map(x=>x==='?'?{t:'?',fill:COL.task}:x),t0,y,xEq,size),a=smEq(p,parts.map(fill),t1,y,xEq,size),ks=parts.filter(x=>x!==' = ');a.eq.remove();q.forEach((e,i)=>{if(ks[i]!=='?'&&Math.abs(e._px-a[i]._px)<.5)a[i].remove();else hide(e,t1,.25);});return a;}function smLine(p,lo=-8,hi=8,u=70,y=560,o=800){const g=G(p);path(g,`M${o+(lo-.4)*u} ${y}H${o+(hi+.4)*u}`,{stroke:COL.chalk,'stroke-width':3});for(let v=lo;v<=hi;v++){path(g,`M${o+v*u} ${y-8}V${y+8}`,{stroke:COL.dim,'stroke-width':2});T(g,num(v),{x:o+v*u,y:y+42,size:27,font:MATH,anchor:'middle',fill:v===0?COL.chalk:COL.dim});}const dot=G(g,{x:o,y}),circle=mk('circle',{r:11,fill:COL.chalk},dot);return {g,u,y,o,x:v=>o+v*u,dot,circle};}-function smArrow(p,a,b,u,y,t=0,id='arrow',o=800){const d=b-a,dir=Math.sign(d),g=G(p,{x:o+a*u,y,o:0});g.dataset.arrowId=id;const shaft=path(g,`M0 0H${d*u}`,{stroke:smColor(d),'stroke-width':5});const head=path(g,`M${d*u-12*dir} -9L${d*u} 0L${d*u-12*dir} 9`,{stroke:smColor(d),'stroke-width':5,fill:'none'});show(g,t,.35);return {g,shaft,head,a,b,u};}+function smArrow(p,a,b,u,y,t=0,id='arrow',o=800){const d=b-a,dir=Math.sign(d),g=G(p,{x:o+a*u,y,o:0});g.dataset.arrowId=id;const shaft=path(g,`M0 0H${d*u}`,{stroke:smColor(d),'stroke-width':5,'vector-effect':'non-scaling-stroke'});const head=path(g,`M${d*u-12*dir} -9L${d*u} 0L${d*u-12*dir} 9`,{stroke:smColor(d),'stroke-width':5,fill:'none','vector-effect':'non-scaling-stroke'});show(g,t,.35);return {g,shaft,head,a,b,u};}function smHops(l,n,delta,t=0){const arrows=[];for(let i=0;i<n;i++)arrows.push(smArrow(l.g,i*delta,(i+1)*delta,l.u,l.y-110,t+i*.35,'hop-'+i,l.o));tw(l.dot,{x:l.x(n*delta)},t,1.5,lin);tw(l.circle,{c_fill:smColor(n*delta)},t,1.5,lin);return arrows;}function smTile(p,sign,id,x,y,t=0){const e=tile(p,sign,x,y);e.dataset.tileId=id;tw(e,{o:1,s:1},t,.3,back);return e;}function smRows(p,n,k,sign,t=0,x=470,y=265,gap=75,rowgap=95){const g=G(p),tiles=[];for(let r=0;r<n;r++){smText(g,'Group '+(r+1),x-115,y+r*rowgap+10,t,25,COL.dim,'end');for(let c=0;c<k;c++)tiles.push(smTile(g,sign,'row-'+r+'-'+c,x+c*gap,y+r*rowgap,t+.04*(r*k+c)));}return {g,tiles,n,k,sign};}-function smReversal(p,m){const l=smLine(p),arrows=smHops(l,3,-2,0);smText(p,'Each arrow: 2 units',280,275,0,30,COL.task,'middle');const original=G(p);smCalc(original,3,'×',-2,-6,0,705,48);const t=m('reverse');hide(original,t-.2,.2);arrows.forEach((a,i)=>{tw(a.g,{y:350+i*160},t,.6,io);tw(a.g,{x:l.x(2*i),r:180},t+.6,2,io);tw(a.g,{y:450},t+2.6,.6,io);tw(a.shaft,{c_stroke:POS},t+.6,2,io);tw(a.head,{c_stroke:POS},t+.6,2,io);});tw(l.dot,{x:l.x(6)},t+.6,2,io);tw(l.circle,{c_fill:POS},t+.6,2,io);show(original,m('result'));smCalc(p,-3,'×',-2,6,m('result'),820,55);return {l,arrows,original};}+function smReversal(p,m){const l=smLine(p),arrows=smHops(l,3,-2,0);smText(p,'Each arrow: 2 units',280,275,0,30,COL.task,'middle');const original=G(p);smCalc(original,3,'×',-2,-6,0,705,48);const t=m('reverse');hide(original,t-.2,.2);// Each arrow folds into its tail and regrows the other way while the tail slides across zero; the chain stays joined on its row.+arrows.forEach((a,i)=>{tw(a.g,{x:l.x(2*i),s:-1},t,2.4,io);tw(a.shaft,{c_stroke:POS},t,2.4,io);tw(a.head,{c_stroke:POS},t,2.4,io);});tw(l.dot,{x:l.x(6)},t,2.4,io);tw(l.circle,{c_fill:POS},t,2.4,io);show(original,m('result'));smCalc(p,-3,'×',-2,6,m('result'),820,55);return {l,arrows,original};}const smBlanks=rows=>(body,api)=>{const ctl=blanks(rows)(body,api),check=ctl.check;ctl.check=()=>{body.querySelectorAll('input.box').forEach(b=>{b.value=b.value.replace(/^\s*\+\s*/,'').replace(/(\d),(?=\d{3}\b)/g,'$1');});check();};return ctl;};-function smArrowOptions(p){return [-2,2,1].map((d,j)=>{const x=310+j*490,g=G(p);smText(g,String.fromCharCode(65+j),x,265,0,30,COL.dim,'middle');path(g,`M${x-160} 500H${x+170}`,{stroke:COL.dim,'stroke-width':2});for(let v=-6;v<=6;v+=2){path(g,`M${x+v*25} 492V508`,{stroke:COL.dim,'stroke-width':2});smText(g,num(v),x+v*25,540,0,23,v===0?COL.chalk:COL.dim,'middle');}const arrows=[];for(let i=0;i<3;i++)arrows.push(smArrow(g,i*d,(i+1)*d,25,400,0,'choice-'+j+'-'+i,x));smText(g,'3 moves of '+(d>0?'+':'')+d,x,600,0,29,smColor(d),'middle');return {el:g,box:[x-215,280,430,360],label:'3 moves of '+d,arrows};});}+function smArrowOptions(p){return [-2,2,1].map((d,j)=>{const x=320+j*480,u=32,g=G(p),letter=String.fromCharCode(65+j);smText(g,letter,x,370,0,36,COL.dim,'middle');path(g,`M${x-205} 520H${x+205}`,{stroke:COL.dim,'stroke-width':2});for(let v=-6;v<=6;v++){path(g,`M${x+v*u} ${v%2?514:510}V${v%2?526:530}`,{stroke:COL.dim,'stroke-width':2});if(v%2===0)smText(g,num(v),x+v*u,565,0,25,v===0?COL.chalk:COL.dim,'middle');}const arrows=[];for(let i=0;i<3;i++)arrows.push(smArrow(g,i*d,(i+1)*d,u,480,0,'choice-'+j+'-'+i,x));return {el:g,box:[x-215,325,430,265],label:'Picture '+letter+': three moves of '+num(d),arrows};});}const BEATS=[['intro','Products, quotients, and signs',(m,D)=>{const g=G(scene,{o:0,y:24});T(g,'Unit 1 · The Number System · Chapter 13',{x:800,y:215,size:28,fill:COL.dim,anchor:'middle'});T(g,'Multiplying and Dividing',{x:800,y:325,size:67,weight:600,anchor:'middle'});T(g,'Positive and Negative Numbers',{x:800,y:420,size:64,weight:600,anchor:'middle'});tw(g,{o:1,y:0},.2,1,out);tokens(g,[{t:'+',fill:POS},' × ',{t:'−',fill:NEG},' ÷'],{x:800,y:565,size:76,anchor:'middle'});smText(g,'Groups · opposites · missing factors',800,685,m('sub'),34,COL.dim,'middle');hide(g,D-.8,.7);}],-['groups','Equal positive groups',m=>{const p=panel(0);smTitle(p,'3 × 4','Three groups · four positive units in each');S.smModel=smRows(p,3,4,1,0,540,270);smText(p,'12 original positive tiles',1100,370,m('count'),31,POS,'middle');const l=smLine(p,0,12,83,620,255);S.smLine=l;smHops(l,3,4,m('total'));smCalc(p,3,'×',4,12,m('count'),810);}],+['groups','Equal positive groups',m=>{const p=panel(0);smTitle(p,'3 × 4','Three groups · four positive units in each');S.smModel=smRows(p,3,4,1,0,540,270);smText(p,'12 positive tiles',1100,370,m('count'),31,POS,'middle');const l=smLine(p,0,12,83,620,255);S.smLine=l;smHops(l,3,4,m('total'));smCalc(p,3,'×',4,12,m('count'),810);}],['signedGroups','Positive groups of negative values',m=>{const p=panel(0);smTitle(p,'3 × (−2)','Three groups · negative two in each');S.smModel=smRows(p,3,2,-1,0,650,250,75,80);const l=smLine(p,-8,8,70,600);S.smLine=l;smHops(l,3,-2,m('move'));smCalc(p,3,'×',-2,-6,m('result'),810);}],['q1','Quick check',()=>{const p=panel(0);smTitle(p,'3 × (−2)','Three rows of two negative tiles');S.smModel=smRows(p,3,2,-1,0,620,240,75,80);const l=smLine(p,-8,8,70,560);S.smLine=l;S.smChoices=[-6,-5,6].map(v=>{const g=G(p,{x:l.x(v),y:l.y});mk('circle',{r:17,fill:COL.board,stroke:COL.task,'stroke-width':3},g);return {el:g,box:[l.x(v)-28,l.y-30,56,60],label:num(v)};});},{ask:done=>quiz(BAND,[{id:'c-negative-groups',prompt:'Choose the endpoint for three negative-two groups.',build:pickEls(S.smChoices,0,'Six negative units total −6. Three groups means three equal moves of −2.',i=>i===1?'Count both negative units in each of the three groups: 3×2=6.':'Each group has negative value. A positive group count does not reverse the sign.',()=>pulseFx(S.smChoices[0].el,1.2))}],done)}],-['opposite','Why a negative multiplier reverses',m=>{const p=panel(0);smTitle(p,'Opposite multipliers need opposite products','Distribute multiplication over a sum.');smEq(p,[smV(3),' + ',smOperand(-3),' = ',smV(0)],0,285,600,64);for(let i=0;i<3;i++){const x=1160+i*95;smTile(p,1,'proof-positive-'+i,x,250,0);smTile(p,-1,'proof-negative-'+i,x,325,0);}smMath(p,'(3 + (−3)) × (−2) = 0',800,420,m('zero',2),49);smMath(p,'3 × (−2) + (−3) × (−2) = 0',800,550,m('split'),47);smEq(p,[smV(-6),' + ','?', ' = ',smV(0)],m('opposite'),690,800,64);smText(p,'The missing product must be +6.',800,820,m('opposite',2),38,POS,'middle');}],+['opposite','Why a negative multiplier reverses',m=>{const p=panel(0);smTitle(p,'Opposite multipliers need opposite products','Distribute multiplication over a sum.');smEq(p,[smV(3),' + ',smOperand(-3),' = ',smV(0)],m('zero'),285,600,64);for(let i=0;i<3;i++){const x=1160+i*95;smTile(p,1,'proof-positive-'+i,x,250,m('zero'));smTile(p,-1,'proof-negative-'+i,x,325,m('zero'));}smMath(p,'(3 + (−3)) × (−2) = 0',800,420,m('zero',3.8),49);smMath(p,'3 × (−2) + (−3) × (−2) = 0',800,550,m('gives'),47);smEq(p,[smV(-6),' + ','?', ' = ',smV(0)],m('opposite'),690,800,64);smText(p,'The missing product must be +6.',800,820,m('opposite',3.4),38,POS,'middle');}],['reverse','Reverse the original directed moves',m=>{const p=panel(0);smTitle(p,'(−3) × (−2)','Opposite of 3 × (−2): reverse direction, preserve length.');S.smReversal=smReversal(p,m);}],['q2','Quick check',()=>{const p=panel(0);smTitle(p,'(−3) × (−2)','Choose the opposite of three −2 moves. Same two-unit arrow length.');S.smChoices=smArrowOptions(p);},{ask:done=>quiz(BAND,[{id:'c-reversed-arrows',prompt:'Which picture represents the reversed product?',build:pickEls(S.smChoices,1,'Picture B reverses each two-unit move: +2,+2,+2 end at +6.',i=>i===0?'Picture A is still 3×(−2). A negative multiplier takes its opposite.':'Picture C reverses direction but changes each length from two units to one. Keep the magnitude.',()=>pulseFx(S.smChoices[1].el,1.04))}],done)}],-['signPairs','Four sign pairs',m=>{const p=panel(0);smTitle(p,'Nonzero factors: same signs +, different signs −');const cases=[[2,3,6,'pp'],[2,-3,-6,'pn'],[-2,3,-6,'np'],[-2,-3,6,'nn']];S.smSignArrows=[];cases.forEach(([a,b,c,k],i)=>{const y=300+i*150,t=m(k);smCalc(p,a,'×',b,c,t,y,49);const x=1230;path(p,`M${x-110} ${y-17}H${x+110}`,{stroke:COL.dim,'stroke-width':1});smText(p,'0',x,y+25,t,24,COL.chalk,'middle');S.smSignArrows.push(smArrow(p,0,c,15,y-17,t,'pair-'+i,x));});}],-['division','Division as a missing factor',m=>{const p=panel(0);smTitle(p,'−12 ÷ 3','Share twelve original negative tiles among three equal groups.');const g=G(p),tiles=[];for(let i=0;i<12;i++)tiles.push(smTile(g,-1,'share-'+i,390+i*68,290,.03*i));for(let j=0;j<3;j++){mk('rect',{x:190+j*430,y:395,width:340,height:240,rx:18,fill:'none',stroke:COL.dim,'stroke-width':2},g);smText(g,'Group '+(j+1),360+j*430,670,0,27,COL.dim,'middle');}tiles.forEach((e,i)=>{const j=i%3,k=Math.floor(i/3);tw(e,{x:320+j*430+(k%2)*80,y:495+Math.floor(k/2)*85},m('share'),1.6,io);});smCalc(p,-12,'÷',3,-4,m('result'),745,54);smCalc(p,3,'×',-4,-12,m('result',2),840,45);S.smDivision={g,tiles};}],-['negativeDivisor','Check a quotient by multiplication',m=>{const p=panel(0);smTitle(p,'A negative divisor: find the missing factor');smCalc(p,-12,'÷',-3,4,0,290,58);smCalc(p,-3,'×',4,-12,m('same',1),390,49);smText(p,'Four groups of −3 total −12',800,460,m('same',2),31,NEG,'middle');for(let r=0;r<4;r++){const x=400+r*265;mk('rect',{x:x-108,y:487,width:216,height:85,rx:13,fill:'none',stroke:COL.dim,'stroke-width':2},p);for(let c=0;c<3;c++)smTile(p,-1,'inverse-'+r+'-'+c,x+(c-1)*60,530,m('same',2));}smCalc(p,12,'÷',-3,-4,m('different'),695,58);smCalc(p,-3,'×',-4,12,m('different',1),800,49);}],+['signPairs','Four sign pairs',m=>{const p=panel(0);smTitle(p,'Nonzero factors: same signs +, different signs −');const cases=[[2,3,6,'pp'],[2,-3,-6,'pn'],[-2,3,-6,'np'],[-2,-3,6,'nn']];S.smSignArrows=[];cases.forEach(([a,b,c,k],i)=>{const y=300+i*150,t=m(k),x=1180,u=35,ax=G(p,{o:0});smCalc(p,a,'×',b,c,t,y,49,620);path(ax,`M${x-235} ${y-17}H${x+235}`,{stroke:COL.dim,'stroke-width':2});for(let v=-6;v<=6;v++)path(ax,`M${x+v*u} ${y-(v?24:28)}V${y-(v?10:6)}`,{stroke:v?COL.dim:COL.chalk,'stroke-width':2});T(ax,'0',{x,y:y+22,size:24,anchor:'middle',fill:COL.chalk});show(ax,t);S.smSignArrows.push(smArrow(p,0,c,u,y-17,t,'pair-'+i,x));});}],+['division','Division as a missing factor',m=>{const p=panel(0);smTitle(p,'−12 ÷ 3','Share twelve negative tiles among three groups.');const g=G(p),tiles=[];for(let i=0;i<12;i++)tiles.push(smTile(g,-1,'share-'+i,390+i*68,290,.03*i));for(let j=0;j<3;j++){mk('rect',{x:230+j*430,y:440,width:260,height:195,rx:18,fill:'none',stroke:COL.dim,'stroke-width':2},g);smText(g,'Group '+(j+1),360+j*430,670,0,27,COL.dim,'middle');}tiles.forEach((e,i)=>{const j=i%3,k=Math.floor(i/3);tw(e,{x:320+j*430+(k%2)*80,y:495+Math.floor(k/2)*85},m('share'),1.6,io);});smCalc(p,-12,'÷',3,-4,m('result'),745,54);smCalc(p,3,'×',-4,-12,m('result',2),840,45);S.smDivision={g,tiles};}],+['negativeDivisor','Check a quotient by multiplication',m=>{const p=panel(0);smTitle(p,'A negative divisor: find the missing factor');smAsk(p,[smV(-12),' ÷ ',smOperand(-3),' = ','?'],smV(4),0,m('four'),290,800,58);smAsk(p,[smOperand(-3),' × ','?',' = ',smV(-12)],smV(4),m('same',2.5),m('four'),390,800,49);smText(p,'Four groups of −3 total −12',800,460,m('groups'),31,NEG,'middle');const boxes=G(p,{o:0});show(boxes,m('groups'));for(let r=0;r<4;r++){const x=400+r*265;mk('rect',{x:x-108,y:487,width:216,height:85,rx:13,fill:'none',stroke:COL.dim,'stroke-width':2},boxes);for(let c=0;c<3;c++)smTile(p,-1,'inverse-'+r+'-'+c,x+(c-1)*60,530,m('groups'));}smAsk(p,[smV(12),' ÷ ',smOperand(-3),' = ','?'],smV(-4),m('different'),m('neg4'),695,800,58);smAsk(p,[smOperand(-3),' × ','?',' = ',smV(12)],smOperand(-4),m('different',2.5),m('neg4'),800,800,49);}],['q3','Quick check',()=>{const p=panel(0);smTitle(p,'−15 ÷ (−5) = ?','The divisor is −5. Which picture shows groups of −5 totaling −15?');S.smChoices=[[-1,3,5],[1,3,5],[-1,5,3]].map(([sign,n,k],j)=>{const x=320+j*490,g=G(p);smText(g,String.fromCharCode(65+j),x,230,0,28,COL.dim,'middle');for(let r=0;r<n;r++){mk('rect',{x:x-165,y:260+r*72,width:330,height:65,rx:12,fill:'none',stroke:COL.dim,'stroke-width':1},g);for(let c=0;c<k;c++)smTile(g,sign,'q3-'+j+'-'+r+'-'+c,x+(c-(k-1)/2)*60,292+r*72);}smText(g,n+' groups of '+(sign>0?'+':'−')+k,x,650,0,28,smColor(sign),'middle');return {el:g,box:[x-185,250,370,375],label:n+' groups of '+sign*k};});},{ask:done=>quiz(BAND,[{id:'c-division-factor',prompt:'Choose the picture that checks (−5) × quotient = −15.',build:pickEls(S.smChoices,0,'Three groups each worth −5 total −15, so the quotient is +3.',i=>i===1?'Three groups of +5 total +15. The divisor and dividend here are negative.':'Five groups of −3 total −15, but each group must have value −5, the divisor.',()=>pulseFx(S.smChoices[0].el,1.03))}],done)}],-['magnitude','Compute magnitude, then sign',m=>{const p=panel(0);smTitle(p,'Signed fractions and decimals follow the same rule');smCalc(p,-1.5,'×',4,-6,0,280,53);smText(p,'Magnitude: 1.5 × 4 = 6',800,360,m('decimal'),31,COL.task,'middle');const l=smLine(p,-6,6,85,530);S.smLine=l;smHops(l,4,-1.5,m('decimal',2));smCalc(p,-18,'÷',6,-3,m('divide'),730,56);smText(p,'Magnitude: 18 ÷ 6 = 3 · different signs → negative',800,825,m('divide'),29,COL.task,'middle');}],-['parity','Pair the negative reversals',m=>{const p=panel(0);smTitle(p,'Count negative factors only for NONZERO results');smCalc(p,-2,'×',-4,8,0,275,48);const row=tokens(p,[smOperand(-2),' × ',smV(3),' × ',smOperand(-4)],{x:800,y:415,size:65,anchor:'middle'});row.forEach(e=>{put(e,{o:0});show(e,m('pair'))});const ring=G(p,{o:0});for(const e of [row[0],row[4]])mk('rect',{x:e._px-70,y:335,width:140,height:115,rx:18,fill:'none',stroke:COL.chalk,'stroke-width':3,'stroke-dasharray':'8 6'},ring);show(ring,m('pair'));smText(p,'2 negative factors: even → +24',800,545,m('pair',2),37,POS,'middle');smMath(p,'(−2) × 3 × (−4) × (−1)',800,690,m('odd'),56);smText(p,'3 negative factors: odd → −24',800,810,m('odd',2),37,NEG,'middle');}],+['magnitude','Compute magnitude, then sign',m=>{const p=panel(0);smTitle(p,'Signed fractions and decimals follow the same rule');smAsk(p,[smOperand(-1.5),' × ',smV(4),' = ','?'],smV(-6),0,m('sign'),280,470,53);smText(p,'Magnitude: 1.5 × 4 = 6',470,365,m('decimal',2.5),31,COL.task,'middle');smCalc(p,4,'×',-1.5,-6,m('order'),280,53,1130);const l=smLine(p,-6,6,85,570);S.smLine=l;smHops(l,4,-1.5,m('order',1.5));smAsk(p,[smV(-18),' ÷ ',smV(6),' = ','?'],smV(-3),m('divide'),m('sign2',2),730,800,56);smText(p,'Magnitude: 18 ÷ 6 = 3',560,825,m('divide',2),31,COL.task,'middle');smText(p,'Different signs → negative',1060,825,m('sign2'),31,NEG,'middle');}],+['parity','Pair the negative reversals',m=>{const p=panel(0);smTitle(p,'Count negative factors only for NONZERO results');const row=tokens(p,[smOperand(-2),' × ',smV(3),' × ',smOperand(-4)],{x:800,y:370,size:65,anchor:'middle'});row.forEach(e=>{put(e,{o:0});show(e,m('pair'))});const ring=G(p,{o:0});for(const e of [row[0],row[4]])mk('rect',{x:e._px-e._w/2-10,y:290,width:e._w+20,height:115,rx:18,fill:'none',stroke:COL.chalk,'stroke-width':3,'stroke-dasharray':'8 6'},ring);show(ring,m('pair'));smText(p,'2 negative factors: even → +24',800,500,m('pair',9.6),37,POS,'middle');smMath(p,'(−2) × 3 × (−4) × (−1)',800,650,m('odd'),56);smText(p,'3 negative factors: odd → −24',800,775,m('odd',4.5),37,NEG,'middle');}],['chain','Equal priority: left to right',m=>{const p=panel(0);smTitle(p,'Multiplication and division have EQUAL priority');const r=tokens(p,[smV(-24),' ÷ ',smOperand(-3),' × ',smOperand(-2)],{x:800,y:275,size:61,anchor:'middle'});const first=G(p,{o:0});const bx=r[0]._px-r[0]._w/2-16,bw=r[2]._px+r[2]._w/2-bx+16;mk('rect',{x:bx,y:202,width:bw,height:95,rx:14,fill:'none',stroke:COL.chalk,'stroke-width':2,'stroke-dasharray':'7 5'},first);show(first,m('first'));hide(first,m('next'),.2);S.smChain={tokens:r,first,bx,bw};smCalc(p,-24,'÷',-3,8,m('first'),390,51);smCalc(p,8,'×',-2,-16,m('next'),495,51);smText(p,'Parentheses change the grouping:',800,595,m('parentheses'),29,COL.dim,'middle');smMath(p,'−24 ÷ ((−3) × (−2))',800,685,m('parentheses'),54);smCalc(p,-24,'÷',6,-4,m('parentheses',3),805,54);}],['zero','Zero is neither positive nor negative',m=>{const p=panel(0);smTitle(p,'Zero is a value, not a positive sign');smCalc(p,-7,'×',0,0,0,315,65);for(let j=0;j<7;j++){mk('rect',{x:280+j*150,y:375,width:125,height:100,rx:15,fill:'none',stroke:COL.dim,'stroke-width':2},p);smText(p,'0',342.5+j*150,435,m('product'),30,COL.chalk,'middle');}smText(p,'Seven empty groups total 0; the opposite of 0 is 0',800,550,m('product'),29,COL.chalk,'middle');smCalc(p,0,'÷',-5,0,m('dividend'),695,61);smCalc(p,-5,'×',0,0,m('dividend',1.5),820,49);}],['divideZero','Division by zero is undefined',m=>{const p=panel(0);smTitle(p,'A divisor of zero never gives a unique quotient');smMath(p,'9 ÷ 0 : 0 × ? = 9',800,300,0,64);smText(p,'No number works.',800,390,m('impossible'),36,COL.dim,'middle');smMath(p,'0 ÷ 0 : 0 × ? = 0',800,550,m('many'),64);smText(p,'Every number works; no unique answer.',800,640,m('many'),34,COL.dim,'middle');smText(p,'Both are UNDEFINED.',800,815,m('undefined'),47,COL.chalk,'middle');}],-['loss','Signed loss or positive amount?',m=>{const p=panel(0);smTitle(p,'Six equal daily changes of −$8','Each original segment represents one day. Scale: 16 px per dollar.');const g=G(p),segments=[];for(let i=0;i<6;i++){const e=G(g,{x:190+i*207,y:300});mk('rect',{width:128,height:70,rx:9,fill:mix(COL.board,NEG,.45),stroke:NEG,'stroke-width':2},e);smText(e,'Day '+(i+1),64,-20,0,25,COL.dim,'middle');smText(e,'−$8',64,45,0,29,NEG,'middle');e.dataset.dayId='day-'+i;segments.push(e);tw(e,{x:416+i*128,y:435},m('total'),1.4,io);}smCalc(p,6,'×',-8,-48,m('total'),625,51);smCalc(p,-48,'÷',6,-8,m('daily'),725,51);smText(p,'Daily signed change: −$8',800,805,m('daily'),31,NEG,'middle');smText(p,'Amount lost each day: $8',800,865,m('amount'),31,COL.task,'middle');S.smLoss={g,segments};}],-['wrap','Keep four ideas together',m=>{const p=panel(0);smTitle(p,'Multiply and divide signed values with a reason');[['Nonzero: same signs +; different signs −.','w1'],['Negative multiplier: opposite. Division: missing factor.','w2'],['Nonzero sign count: even +; odd −.','w3'],['Zero separately; no division by 0; × and ÷ left to right.','w4']].forEach(([s,k],i)=>{const g=G(p,{x:-16,y:270+i*145,o:0});mk('circle',{cx:130,cy:-10,r:26,fill:COL.task},g);T(g,String(i+1),{x:130,y:0,size:30,anchor:'middle',fill:COL.board});T(g,s,{x:195,size:31});tw(g,{x:0,o:1},m(k),.6);});}],+['loss','Signed loss or positive amount?',m=>{const p=panel(0);smTitle(p,'Six equal daily changes of −$8','Each block is one day.');const g=G(p),segments=[];for(let i=0;i<6;i++){const e=G(g,{x:190+i*207,y:300});mk('rect',{width:128,height:70,rx:9,fill:mix(COL.board,NEG,.45),stroke:NEG,'stroke-width':2},e);smText(e,'Day '+(i+1),64,-20,0,25,COL.dim,'middle');smText(e,'−$8',64,45,0,29,NEG,'middle');e.dataset.dayId='day-'+i;segments.push(e);tw(e,{x:416+i*128,y:435},m('total'),1.4,io);}smCalc(p,6,'×',-8,-48,m('total'),625,51);smCalc(p,-48,'÷',6,-8,m('daily'),725,51);smText(p,'Daily signed change: −$8',800,805,m('daily'),31,NEG,'middle');smText(p,'Amount lost each day: $8',800,865,m('amount'),31,COL.task,'middle');S.smLoss={g,segments};}],+['wrap','Keep four ideas together',m=>{const p=panel(0);smTitle(p,'Multiply and divide signed values with a reason');[['Nonzero: same signs +; different signs −.','w1'],['Negative multiplier: opposite. Division: missing factor.','w2'],['Nonzero sign count: even +; odd −.','w3'],['Zero separately; no division by 0; × and ÷ left to right.','w4']].forEach(([s,k],i)=>{const g=G(p,{x:-16,y:300+i*155,o:0});mk('circle',{cx:130,cy:-11,r:28,fill:COL.task},g);T(g,String(i+1),{x:130,y:0,size:32,anchor:'middle',fill:COL.board});T(g,s,{x:195,size:36});tw(g,{x:0,o:1},m(k),.6);});}],['final1','Chapter practice',()=>panel(0),{ask:done=>quiz(SCREEN,[{id:'p-multiply-signs',prompt:'Multiply with all four sign pairs.',build:smBlanks([{parts:['6 × 7 = ',{box:'42'}],why:'Positive times positive is positive; 6×7=42.'},{parts:['6 × (−7) = ',{box:'-42'}],why:'Different signs: negative. The magnitude is 42.'},@@ -47,7 +50,7 @@ const BEATS=[{parts:['45 ÷ (−5) = ',{box:'-9'}],why:'(−5)×(−9)=45.'},{parts:['−45 ÷ 5 = ',{box:'-9'}],why:'5×(−9)=−45.'},{parts:['−45 ÷ (−5) = ',{box:'9'}],why:'(−5)×9=−45.'}-])}],done,'Chapter practice 1 of 3')}],+])}],done,'Chapter practice · set 1 of 3')}],['final2','Chapter practice',()=>panel(0),{ask:done=>quiz(SCREEN,[{id:'p-chains',prompt:'Use nonzero sign parity, left-to-right order, and parentheses.',build:smBlanks([{parts:['(−2) × (−3) × (−4) = ',{box:'-24'}],why:'Three negative factors: odd gives negative; magnitude 2×3×4=24.'},{parts:['−36 ÷ (−3) × (−2) = ',{box:'-24'}],why:'Left to right: −36÷(−3)=12; 12×(−2)=−24.'},@@ -58,14 +61,14 @@ const BEATS=[{parts:['0 ÷ (−8)'],ans:['z'],why:'The divisor is nonzero: (−8)×0=0, so the quotient is zero.'},{parts:['−8 ÷ 0'],ans:['u'],why:'No number multiplied by zero gives −8. Division by zero is undefined.'},{parts:['0 ÷ 0'],ans:['u'],why:'Every number multiplied by zero gives zero; no unique quotient. Undefined.'}-],[['p','positive',POS],['n','negative',NEG],['z','zero',COL.chalk],['u','undefined',COL.dim]],{multi:false})}],done,'Chapter practice 2 of 3')}],+],[['p','positive',POS],['n','negative',NEG],['z','zero',COL.chalk],['u','undefined',COL.dim]],{multi:false})}],done,'Chapter practice · set 2 of 3')}],['final3','Chapter practice',()=>panel(0),{ask:done=>quiz(SCREEN,[{id:'p-depth',prompt:'A camera starts at sea level (0 m). Its height changes by −3 m each second for 7 seconds.',build:smBlanks([-{parts:['Signed position = ',{box:'-21'},' m'],why:'7×(−3)=−21m relative to sea level.'},-{parts:['Positive depth below sea level = ',{box:'21'},' m'],why:'The distance below sea level is the magnitude, 21m.'}+{parts:['Signed position = ',{box:'-21'},' m'],why:'7×(−3)=−21, so −21 m relative to sea level.'},+{parts:['Positive depth below sea level = ',{box:'21'},' m'],why:'The distance below sea level is the magnitude, 21 m.'}])},{id:'p-loss',prompt:'A shop has a total signed change of −$63 over 7 days, with the same loss each day.',build:smBlanks([{parts:['Daily signed change = $ ',{box:'-9'}],why:'−63÷7=−9 dollars per day.'},{parts:['Positive amount lost each day = $ ',{box:'9'}],why:'The daily loss amount is the magnitude, 9 dollars.'}-])}],done,'Chapter practice 3 of 3')}],+])}],done,'Chapter practice · set 3 of 3')}],['finish','Finished',()=>panel(0),{ask:finishCard}]].map(([id,title,run,extra])=>({id,title,run,...extra}));boot();diff --git a/site/math-notebook/ch14/index.html b/site/math-notebook/ch14/index.htmlindex 9faf0fd..84edc8a 100644--- a/site/math-notebook/ch14/index.html+++ b/site/math-notebook/ch14/index.html@@ -10,35 +10,35 @@ const iqTitle=(p,s,sub='')=>{iqText(p,s,100,110,.1,43);if(sub)iqText(p,sub,100,1function iqLine(p,lo=-4,hi=4,u=160,y=520,o=800,step=1,labels=null){const g=G(p),x=v=>o+v*u;path(g,`M${x(lo)-15} ${y}H${x(hi)+15}`,{stroke:COL.chalk,'stroke-width':3});path(g,`M${x(lo)-5} ${y-7}L${x(lo)-15} ${y}L${x(lo)-5} ${y+7} M${x(hi)+5} ${y-7}L${x(hi)+15} ${y}L${x(hi)+5} ${y+7}`,{stroke:COL.chalk,'stroke-width':2,fill:'none'});for(let i=0;i<=Math.round((hi-lo)/step);i++){const v=lo+i*step;path(g,`M${x(v)} ${y-8}V${y+8}`,{stroke:COL.dim,'stroke-width':2});T(g,labels?labels(i,v):num(Number(v.toFixed(6))),{x:x(v),y:y+48,size:27,anchor:'middle',font:MATH,fill:Math.abs(v)<1e-10?COL.chalk:COL.dim});}return {g,x,lo,hi,u,y,o};}function iqPoint(l,v,label=num(v),t=0,dy=-55,size=40,id='point'){const g=G(l.g,{x:l.x(v),y:l.y,o:0});g.dataset.pointId=id;g.dataset.value=v;const c=mk('circle',{r:11,fill:iqColor(v)},g);if(label!==null)M(g,Array.isArray(label)?label:[label],{x:0,y:dy,size,anchor:'middle',fill:iqColor(v)});show(g,t,.5);return {g,c,v};}function iqComparison(p,a,sym,b,t=0,y=790,size=64){return tokens(p,[{t:a,fill:rat(a)?iqColor(rat(a)[0]):COL.chalk},' '+sym+' ',{t:b,fill:rat(b)?iqColor(rat(b)[0]):COL.chalk}],{x:800,y,size,anchor:'middle'}).map(e=>{put(e,{o:0});show(e,t);return e;});}-function iqDistance(l,v,t=0,y=340){const g=G(l.g,{o:0});const a=l.x(v),b=l.x(0);path(g,`M${a} ${y}H${b} M${a} ${y-8}V${y+8} M${b} ${y-8}V${y+8}`,{stroke:COL.task,'stroke-width':4});T(g,Math.abs(v)+' units',{x:(a+b)/2,y:y-25,size:28,fill:COL.task,anchor:'middle'});show(g,t);return g;}-function iqFractionModel(p){const l=iqLine(p,-1,0,1200,650,1400,.25),rows=[];for(const [n,den,y] of [[3,4,300],[3,5,470]]){const g=G(p),cells=[];for(let i=0;i<den;i++){const c=mk('rect',{x:200+i*1200/den,y,width:1200/den,height:70,fill:i>=den-n?mix(COL.board,NEG,.45):COL.board,stroke:COL.chalk,'stroke-width':2},g);c.dataset.cellId=`whole-${den}-${i}`;cells.push(c);}iqMath(g,['−',F(3,den)],130,y+45,0,40,NEG);rows.push({g,cells,den,y});}const pts=[iqPoint(l,-.75,['−',F(3,4)],0,-55,40,'fraction-fourths'),iqPoint(l,-.6,['−',F(3,5)],0,100,40,'fraction-fifths')];return {l,rows,pts};}+function iqDistance(l,v,t=0,y=340){const g=G(l.g,{o:0});const a=l.x(v),b=l.x(0);path(g,`M${a} ${y}H${b} M${a} ${y-8}V${y+8} M${b} ${y-8}V${y+8}`,{stroke:COL.task,'stroke-width':4});path(g,`M${a} ${y+8}V${l.y-16} M${b} ${y+8}V${l.y-16}`,{stroke:COL.task,'stroke-width':2,'stroke-dasharray':'6 6'});T(g,Math.abs(v)+' units',{x:(a+b)/2,y:y-25,size:28,fill:COL.task,anchor:'middle'});show(g,t);return g;}+function iqFractionModel(p,pt=0){const l=iqLine(p,-1,0,1200,650,1400,.25),rows=[];for(const [n,den,y] of [[3,4,270],[3,5,440]]){const g=G(p),cells=[];for(let i=0;i<den;i++){const c=mk('rect',{x:200+i*1200/den,y,width:1200/den,height:70,fill:i>=den-n?mix(COL.board,NEG,.45):COL.board,stroke:COL.chalk,'stroke-width':2},g);c.dataset.cellId=`whole-${den}-${i}`;cells.push(c);}iqMath(g,['−',F(3,den)],125,y+52,0,60,NEG);rows.push({g,cells,den,y});}const pts=[iqPoint(l,-.75,['−',F(3,4)],pt,-45,60,'fraction-fourths'),iqPoint(l,-.6,['−',F(3,5)],pt,105,60,'fraction-fifths')];return {l,rows,pts};}function iqSubdivide(model,t){const cuts=[];for(const row of model.rows)for(let i=1;i<20;i++)if(i%(20/row.den)){const e=path(row.g,`M${200+i*60} ${row.y}V${row.y+70}`,{stroke:COL.dim,'stroke-width':1.5},{d:0});draw(e,t,.9);cuts.push(e);}return cuts;}-function iqRegion(l,bound,dir,closed,t=0){const x=l.x(bound),edge=l.x(dir<0?l.lo:l.hi),g=G(l.g),r=mk('rect',{x,y:l.y-10,width:0,height:20,fill:COL.task,opacity:.3},g);put(r,{a_x:x,a_width:0});tw(r,{a_x:Math.min(x,edge),a_width:Math.abs(edge-x)},t,1.4,lin);const arrow=path(g,`M${edge-dir*15} ${l.y-10}L${edge} ${l.y}L${edge-dir*15} ${l.y+10}`,{stroke:COL.task,'stroke-width':4,fill:'none'},{o:0});show(arrow,t+1.2);const c=mk('circle',{cx:x,cy:l.y,r:13,fill:closed?COL.task:COL.board,stroke:COL.task,'stroke-width':4},g);g.dataset.bound=bound;g.dataset.closed=String(closed);g.dataset.direction=dir;return {g,r,c,bound,dir,closed};}+function iqRegion(l,bound,dir,closed,t=0,ct=t){const x=l.x(bound),edge=l.x(dir<0?l.lo:l.hi),g=G(l.g),r=mk('rect',{x,y:l.y-10,width:0,height:20,fill:COL.task,opacity:.3},g);put(r,{a_x:x,a_width:0});tw(r,{a_x:Math.min(x,edge),a_width:Math.abs(edge-x)},t,1.4,lin);const arrow=path(g,`M${edge-dir*15} ${l.y-10}L${edge} ${l.y}L${edge-dir*15} ${l.y+10}`,{stroke:COL.task,'stroke-width':4,fill:'none'},{o:0});show(arrow,t+1.2);const c=mk('circle',{cx:x,cy:l.y,r:13,fill:closed?COL.task:COL.board,stroke:COL.task,'stroke-width':4},g);put(c,{o:0});show(c,ct);g.dataset.bound=bound;g.dataset.closed=String(closed);g.dataset.direction=dir;return {g,r,c,bound,dir,closed};}const iqNorm=s=>String(s).trim().replace(/^\+\s*/,'').replace(/(\d),(?=\d{3}\b)/g,'$1');const iqCmp=(a,b)=>{const d=BigInt(a[0])*BigInt(b[1])-BigInt(b[0])*BigInt(a[1]);return d<0n?-1:d>0n?1:0;};function iqQualify(values,bound,dir){const rs=values.map(v=>rat(iqNorm(v)));return rs.every(Boolean)&&rs.every(r=>dir<0?iqCmp(r,bound)<=0:iqCmp(r,bound)<0)&&rs.every((r,i)=>rs.slice(0,i).every(q=>iqCmp(r,q)!==0));}// Exact rational membership uses original typed numerators/denominators, never floating division.-const iqTriplets=rows=>(body,api)=>{body.classList.add('blanks','triplets');const built=rows.map(it=>{const line=h('div','bline'),mark=h('span','mark'),why=h('div','why');line.append(mathEl(it.parts,32));const boxes=it.answers.map(a=>{const b=h('input','box');Object.assign(b,{type:'text',inputMode:'decimal',autocomplete:'off',spellcheck:false});b.dataset.ans=a;b.setAttribute('aria-label','Distinct qualifying value');line.append(b);return b;});line.append(mark);body.append(h('div','brow',[line,why]));return {it,boxes,mark,why};});const judge=r=>{const ok=iqQualify(r.boxes.map(b=>b.value),r.it.bound,r.it.dir);r.boxes.forEach(b=>{b.classList.toggle('good',ok);b.classList.toggle('bad',!ok)});r.mark.className='mark '+(ok?'good':'bad');r.mark.textContent=ok?'✓':'✗';r.why.replaceChildren(ok?'':rich(r.it.hint,20));return ok;};const all=built.flatMap(r=>r.boxes);requestAnimationFrame(()=>all[0].focus({preventScroll:true}));return {check(){const right=built.filter(judge).length;api.grade(right===built.length,right===built.length?'Every value meets its condition, and each row has three distinct values.':`${right} of ${built.length} right. Check the condition and distinctness in each row.`,{right,total:built.length});},reveal(){built.forEach(r=>{r.boxes.forEach((b,i)=>b.value=r.it.answers[i]);judge(r);r.why.replaceChildren(rich(r.it.why,20))});return 'One possible set is shown. Other distinct qualifying values work too.';},lock(){all.forEach(b=>b.disabled=true)},hint:['type integers, decimals, or fractions; ',kbd('Tab'),' next box, ',kbd('Enter'),' check, ',kbd('Esc'),' leave the box']};};+const iqTriplets=rows=>(body,api)=>{body.classList.add('blanks','triplets');const built=rows.map(it=>{const line=h('div','bline'),mark=h('span','mark'),why=h('div','why');line.append(mathEl(it.parts,32));const boxes=it.answers.map(a=>{const b=h('input','box');Object.assign(b,{type:'text',inputMode:'decimal',autocomplete:'off',spellcheck:false});b.dataset.ans=a;b.setAttribute('aria-label','Distinct qualifying value');line.append(b);return b;});line.append(mark);body.append(h('div','brow',[line,why]));return {it,boxes,mark,why};});const judge=r=>{const ok=iqQualify(r.boxes.map(b=>b.value),r.it.bound,r.it.dir);r.boxes.forEach(b=>{b.classList.toggle('good',ok);b.classList.toggle('bad',!ok)});r.mark.className='mark '+(ok?'good':'bad');r.mark.textContent=ok?'✓':'✗';r.why.replaceChildren(ok?'':rich(r.it.hint,20));return ok;};const all=built.flatMap(r=>r.boxes);requestAnimationFrame(()=>all[0].focus({preventScroll:true}));return {check(){const right=built.filter(judge).length;api.grade(right===built.length,right===built.length?'Every value fits its condition, and each row has three different values.':`${right} of ${built.length} right. Check the condition, and use three different values in each row.`,{right,total:built.length});},reveal(){built.forEach(r=>{r.boxes.forEach((b,i)=>b.value=r.it.answers[i]);judge(r);r.why.replaceChildren(rich(r.it.why,20))});return 'One possible set is shown. Other different values that fit work too.';},lock(){all.forEach(b=>b.disabled=true)},hint:['type integers, decimals, or fractions; ',kbd('Tab'),' next box, ',kbd('Enter'),' check, ',kbd('Esc'),' leave the box']};};const iqOrderCols=[['l','<',COL.chalk],['e','=',COL.chalk],['g','>',COL.chalk]],iqTruthCols=[['t','true',COL.chalk],['f','false',COL.dim]];const BEATS=[['intro','Inequalities',(m,D)=>{const g=G(scene,{o:0,y:24});T(g,'Unit 1 · The Number System · Chapter 14',{x:800,y:230,size:28,fill:COL.dim,anchor:'middle'});T(g,'Inequalities',{x:800,y:370,size:86,weight:600,anchor:'middle'});M(g,['< > ≠ ≤ ≥'],{x:800,y:550,size:88,anchor:'middle',fill:COL.task});tw(g,{o:1,y:0},.2,1,out);iqText(g,'Compare positions · describe possibilities',800,700,m('sub'),35,COL.dim,'middle');hide(g,D-.8,.7);}],-['order','Left is smaller; right is greater',m=>{const p=panel(0);iqTitle(p,'Position explains the comparison');const l=iqLine(p,-4,6,115,530,660);S.iqLine=l;S.iqPoints=[iqPoint(l,-3,'−3',m('points')),iqPoint(l,5,'5',m('points'))];iqText(p,'← smaller',250,300,m('compare'),37,COL.task);iqText(p,'greater →',1320,300,m('compare'),37,COL.task,'end');iqComparison(p,'−3','<','5',m('compare'));iqText(p,'point toward the smaller value · open toward the greater',800,875,m('mouth'),27,COL.dim,'middle');}],+['order','Left is smaller; right is greater',m=>{const p=panel(0);iqTitle(p,'Position explains the comparison');const l=iqLine(p,-4,6,115,530,660);S.iqLine=l;S.iqPoints=[iqPoint(l,-3,'−3',.4),iqPoint(l,5,'5',.4)];iqText(p,'← smaller',250,300,m('compare'),37,COL.task);iqText(p,'greater →',1320,300,m('compare'),37,COL.task,'end');iqComparison(p,'−3','<','5',m('compare'));iqText(p,'point toward the smaller value · open toward the greater',800,875,m('mouth'),27,COL.dim,'middle');}],['reverse','Same order, reversed sentence',m=>{const p=panel(0);iqTitle(p,'The values stay in place');const l=iqLine(p,-4,6,115,560,660);iqPoint(l,-3,'−3',0);iqPoint(l,5,'5',0);const a=G(p,{x:580,y:300}),b=G(p,{x:1020,y:300}),s=G(p,{x:800,y:275});M(a,['−3'],{size:70,anchor:'middle',fill:NEG});M(b,['5'],{size:70,anchor:'middle',fill:POS});M(s,['<'],{y:25,size:82,anchor:'middle'});tw(a,{y:230},m('swap'),.5);tw(b,{y:390},m('swap'),.5);tw(a,{x:1020},m('swap',.5),1.4);tw(b,{x:580},m('swap',.5),1.4);tw(a,{y:300},m('swap',1.9),.5);tw(b,{y:300},m('swap',1.9),.5);hide(s,m('swap'),.15);show(s,m('sign'),.15);tw(s,{r:180},m('sign'),.7);iqMath(p,'−3 < 5 means 5 > −3',800,805,m('same'),53);S.iqSwap={a,b,s,l};}],-['negatives','Distance is not signed order',m=>{const p=panel(0);iqTitle(p,'−7 and −2','A larger negative magnitude sits farther left.');const l=iqLine(p,-8,2,118,610,1110);S.iqLine=l;iqPoint(l,-7,'−7',0);iqPoint(l,-2,'−2',0);iqDistance(l,-7,m('distance'),300);iqDistance(l,-2,m('distance',1),415);iqComparison(p,'−7','<','−2',m('order'),785);iqMath(p,'negative < 0 < positive',800,875,m('zero'),36);}],-['q1','Quick check',()=>{const p=panel(0);iqTitle(p,'Which temperature is warmer?','Temperatures rise toward the right. Units: °C.');const l=iqLine(p,-10,0,115,500,1380);S.iqChoices=[-9,-4,0].map(v=>{const e=iqPoint(l,v,num(v)+'°',0,-70,44,'temperature-'+v);return {el:e.g,box:[l.x(v)-35,410,70,120],label:num(v)+' degrees Celsius'};});},{ask:done=>quiz(BAND,[{id:'c-temperature',prompt:'Choose the warmer temperature: −9°C or −4°C.',build:pickEls(S.iqChoices,1,'−4°C is warmer: −4 is greater than −9 and lies farther right.',i=>i===0?'A nine-degree distance below zero is colder than four degrees below zero.':'Zero is warmer than both, but it is not one of the two given temperatures.')}],done)}],-['decimals','Compare equal place sizes',m=>{const p=panel(0);iqTitle(p,'A zoomed decimal line','Enlarged interval 2.30–2.40 · one small interval = 0.01');const l=iqLine(p,2.3,2.4,12000,540,-27400,.01,(_,v)=>v.toFixed(2));S.iqLine=l;iqPoint(l,2.34,'2.34',m('points'),-90,43);iqPoint(l,2.37,'2.37',m('points'),-90,43);iqComparison(p,'2.34','<','2.37',m('compare'),755);iqMath(p,'2.340 = 2.34',800,855,m('equal'),46);}],-['fractions','Fractions on the same unit',m=>{const p=panel(0);iqTitle(p,'Compare −3/4 and −3/5','Both rows: the same unit from −1 to 0; shaded distance extends left from zero.');const model=iqFractionModel(p);S.iqFraction=model;model.rows.forEach(r=>{put(r.g,{o:0});show(r.g,m('parts'))});model.pts.forEach(e=>{put(e.g,{o:0});show(e.g,m('points'))});iqMath(p,['−',F(3,4),' < −',F(3,5)],800,850,m('points',2),48);}],-['repartition','Equal-sized twentieths',m=>{const p=panel(0);iqTitle(p,'Subdivide without changing either value','Each original fourth → 5 pieces · each original fifth → 4 pieces');S.iqFraction=iqFractionModel(p);S.iqCuts=iqSubdivide(S.iqFraction,m('cuts'));iqMath(p,['−',F(3,4),' = −',F(15,20)],800,250,m('labels'),44);iqMath(p,['−',F(3,5),' = −',F(12,20)],800,435,m('labels',1),44);iqMath(p,['−',F(15,20),' < −',F(12,20)],800,855,m('compare'),48);}],-['q2','Quick check',()=>{const p=panel(0);iqTitle(p,'Choose the greater fraction','A point farther right has the greater value.');const l=iqLine(p,-1,0,1200,500,1400,.25);S.iqChoices=[[-.8,['−',F(4,5)],'−4/5'],[-.75,['−',F(3,4)],'−3/4']].map(([v,label,name],i)=>{const e=iqPoint(l,v,label,0,i===0?-120:110,43,'fraction-choice-'+i);if(i===1)put(e.g.querySelector('g'),{x:80});path(l.g,i===0?`M${l.x(v)} 425V482`:`M${l.x(v)} 518L${l.x(v)+80} 550V563`,{stroke:iqColor(v),'stroke-width':2});return {el:e.g,box:[l.x(v)-45+(i===1?80:0),i===0?335:560,90,95],label:name};});},{ask:done=>quiz(BAND,[{id:'c-negative-fractions',prompt:'Choose the greater value: −4/5 or −3/4.',build:pickEls(S.iqChoices,1,'−3/4 is greater. Exactly, −15/20 > −16/20; its point is farther right.',()=> 'Four fifths is a larger distance from zero. On the negative side, that puts −4/5 farther left.')}],done)}],-['notEqual','Different values, not different writing',m=>{const p=panel(0);iqTitle(p,'≠ means “not equal”');const l=iqLine(p,-2,3,220,480,690);iqPoint(l,-1,'−1',0);iqPoint(l,2,'2',0);iqComparison(p,'−1','≠','2',m('different'),280);iqMath(p,'2 ≠ −1',1190,350,m('different',2),40);const low=iqLine(p,0,1,800,740,400,.25);const half=iqPoint(low,.5,[F(1,2)],m('equal'),-55,43,'equivalent-half');const dec=G(p,{x:1250,y:670,o:0});M(dec,['0.5'],{size:43,fill:POS,anchor:'middle'});show(dec,m('equal'));tw(dec,{x:800,y:835},m('equal',2),1.5);iqText(p,'same point, equal value',1050,835,m('equal',4),27,COL.dim);S.iqEqual={low,half,dec};}],-['inclusive','At most two',m=>{const p=panel(0);iqTitle(p,'x ≤ 2','x is a placeholder. Every real value at most 2 qualifies.');const l=iqLine(p,-4,4,160,500);S.iqRegion=iqRegion(l,2,-1,true,m('region'));iqMath(p,'x ≤ 2',800,300,0,67);iqText(p,'2 is included',1120,395,m('endpoint'),32,COL.task,'middle');iqPoint(l,1.5,'1.5',m('candidates'),95,35);iqPoint(l,-1,'−1',m('candidates'),-65,38);iqPoint(l,2.5,'2.5',m('candidates'),-65,35);iqText(p,'qualifies',l.x(1.5),655,m('candidates'),26,COL.task,'middle');iqText(p,'does not',l.x(2.5),355,m('candidates'),26,COL.dim,'middle');iqText(p,'All points to the left, plus the boundary',800,815,m('candidates',2),35,COL.chalk,'middle');}],-['lower','At least negative one half',m=>{const p=panel(0);iqTitle(p,'x ≥ −1/2','All real values at least −1/2 qualify.');const l=iqLine(p,-2,2,300,540);S.iqRegion=iqRegion(l,-.5,1,true,m('region'));iqMath(p,['x ≥ −',F(1,2)],800,300,0,63);iqMath(p,['−',F(1,2),' is included'],l.x(-.5),435,m('endpoint'),36,COL.task);iqPoint(l,0,'0',m('candidates'),-65,38);iqPoint(l,1,'1',m('candidates'),-65,38);iqPoint(l,-.75,['−',F(3,4)],m('candidates'),100,40);iqText(p,'excluded',l.x(-.75),750,m('candidates'),28,COL.dim,'middle');iqText(p,'The qualifying set continues right without end →',800,840,m('candidates',2),33,COL.chalk,'middle');}],-['strict','Does the boundary qualify?',m=>{const p=panel(0);iqTitle(p,'Same direction; different boundary');const a=iqLine(p,0,3,320,390,300);const b=iqLine(p,0,3,320,650,300);const ra=iqRegion(a,2,-1,false,m('open')),rb=iqRegion(b,2,-1,true,m('closed'));iqMath(p,'x < 2',220,290,0,50);iqMath(p,'x ≤ 2',220,550,0,50);iqText(p,'open: 2 excluded',1160,345,m('open'),31,COL.task,'middle');iqText(p,'filled: 2 included',1160,610,m('closed'),31,COL.task,'middle');iqText(p,'< and > exclude · ≤ and ≥ include',800,835,m('rule'),38,COL.chalk,'middle');S.iqStrict={a,b,ra,rb};}],-['q3','Quick check',()=>{const p=panel(0);iqTitle(p,'Which points qualify?','The condition is x ≥ −1/2. Include the boundary.');const l=iqLine(p,-2,2,220,490,560);S.iqRegion=iqRegion(l,-.5,1,true,0);for(const [v,label,dy] of [[-1,'−1',-65],[-.5,['−',F(1,2)],100],[0,'0',-65],[1,'1',-65]])iqPoint(l,v,label,0,dy,38);},{ask:done=>quiz({x:1080,y:180,w:460,cls:'side'},[{id:'c-membership',prompt:['Does each value satisfy ',$m('x ≥ −',F(1,2)),'?'],build:grid([{parts:['−1'],ans:['n'],why:'−1 < −1/2: excluded.'},{parts:['−',F(1,2)],ans:['y'],why:'The ≥ boundary is included.'},{parts:['0'],ans:['y'],why:'0 > −1/2: included.'},{parts:['1'],ans:['y'],why:'1 > −1/2: included.'}],[['y','yes',COL.chalk],['n','no',COL.dim]],{multi:false})}],done)}],-['wrap','Read the symbols with a reason',m=>{const p=panel(0);iqTitle(p,'Inequalities describe order and possibilities');[['Left smaller · right greater · open side faces greater','w1'],['Larger negative magnitude → smaller signed value','w2'],['≠ means different VALUES; 1/2 = 0.5','w3'],['≤ and ≥ include the boundary; shade ALL qualifying values','w4']].forEach(([s,k],i)=>{const g=G(p,{x:-16,y:270+i*145,o:0});mk('circle',{cx:130,cy:-10,r:26,fill:COL.task},g);T(g,String(i+1),{x:130,y:0,size:30,anchor:'middle',fill:COL.board});T(g,s,{x:195,size:31});tw(g,{x:0,o:1},m(k),.6);});}],-['final1','Chapter practice',()=>panel(0),{ask:done=>quiz(SCREEN,[{id:'p-comparisons',prompt:'Choose the sign that makes each comparison true.',build:grid([{parts:['−18 ? 6'],ans:['l'],why:'A negative value is less than a positive value.'},{parts:['−11 ? −13'],ans:['g'],why:'−11 is farther right than −13.'},{parts:['0 ? −0.2'],ans:['g'],why:'Zero is greater than any negative number.'},{parts:['0.046 ? 0.047'],ans:['l'],why:'The thousandths decide: 6<7.'},{parts:[F(3,7),' ? ',F(5,7)],ans:['l'],why:'Three equal-sized sevenths are less than five.'},{parts:['−',F(5,6),' ? −',F(4,5)],ans:['l'],why:'−5/6=−25/30<−24/30=−4/5.'}],iqOrderCols,{multi:false})}],done,'Chapter practice 1 of 3')}],-['final2','Chapter practice',()=>panel(0),{ask:done=>quiz(SCREEN,[{id:'p-symbols',prompt:'Is each mathematical sentence true or false?',build:grid([{parts:['4 ≠ −4'],ans:['t'],why:'These have different signed values.'},{parts:[F(1,2),' ≠ 0.5'],ans:['f'],why:'1/2 and0.5 are the same value.'},{parts:['−2 ≤ −2'],ans:['t'],why:'Less than OR equal to includes equality.'},{parts:['−',F(3,4),' ≥ −',F(1,2)],ans:['f'],why:'−3/4 lies left of−1/2, so it is smaller.'}],iqTruthCols,{multi:false})}],done,'Chapter practice 2 of 3')}],-['final3','Chapter practice',()=>panel(0),{ask:done=>quiz(SCREEN,[{id:'p-distinct-sets',prompt:'Give three DISTINCT values in each row. Integers, decimals, and fractions all work.',build:iqTriplets([{parts:['y ≤ −2: '],answers:['-2','-3','-4'],bound:[-2,1],dir:-1,hint:'Every value must be≤−2, and the three VALUES must differ. Equivalent forms count as the same value.',why:'Example only:−2,−3,−4. Any three distinct values at most−2 work.'},{parts:['Rejected by m ≥ 0: '],answers:['-1','-2','-3'],bound:[0,1],dir:1,hint:'Each rejected value must be strictly negative. Zero (including−0) qualifies for m≥0, so it cannot be listed. Use three distinct values.',why:'Example only:−1,−2,−3. Any three distinct negative values are rejected by m≥0.'}])},{id:'p-warmer',prompt:'Which temperature is warmer: −6°C or −10°C?',build:choice(['−6°C','−10°C'],0,'−6°C is warmer because−6>−10; it is closer to zero on the negative side.',['','A larger negative magnitude is farther left and colder.'])}],done,'Chapter practice 3 of 3')}],+['negatives','Distance is not signed order',m=>{const p=panel(0);iqTitle(p,'−7 and −2','The one farther from zero sits farther left.');const l=iqLine(p,-8,2,118,610,1110,1,(_,v)=>v===-7||v===-2?'':num(v));S.iqLine=l;iqPoint(l,-7,'−7',m('distance',-2.8),48,40);iqPoint(l,-2,'−2',m('distance',-2.8),48,40);iqDistance(l,-7,m('distance'),460);iqDistance(l,-2,m('distance',1),545);iqComparison(p,'−7','<','−2',m('order'),790);iqText(p,'negative < 0 < positive',800,880,m('zero'),36,COL.chalk,'middle');}],+['q1','Quick check',()=>{const p=panel(0);iqTitle(p,'Which temperature is warmer?','Temperatures rise toward the right. Units: °C.');const l=iqLine(p,-10,0,115,500,1380);S.iqChoices=[-9,-4].map(v=>{const e=iqPoint(l,v,num(v)+'°',0,-70,44,'temperature-'+v);return {el:e.g,box:[l.x(v)-35,410,70,120],label:num(v)+' degrees Celsius'};});},{ask:done=>quiz(BAND,[{id:'c-temperature',prompt:'Choose the warmer temperature: −9°C or −4°C.',build:pickEls(S.iqChoices,1,'−4°C is warmer: −4 is greater than −9 and lies farther right.',()=>'Nine degrees below zero is colder than four degrees below zero.')}],done)}],+['decimals','Compare equal place sizes',m=>{const p=panel(0);iqTitle(p,'A zoomed decimal line','Enlarged interval 2.30–2.40 · one small interval = 0.01');const l=iqLine(p,2.3,2.4,12000,540,-27400,.01,(_,v)=>v.toFixed(2));S.iqLine=l;iqPoint(l,2.34,'2.34',m('points'),-90,52);iqPoint(l,2.37,'2.37',m('points'),-90,52);iqComparison(p,'2.34','<','2.37',m('compare'),730,76);iqMath(p,'2.340 = 2.34',800,850,m('equal'),58);}],+['fractions','Fractions on the same unit',m=>{const p=panel(0);iqTitle(p,'Compare −3/4 and −3/5','Both rows: the same unit from −1 to 0; shaded distance extends left from zero.');const model=iqFractionModel(p,m('points'));S.iqFraction=model;model.rows.forEach(r=>{put(r.g,{o:0});show(r.g,m('parts',-5.6))});iqMath(p,['−',F(3,4),' < −',F(3,5)],1100,845,m('points',2),64);}],+['repartition','Equal-sized twentieths',m=>{const p=panel(0);iqTitle(p,'Subdivide without changing either value','Each original fourth → 5 pieces · each original fifth → 4 pieces');S.iqFraction=iqFractionModel(p);S.iqCuts=iqSubdivide(S.iqFraction,m('cuts'));iqMath(p,['−',F(3,4),' = −',F(15,20)],800,230,m('labels'),54);iqMath(p,['−',F(3,5),' = −',F(12,20)],800,402,m('labels',1),54);iqMath(p,['−',F(15,20),' < −',F(12,20)],1100,845,m('compare'),64);}],+['q2','Quick check',()=>{const p=panel(0);iqTitle(p,'Choose the greater fraction','A point farther right has the greater value.');const l=iqLine(p,-1,0,1200,520,1400,.25,(_,v)=>v===-.75?'':num(v));S.iqChoices=[[-.8,['−',F(4,5)],'−4/5',-75],[-.75,['−',F(3,4)],'−3/4',75]].map(([v,label,name,dx],i)=>{const e=iqPoint(l,v,label,0,-120,64,'fraction-choice-'+i);put(e.g.querySelector('g'),{x:dx});path(l.g,`M${l.x(v)+dx*.6} 438L${l.x(v)} 505`,{stroke:iqColor(v),'stroke-width':2});return {el:e.g,box:[l.x(v)+dx-55,320,110,215],label:name};});},{ask:done=>quiz(BAND,[{id:'c-negative-fractions',prompt:'Choose the greater value: −4/5 or −3/4.',build:pickEls(S.iqChoices,1,'−3/4 is greater. Exactly, −15/20 > −16/20; its point is farther right.',()=> 'Four fifths is a larger distance from zero. On the negative side, that puts −4/5 farther left.')}],done)}],+['notEqual','Different values, not different writing',m=>{const p=panel(0);iqTitle(p,'≠ means “not equal”');const l=iqLine(p,-2,3,220,480,690);iqPoint(l,-1,'−1',0);iqPoint(l,2,'2',0);iqComparison(p,'−1','≠','2',m('different'),280);iqMath(p,'2 ≠ −1',1190,350,m('different',2),40);const low=iqLine(p,0,1,800,720,400,.25,(_,v)=>v===.5?'':num(v));const half=iqPoint(low,.5,[F(1,2)],m('equal'),-50,60,'equivalent-half');const dec=G(p,{x:1300,y:660,o:0});M(dec,['0.5'],{size:52,fill:POS,anchor:'middle'});show(dec,m('equal'));tw(dec,{x:800,y:790},m('equal',2),1.5);iqText(p,'same point, equal value',800,870,m('equal',4),32,COL.dim,'middle');S.iqEqual={low,half,dec};}],+['inclusive','At most two',m=>{const p=panel(0);iqTitle(p,'At most two','x stands for any number. Every number at most 2 fits.');const l=iqLine(p,-4,4,160,500);S.iqRegion=iqRegion(l,2,-1,true,m('region'),m('endpoint'));iqMath(p,'x ≤ 2',800,300,0,67);iqText(p,'2 is included',l.x(2),430,m('endpoint'),32,COL.task,'middle');for(const [v,s,dy,ly,ok] of [[-1,'−1',-65,385,1],[1.5,'1.5',95,650,1],[2.5,'2.5',95,650,0]]){const e=iqPoint(l,v,s,m('candidates'),dy,38);e.c.setAttribute('stroke',COL.board);e.c.setAttribute('stroke-width',3);iqText(p,ok?'qualifies':'does not',l.x(v),ly,m('candidates'),28,ok?COL.task:COL.dim,'middle');}iqText(p,'All points to the left, plus the boundary',800,815,m('candidates',2),35,COL.chalk,'middle');}],+['lower','At least negative one half',m=>{const p=panel(0);iqTitle(p,'At least negative one half','Every number at least −1/2 fits.');const l=iqLine(p,-2,2,300,540);S.iqRegion=iqRegion(l,-.5,1,true,m('region'),m('endpoint'));iqMath(p,['x ≥ −',F(1,2)],800,300,0,63);iqMath(p,['−',F(1,2),' is included'],l.x(-.5),395,m('endpoint'),52,COL.task);for(const v of [0,1]){const e=iqPoint(l,v,num(v),m('candidates'),-65,40);e.c.setAttribute('stroke',COL.board);e.c.setAttribute('stroke-width',3);}iqPoint(l,-.75,['−',F(3,4)],m('candidates'),115,60);iqText(p,'excluded',l.x(-.75),740,m('candidates'),30,COL.dim,'middle');iqText(p,'The numbers that fit go on to the right forever →',800,840,m('candidates',2),33,COL.chalk,'middle');}],+['strict','Does the boundary qualify?',m=>{const p=panel(0);iqTitle(p,'Same direction; different boundary');const a=iqLine(p,0,3,320,390,300);const b=iqLine(p,0,3,320,650,300);const ra=iqRegion(a,2,-1,false,m('open',-2.3),m('open')),rb=iqRegion(b,2,-1,true,m('open',-2.3),m('closed'));iqMath(p,'x < 2',220,290,0,50);iqMath(p,'x ≤ 2',220,550,0,50);iqText(p,'open: 2 excluded',1160,345,m('open'),31,COL.task,'middle');iqText(p,'filled: 2 included',1160,610,m('closed'),31,COL.task,'middle');iqText(p,'< and > exclude · ≤ and ≥ include',800,835,m('rule'),38,COL.chalk,'middle');S.iqStrict={a,b,ra,rb};}],+['q3','Quick check',()=>{const p=panel(0);iqTitle(p,'Which points fit?','The condition is x ≥ −1/2. The boundary counts.');const l=iqLine(p,-2,2,220,490,560);S.iqRegion=iqRegion(l,-.5,1,true,0);for(const [v,label,dy] of [[-1,'−1',-65],[-.5,['−',F(1,2)],120],[0,'0',-65],[1,'1',-65]]){const e=iqPoint(l,v,label,0,dy,v===-.5?60:46);e.c.setAttribute('stroke',COL.board);e.c.setAttribute('stroke-width',3);}},{ask:done=>quiz({x:1080,y:180,w:460,cls:'side'},[{id:'c-membership',prompt:['Does each value fit ',$m('x ≥ −',F(1,2)),'?'],build:grid([{parts:['−1'],ans:['n'],why:'−1 < −1/2: excluded.'},{parts:['−',F(1,2)],ans:['y'],why:'The ≥ boundary is included.'},{parts:['0'],ans:['y'],why:'0 > −1/2: included.'},{parts:['1'],ans:['y'],why:'1 > −1/2: included.'}],[['y','yes',COL.chalk],['n','no',COL.dim]],{multi:false})}],done)}],+['wrap','Read the symbols with a reason',m=>{const p=panel(0);iqTitle(p,'Inequalities describe order and possibilities');[['Left is smaller, right is greater; the open side faces the greater number','w1'],['Negatives too: farther left of zero means smaller','w2'],['≠ means different values; 1/2 = 0.5 are equal','w3'],['≤ and ≥ include the boundary; shade every number that fits','w4']].forEach(([s,k],i)=>{const g=G(p,{x:-16,y:290+i*165,o:0});mk('circle',{cx:130,cy:-12,r:32,fill:COL.task},g);T(g,String(i+1),{x:130,y:0,size:36,anchor:'middle',fill:COL.board});T(g,s,{x:200,size:38});tw(g,{x:0,o:1},m(k),.6);});}],+['final1','Chapter practice',()=>panel(0),{ask:done=>quiz(SCREEN,[{id:'p-comparisons',prompt:'Choose the sign that makes each comparison true.',build:grid([{parts:['−18 ? 6'],ans:['l'],why:'A negative value is less than a positive value.'},{parts:['−11 ? −13'],ans:['g'],why:'−11 is farther right than −13.'},{parts:['0 ? −0.2'],ans:['g'],why:'Zero is greater than any negative number.'},{parts:['0.046 ? 0.047'],ans:['l'],why:'The thousandths decide: 6 < 7.'},{parts:[F(3,7),' ? ',F(5,7)],ans:['l'],why:'Three equal-sized sevenths are less than five.'},{parts:['−',F(5,6),' ? −',F(4,5)],ans:['l'],why:'−5/6 = −25/30 < −24/30 = −4/5.'}],iqOrderCols,{multi:false})}],done,'Chapter practice · set 1 of 3')}],+['final2','Chapter practice',()=>panel(0),{ask:done=>quiz(SCREEN,[{id:'p-symbols',prompt:'Is each mathematical sentence true or false?',build:grid([{parts:['4 ≠ −4'],ans:['t'],why:'These have different signed values.'},{parts:[F(1,2),' ≠ 0.5'],ans:['f'],why:'1/2 and 0.5 are the same value.'},{parts:['−2 ≤ −2'],ans:['t'],why:'Less than OR equal to includes equality.'},{parts:['−',F(3,4),' ≥ −',F(1,2)],ans:['f'],why:'−3/4 lies left of −1/2, so it is smaller.'}],iqTruthCols,{multi:false})}],done,'Chapter practice · set 2 of 3')}],+['final3','Chapter practice',()=>panel(0),{ask:done=>quiz(SCREEN,[{id:'p-distinct-sets',prompt:'Give three DIFFERENT values in each row. Whole numbers, decimals, and fractions all work.',build:iqTriplets([{parts:['y ≤ −2: '],answers:['-2','-3','-4'],bound:[-2,1],dir:-1,hint:'Every value must be ≤ −2, and the three values must be different. −2 and −4/2 count as the same value.',why:'Example only: −2, −3, −4. Any three different values at most −2 work.'},{parts:['Do NOT fit m ≥ 0: '],answers:['-1','-2','-3'],bound:[0,1],dir:1,hint:'A value that does not fit m ≥ 0 must be below zero. Zero fits, so it cannot be listed. Use three different values.',why:'Example only: −1, −2, −3. Any three different negative numbers do not fit m ≥ 0.'}])},{id:'p-warmer',prompt:'Which temperature is warmer: −6°C or −10°C?',build:choice(['−6°C','−10°C'],0,'−6°C is warmer because −6 > −10; it is closer to zero on the negative side.',['','A larger negative magnitude is farther left and colder.'])}],done,'Chapter practice · set 3 of 3')}],['finish','Finished',()=>panel(0),{ask:finishCard}]].map(([id,title,run,extra])=>({id,title,run,...extra}));boot();diff --git a/site/math-notebook/ch15/index.html b/site/math-notebook/ch15/index.htmlindex d9a1ba4..7adc5a0 100644--- a/site/math-notebook/ch15/index.html+++ b/site/math-notebook/ch15/index.html@@ -9,31 +9,34 @@ const rgMath=(p,s,x,y,t=0,size=52,col=COL.chalk)=>{const e=M(p,Array.isArray(s)?const rgTitle=(p,s,sub='')=>{rgText(p,s,100,110,.1,43);if(sub)rgText(p,sub,100,165,.15,27,COL.dim);};function rgBead(p,color,id,x,y){const g=G(p,{x,y});g.dataset.beadId=id;g.dataset.kind=color;mk('circle',{r:19,fill:rgC[color],stroke:COL.board,'stroke-width':2},g);mk('circle',{r:5,fill:COL.board},g);return g;}const rgData=[...Array(6).fill('blue'),...Array(9).fill('coral'),...Array(3).fill('white')];-function rgBag(p,layout='rows'){return rgData.map((kind,i)=>{const n=kind==='blue'?i:kind==='coral'?i-6:i-15;const [x,y]=layout==='bag'?[490+i%6*95,290+Math.floor(i/6)*110]:[400+n*70,300+['blue','coral','white'].indexOf(kind)*135];return rgBead(p,kind,'bag-'+i,x,y);});}-function rgRowLabels(p,t=0){[['blue',6],['coral',9],['white',3]].forEach(([kind,n],i)=>{rgText(p,kind+' beads',145,310+135*i,t,31,rgC[kind]);rgText(p,String(n),1080,310+135*i,t,43,rgC[kind]);});}+function rgBag(p,layout='rows'){return rgData.map((kind,i)=>{const n=kind==='blue'?i:kind==='coral'?i-6:i-15;const [x,y]=layout==='bag'?[592+i%6*100,330+Math.floor(i/6)*110]:[560+n*70,300+['blue','coral','white'].indexOf(kind)*135];return rgBead(p,kind,'bag-'+i,x,y);});}+function rgRowLabels(p,t=0,kinds=['blue','coral','white']){kinds.forEach((kind,i)=>{rgText(p,kind+' beads',490,310+135*i,t,31,rgC[kind],'end');rgText(p,String({blue:6,coral:9,white:3}[kind]),1230,315+135*i,t,46,rgC[kind]);});}+// A drawn bag: a sack outline gathered and tied at the top centre.+function rgSack(p,L,top,R,bottom,stroke=COL.dim){const cx=(L+R)/2,g=G(p),a={stroke,'stroke-width':3};path(g,`M${cx-45} ${top}C${cx-130} ${top+10} ${L} ${top+5} ${L} ${top+70}L${L} ${bottom-50}Q${L} ${bottom} ${L+50} ${bottom}L${R-50} ${bottom}Q${R} ${bottom} ${R} ${bottom-50}L${R} ${top+70}C${R} ${top+5} ${cx+130} ${top+10} ${cx+45} ${top}`,a);path(g,`M${cx-45} ${top}Q${cx} ${top-14} ${cx+45} ${top}M${cx-6} ${top-8}Q${cx-40} ${top-48} ${cx-58} ${top-30}M${cx+6} ${top-8}Q${cx+40} ${top-48} ${cx+58} ${top-30}`,a);return g;}+const rgPair=(p,parts,x,y,t=0,size=36,anchor='middle')=>{const e=T(p,'',{x,y,size,anchor,o:0});parts.forEach(([s,c])=>{mk('tspan',{fill:c},e).textContent=s;});show(e,t);return e;};function rgRegroup(p,t=0){const beads=rgBag(p);const trays=[];for(let j=0;j<3;j++){const x=330+j*450,g=G(p,{o:0});mk('rect',{x:x-135,y:255,width:270,height:290,rx:20,fill:'none',stroke:COL.dim,'stroke-width':2},g);T(g,'tray '+(j+1),{x,y:595,size:26,anchor:'middle',fill:COL.dim});show(g,t,.5);trays.push(g);}beads.forEach((b,i)=>{const kind=rgData[i],n=kind==='blue'?i:kind==='coral'?i-6:i-15,per=kind==='blue'?2:kind==='coral'?3:1,j=Math.floor(n/per),k=n%per;tw(b,{x:330+j*450+(k-(per-1)/2)*65,y:kind==='blue'?310:kind==='coral'?410:500},t,2,io);});return {beads,trays};}-function rgPattern(p,x,y,b,c,id){const g=G(p);for(let i=0;i<b;i++)rgBead(g,'blue',id+'-b'+i,x+(i-(b-1)/2)*45,y);for(let i=0;i<c;i++)rgBead(g,'coral',id+'-c'+i,x+(i-(c-1)/2)*45,y+95);rgText(g,b+' blue : '+c+' coral',x,y+175,0,31,COL.chalk,'middle');return g;}+function rgPattern(p,x,y,b,c,id){const g=G(p);for(let i=0;i<b;i++)rgBead(g,'blue',id+'-b'+i,x+(i-(b-1)/2)*50,y);for(let i=0;i<c;i++)rgBead(g,'coral',id+'-c'+i,x+(i-(c-1)/2)*50,y+95);rgText(g,b+' blue : '+c+' coral',x,y+175,0,31,COL.chalk,'middle');return g;}function rgMap(p,x,y,n,key=4){const g=G(p),w=80;g.dataset.mapUnits=n;g.dataset.realUnits=n*key;for(let j=0;j<n;j++){mk('rect',{x:x+j*w,y,width:w,height:65,fill:mix(COL.board,COL.whole,.3),stroke:COL.whole,'stroke-width':2},g);T(g,'1 cm',{x:x+(j+.5)*w,y:y+40,size:22,anchor:'middle',fill:COL.whole});mk('rect',{x:x+j*w,y:y+140,width:w,height:65,fill:mix(COL.board,COL.nat,.3),stroke:COL.nat,'stroke-width':2},g);T(g,key+' km',{x:x+(j+.5)*w,y:y+180,size:22,anchor:'middle',fill:COL.nat});}rgText(g,'map',x+n*w/2,y-25,0,25,COL.whole,'middle');rgText(g,'real distance',x+n*w/2,y+250,0,25,COL.nat,'middle');return g;}// Format-aware exact grading: a fraction must be n/d; ratio counts must be positive integers.function rgInputOK(values,answers,kind){const re=kind==='fraction'?/^\s*(\d+)\s*\/\s*(\d+)\s*$/:/^\s*\d+\s*$/;let ns;if(kind==='fraction'){const q=String(values[0]).match(re);if(!q)return false;ns=[+q[1],+q[2]];}else{if(!values.every(v=>re.test(String(v))))return false;ns=values.map(Number);}if(!ns.every(n=>Number.isSafeInteger(n)&&n>0)||gcd(...ns)!==1)return false;return BigInt(ns[0])*BigInt(answers[1])===BigInt(answers[0])*BigInt(ns[1]);}const rgInputs=rows=>(body,api)=>{body.classList.add('blanks','ratio-inputs');const built=rows.map(it=>{const line=h('div','bline'),lab=h('span','rlabel',[it.label]),mark=h('span','mark'),why=h('div','why');line.append(lab);const boxes=(it.kind==='fraction'?[it.answers.join('/')]:it.answers.map(String)).map((ans,i)=>{if(i)line.append(mathEl([' : '],34));const b=h('input','box');Object.assign(b,{type:'text',inputMode:'text',autocomplete:'off',spellcheck:false});b.dataset.ans=ans;b.setAttribute('aria-label',it.label+(it.kind==='fraction'?' fraction':i?' second count':' first count'));line.append(b);return b;});line.append(mark);body.append(h('div','brow',[line,why]));return {it,boxes,mark,why};});const judge=r=>{const ok=rgInputOK(r.boxes.map(b=>b.value),r.it.answers,r.it.kind);r.boxes.forEach(b=>{b.classList.toggle('good',ok);b.classList.toggle('bad',!ok)});r.mark.className='mark '+(ok?'good':'bad');r.mark.textContent=ok?'✓':'✗';r.why.replaceChildren(ok?'':r.it.hint);return ok;};const all=built.flatMap(r=>r.boxes);requestAnimationFrame(()=>all[0]?.focus({preventScroll:true}));return {check(){const right=built.filter(judge).length;api.grade(right===built.length,right===built.length?'The order, quantities, and lowest terms are correct.':`${right} of ${built.length} right. Read the row hints.`,{right,total:built.length});},reveal(){built.forEach(r=>{r.boxes.forEach(b=>b.value=b.dataset.ans);judge(r);r.why.replaceChildren(r.it.why)});return 'The ratios in lowest terms are shown.';},lock(){all.forEach(b=>b.disabled=true)},hint:['type ',rows[0].kind==='fraction'?'a fraction like 2/5':'positive whole-number counts',', ',kbd('Tab'),' next box, ',kbd('Enter'),' check, ',kbd('Esc'),' leave box']};};const BEATS=[['intro','Ratios',(m,D)=>{const g=G(scene,{o:0,y:24});T(g,'Unit 2 · Ratios, Proportions, and Percents · Chapter 15',{x:800,y:225,size:28,fill:COL.dim,anchor:'middle'});T(g,'Ratios',{x:800,y:370,size:90,weight:600,anchor:'middle'});M(g,['6 : 9'],{x:800,y:540,size:90,anchor:'middle',fill:COL.task});tw(g,{o:1,y:0},.2,1,out);rgText(g,'Compare two quantities · keep their order',800,700,m('sub'),36,COL.dim,'middle');hide(g,D-.8,.7);}],-['compare','An ordered comparison',m=>{const p=panel(0);rgTitle(p,'One bag · eighteen beads');const beads=rgBag(p,'bag');beads.forEach((b,i)=>{const k=rgData[i],n=k==='blue'?i:k==='coral'?i-6:i-15;tw(b,{x:400+n*70,y:300+['blue','coral','white'].indexOf(k)*135},m('separate'),2,io);});rgRowLabels(p,m('counts'));rgMath(p,'blue : coral = 6 : 9',800,765,m('ratio'),57);rgText(p,'The white beads remain in the bag.',800,845,m('ratio',2),28,COL.dim,'middle');S.rgBag=beads;}],+['compare','An ordered comparison',m=>{const p=panel(0);rgTitle(p,'One bag · eighteen beads');rgSack(p,515,235,1170,640);const beads=rgBag(p,'bag');beads.forEach((b,i)=>{const k=rgData[i],n=k==='blue'?i:k==='coral'?i-6:i-15;tw(b,{x:560+n*70,y:300+['blue','coral','white'].indexOf(k)*135},m('separate'),2,io);});rgRowLabels(p,m('counts'));rgMath(p,'blue : coral = 6 : 9',842,750,m('ratio'),57);rgText(p,'The white beads stay in the bag but are not compared.',842,835,m('ratio',9.7),29,COL.dim,'middle');S.rgBag=beads;}],['order','Order names the quantities',m=>{const p=panel(0);rgTitle(p,'Blue to coral ≠ coral to blue');const a=G(p,{x:500,y:345}),b=G(p,{x:1100,y:345});M(a,['6'],{size:88,anchor:'middle',fill:rgC.blue});T(a,'blue beads',{y:80,size:34,anchor:'middle',fill:rgC.blue});M(b,['9'],{size:88,anchor:'middle',fill:rgC.coral});T(b,'coral beads',{y:80,size:34,anchor:'middle',fill:rgC.coral});rgMath(p,':',800,345,0,88);rgText(p,'first quantity',500,220,m('first'),29,COL.dim,'middle');rgText(p,'second quantity',1100,220,m('first'),29,COL.dim,'middle');tw(a,{y:285},m('swap'),.5);tw(b,{y:465},m('swap'),.5);tw(a,{x:1100},m('swap',.5),1.5);tw(b,{x:500},m('swap',.5),1.5);tw(a,{y:345},m('swap',2),.5);tw(b,{y:345},m('swap',2),.5);rgMath(p,'coral : blue = 9 : 6',800,705,m('reverse'),57);rgText(p,'Same bag · different ordered comparison',800,815,m('reverse',2),34,COL.dim,'middle');S.rgSwap={a,b};}],-['notation','Three notations, one comparison',m=>{const p=panel(0);rgTitle(p,'Blue beads compared with coral beads');rgPattern(p,800,280,2,3,'notation');rgText(p,'Repeated pattern from the 6-blue, 9-coral bag',800,510,0,27,COL.dim,'middle');rgMath(p,'6 : 9',350,640,m('colon'),62);rgMath(p,'6 to 9',800,640,m('words'),62);rgMath(p,[F(6,9)],1250,640,m('fraction'),62);rgText(p,'first: blue count',1250,765,m('roles'),29,rgC.blue,'middle');rgText(p,'second: coral count',1250,815,m('roles',1),29,rgC.coral,'middle');rgText(p,'Denominator = coral count, not total',100,845,m('roles',3),33,COL.task);}],-['whole','Part to part; part to whole',m=>{const p=panel(0);rgTitle(p,'Which second quantity?','Same beads · a different comparison');S.rgBag=rgBag(p);rgRowLabels(p);const frame=mk('rect',{x:330,y:245,width:850,height:380,rx:22,fill:'none',stroke:COL.task,'stroke-width':4},p);put(frame,{o:0});show(frame,m('all'));rgText(p,'ALL = 6 + 9 + 3 = 18',800,670,m('all'),29,COL.task,'middle');rgMath(p,[F(6,9)],400,755,m('difference'),48);rgText(p,'blue : coral',400,830,m('difference'),30,rgC.coral,'middle');rgMath(p,[F(6,18)],1200,755,m('whole'),48);rgText(p,'blue : all',1200,830,m('whole'),30,COL.task,'middle');}],-['q1','Choose the denominator',()=>{const p=panel(0);rgTitle(p,'Blue beads : ALL beads','Choose the second quantity.');const beads=rgBag(p,'bag');beads.forEach(b=>put(b,{x:st(b).x-180,y:st(b).y}));[['6 blue beads',rgC.blue],['9 coral beads',rgC.coral],['18 ALL beads',COL.task]].forEach(([s,c],i)=>rgText(p,s,1050,300+i*130,0,38,c,'middle'));S.rgChoices=[0,1,2].map(i=>({el:p,box:[840,240+i*130,420,95],label:['6 blue beads','9 coral beads','all18 beads'][i]}));},{ask:done=>quiz(BAND,[{id:'c-denominator',prompt:'For blue : all, which group supplies the denominator?',build:pickEls(S.rgChoices,2,'All eighteen beads. The denominator is the second named quantity.',i=>i===0?'Blue is the first quantity: it belongs in the numerator.':'Nine counts only coral beads. The question names ALL beads as its second quantity.')}],done)}],+['notation','Three notations, one comparison',m=>{const p=panel(0);rgTitle(p,'Blue beads compared with coral beads');['blue','coral'].forEach((k,j)=>{for(let n=0;n<(j?9:6);n++)rgBead(p,k,'notation-'+k+n,560+n*70,300+j*135);});rgRowLabels(p,0,['blue','coral']);rgMath(p,'6 : 9',350,590,m('colon'),66);rgMath(p,'6 to 9',800,590,m('words'),66);rgMath(p,[F(6,9)],1250,600,m('fraction'),100);rgText(p,'first: blue count',1250,725,m('roles'),31,rgC.blue,'middle');rgText(p,'second: coral count',1250,772,m('roles',1),31,rgC.coral,'middle');rgText(p,'Denominator = coral count, not total',100,845,m('roles',6.7),33,COL.task);}],+['whole','Part to part; part to whole',m=>{const p=panel(0);rgTitle(p,'Which second quantity?','Same beads · a different comparison');const sack=rgSack(p,515,235,1170,640);S.rgBag=rgBag(p);rgRowLabels(p);sack.querySelectorAll('path').forEach(e=>tw(e,{c_stroke:COL.task,'a_stroke-width':5},m('all'),.6));rgText(p,'ALL = 6 + 9 + 3 = 18',842,692,m('all'),34,COL.task,'middle');rgMath(p,[F(6,9)],330,815,m('difference'),100);rgPair(p,[['blue',rgC.blue],[' : ',COL.chalk],['coral',rgC.coral]],400,797,m('difference'),38,'start');rgMath(p,[F(6,18)],1130,815,m('whole'),100);rgPair(p,[['blue',rgC.blue],[' : ',COL.chalk],['all',COL.task]],1215,797,m('whole'),38,'start');}],+['q1','Choose the denominator',()=>{const p=panel(0);rgTitle(p,'Blue beads : ALL beads','Choose the second quantity.');S.rgChoices=[[rgData.slice(0,6),3,'6 blue beads'],[rgData.slice(6,15),3,'9 coral beads'],[rgData,6,'all 18 beads']].map(([kinds,cols,label],i)=>{const cx=350+i*450,g=G(p),rows=Math.ceil(kinds.length/cols);kinds.forEach((k,j)=>rgBead(g,k,'q1-'+i+'-'+j,cx+(j%cols-(cols-1)/2)*58,410+(Math.floor(j/cols)-(rows-1)/2)*62));if(i===2)rgSack(g,cx-190,290,cx+190,530);rgText(g,kinds.length+' beads',cx,610,0,40,i===2?COL.chalk:rgC[kinds[0]],'middle');return {el:g,box:[cx-205,235,410,410],label};});},{ask:done=>quiz(BAND,[{id:'c-denominator',prompt:'For blue : all, which group supplies the denominator?',build:pickEls(S.rgChoices,2,'All eighteen beads. The denominator is the second named quantity.',i=>i===0?'Blue is the first quantity: it belongs in the numerator.':'Nine counts only coral beads. The question names ALL beads as its second quantity.')}],done)}],['group','Find a repeated pattern',m=>{const p=panel(0);rgTitle(p,'Regroup the same eighteen beads','No beads added · no beads removed');S.rgGroups=rgRegroup(p,m('trays'));rgText(p,'Each tray: 2 blue + 3 coral + 1 white',800,680,m('each'),36,COL.chalk,'middle');rgMath(p,'blue : coral = 2 : 3',800,770,m('same'),57);rgText(p,'Three copies give the full bag: 6 blue : 9 coral.',800,845,m('same',2),29,COL.dim,'middle');}],-['simplify','Divide both counts',m=>{const p=panel(0);rgTitle(p,'Same repeated pattern · smaller counts');S.rgGroups=rgRegroup(p,0);rgMath(p,'6 ÷ 3 : 9 ÷ 3',800,670,m('divide'),61);rgMath(p,'2 : 3',800,770,m('reduced'),65,COL.task);rgText(p,'GCF(6, 9) = 3 · 2 and 3 share only factor 1',800,855,m('lowest'),31,COL.dim,'middle');}],-['mistake','One divisor for both quantities',m=>{const p=panel(0);rgTitle(p,'Simplify BOTH counts; keep their order');rgPattern(p,400,280,2,9,'wrong-pattern');rgPattern(p,1200,280,2,3,'correct-pattern');rgText(p,'6 ÷ 3 : 9 → 2 : 9',400,600,m('wrong'),40,COL.chalk,'middle');const cross=path(p,'M165 565L635 620 M165 620L635 565',{stroke:COL.bad,'stroke-width':4},{d:0});draw(cross,m('wrong'),.8);rgText(p,'6 ÷ 3 : 9 ÷ 3 → 2 : 3',1200,600,m('both'),35,COL.task,'middle');rgText(p,'blue stays first · coral stays second',800,790,m('order'),39,COL.chalk,'middle');}],+['simplify','Divide both counts',m=>{const p=panel(0);rgTitle(p,'Same repeated pattern · smaller counts');S.rgGroups=rgRegroup(p,-3);rgMath(p,'6 ÷ 3 : 9 ÷ 3',800,670,m('divide'),61);rgMath(p,'2 : 3',800,770,m('reduced'),65,COL.task);rgText(p,'GCF(6, 9) = 3 · 2 and 3 share only factor 1',800,855,m('lowest'),31,COL.dim,'middle');}],+['mistake','One divisor for both quantities',m=>{const p=panel(0);rgTitle(p,'Simplify BOTH counts; keep their order');[[400,9,'wrong'],[1200,3,'both']].forEach(([x,c,k])=>{const g=rgPattern(p,x,280,2,c,k+'-pattern');put(g,{o:0});show(g,m(k));});rgText(p,'6 ÷ 3 : 9 → 2 : 9',430,600,m('wrong'),40,COL.chalk,'middle');rgText(p,'✗',185,604,m('wrong',.6),56,COL.bad,'middle');rgText(p,'6 ÷ 3 : 9 ÷ 3 → 2 : 3',1230,600,m('both'),40,COL.task,'middle');rgText(p,'✓',945,604,m('both',.6),56,COL.good,'middle');rgText(p,'blue stays first · coral stays second',800,790,m('order'),39,COL.chalk,'middle');}],['q2','Choose the same comparison',()=>{const p=panel(0);rgTitle(p,'Original bag: 6 blue beads : 9 coral beads','Choose the repeated pattern with the same ordered comparison.');S.rgChoices=[[2,3],[2,9],[3,2]].map(([b,c],i)=>{const x=300+i*500,g=rgPattern(p,x,300,b,c,'choice-'+i);return {el:g,box:[x-230,230,460,290],label:b+' blue beads to '+c+' coral beads'};});},{ask:done=>quiz(BAND,[{id:'c-pattern',prompt:'Which picture preserves blue : coral = 6 : 9?',build:pickEls(S.rgChoices,0,'Two blue to three coral. Three copies give six blue to nine coral.',i=>i===1?'Only the blue count was divided. Nine coral needs to be divided by three too.':'The counts were reversed. Blue comes first, so we need two blue to three coral.')}],done)}],-['scale','A map compares labelled distances',m=>{const p=panel(0);rgTitle(p,'A fictional map key','Distance diagram enlarged on screen · screen pixels are not centimetres');const key=G(p);rgText(key,'MAP KEY: 1 cm on map represents 4 km in real world',800,265,m('key'),36,COL.task,'middle');const map=rgMap(p,600,380,2);put(map,{o:0});show(map,m('pair'));rgMath(p,'2 : 8 = 1 : 4',1130,475,m('units'),45);rgText(p,'cm : km',1130,555,m('units'),36,COL.task,'middle');rgText(p,'map distance : real distance',800,795,m('units',2),38,COL.chalk,'middle');S.rgMap=map;}],-['q3','Read the map key',()=>{const p=panel(0);rgTitle(p,'Key: 1 cm on map represents 4 km in real world','Models use labelled distances; screen pixels are not physical units.');S.rgChoices=[4,3,1].map((key,i)=>{const x=230+i*500,g=rgMap(p,x,290,3,key);rgText(g,'3 cm : '+(3*key)+' km',x+120,595,0,35,COL.chalk,'middle');return {el:g,box:[x-40,230,320,410],label:'3 centimetres on map to '+(3*key)+' kilometres in real world'};});},{ask:done=>quiz(BAND,[{id:'c-map',prompt:'Choose the picture that matches a 3 cm map distance.',build:pickEls(S.rgChoices,0,'Three map segments each represent four kilometres: 3 cm : 12 km.',i=>i===1?'Each centimetre must represent FOUR kilometres. Three lots of four gives twelve.':'Equal numeric counts would ignore the map key. Each map centimetre represents four real kilometres.')}],done)}],+['scale','A map compares labelled distances',m=>{const p=panel(0);rgTitle(p,'A map key');const key=G(p);rgText(key,'Map key: 1 cm on the map means 4 km in the real world',800,250,m('key'),38,COL.task,'middle');const map=rgMap(p,0,0,2);put(map,{x:300,y:390,s:1.6,o:0});show(map,m('pair'));rgPair(p,[['2 cm',rgC.blue],[' : ',COL.chalk],['8 km',rgC.coral]],1110,480,m('units'),54);rgPair(p,[['= ',COL.chalk],['1 cm',rgC.blue],[' : ',COL.chalk],['4 km',rgC.coral]],1110,575,m('units',3.5),54);rgPair(p,[['map distance',rgC.blue],[' : ',COL.chalk],['real distance',rgC.coral]],1110,690,m('units',7.1),34);S.rgMap=map;}],+['q3','Read the map key',()=>{const p=panel(0);rgTitle(p,'Key: 1 cm on the map means 4 km in the real world','Which picture shows 3 cm on the map?');S.rgChoices=[4,3,1].map((key,i)=>{const x=230+i*500,g=rgMap(p,x,290,3,key);rgText(g,'3 cm : '+(3*key)+' km',x+120,595,0,35,COL.chalk,'middle');return {el:g,box:[x-40,230,320,410],label:'3 centimetres on map to '+(3*key)+' kilometres in real world'};});},{ask:done=>quiz(BAND,[{id:'c-map',prompt:'Choose the picture that matches a 3 cm map distance.',build:pickEls(S.rgChoices,0,'Three map segments each represent four kilometres: 3 cm : 12 km.',i=>i===1?'Each centimetre must represent FOUR kilometres. Three lots of four gives twelve.':'Equal numeric counts would ignore the map key. Each map centimetre represents four real kilometres.')}],done)}],['wrap','Ratios with clear meaning',m=>{const p=panel(0);rgTitle(p,'Let the labels lead');[['Name first quantity, then second; order matters.','w1'],['6 : 9, 6 to 9, and 6/9 express the same ratio.','w2'],['Second quantity: another part, the whole, or a labelled unit.','w3'],['Divide BOTH counts by the same factor; retain their order.','w4']].forEach(([s,k],i)=>{const g=G(p,{x:-16,y:285+i*145,o:0});mk('circle',{cx:130,cy:-10,r:26,fill:COL.task},g);T(g,String(i+1),{x:130,y:0,size:30,anchor:'middle',fill:COL.board});T(g,s,{x:195,size:32});tw(g,{x:0,o:1},m(k),.6);});}],-['final1','Chapter practice',()=>panel(0),{ask:done=>quiz(SCREEN,[{id:'p-fractions',prompt:'Write each ratio as a fraction in LOWEST TERMS.',build:rgInputs([{label:'8 : 20',kind:'fraction',answers:[2,5],hint:'Write numerator/denominator. Divide BOTH 8 and 20 by 4.',why:'8/20=2/5: divide both counts by 4.'},{label:'27 to 18',kind:'fraction',answers:[3,2],hint:'Keep 27 first and 18 second; divide both by 9.',why:'27/18=3/2. A ratio need not be less than1.'},{label:'14 : 35',kind:'fraction',answers:[2,5],hint:'The common factor 7 gives 2/5.',why:'14/35=2/5.'},{label:'15 red : 40 total',kind:'fraction',answers:[3,8],hint:'Total is already 40. Divide 15 and 40 by 5.',why:'15/40=3/8; denominatorcounts all 40.'}])}],done,'Chapter practice 1 of 3')}],-['final2','Chapter practice',()=>panel(0),{ask:done=>quiz(SCREEN,[{id:'p-supplies',prompt:'6 pens, 10 pencils, 4 erasers. Enter each ratio in LOWEST TERMS.',build:rgInputs([{label:'pens : pencils',kind:'pair',answers:[3,5],hint:'6:10 reduces by 2 to 3:5; use whole-number counts.',why:'Pens:pencils=6:10=3:5.'},{label:'pencils : pens',kind:'pair',answers:[5,3],hint:'Pencils come first: 10:6 reduces to 5:3.',why:'Pencils:pens=10:6=5:3.'},{label:'pens : all items',kind:'pair',answers:[3,10],hint:'Total6+10+4=20, not16. Simplify6:20.',why:'Pens:all=6:20=3:10.'},{label:'erasers : all items',kind:'pair',answers:[1,5],hint:'Four erasers, twenty items: 4:20 reduces to 1:5.',why:'Erasers:all=4:20=1:5.'}])}],done,'Chapter practice 2 of 3')}],-['final3','Chapter practice',()=>panel(0),{ask:done=>quiz(SCREEN,[{id:'p-denominator-part',prompt:['Blue : coral = ',$m(F(2,3)),'. What does the denominator describe?'],build:choice(['The coral count','All beads','The blue count'],0,'The second quantity is coral. This part-to-part ratio does not say that two thirds of ALL beads are blue.',['','The denominator is the second named quantity, coral. The bag also has white beads.','Blue is the first quantity, in the numerator.'])},{id:'p-denominator-whole',prompt:['Blue : all = ',$m(F(1,3)),'. What does the denominator describe?'],build:choice(['Only coral beads','All beads','Only white beads'],1,'All beads. This comparison DOES describe the blue fraction of the whole bag.',['The word ALL makes the second quantity the whole bag.','','The second quantity includes every colour.'])},{id:'p-map-units',prompt:'A map key says “2 cm on map represents 10 km in real world.” What does 2 cm : 10 km compare?',build:choice(['Map centimetres to real kilometres','Two real centimetres to ten real kilometres','Two screen pixels to ten kilometres'],0,'Map distance in centimetres compared with real distance in kilometres. Both units belong with their quantities.',['','The first distance is measured on the map.','The key labels physical map centimetres; screen pixels are only part of this enlarged illustration.'])}],done,'Chapter practice 3 of 3')}],+['final1','Chapter practice',()=>panel(0),{ask:done=>quiz(SCREEN,[{id:'p-fractions',prompt:'Write each ratio as a fraction in LOWEST TERMS.',build:rgInputs([{label:'8 : 20',kind:'fraction',answers:[2,5],hint:'Write numerator/denominator. Divide BOTH 8 and 20 by 4.',why:'8/20=2/5: divide both counts by 4.'},{label:'27 to 18',kind:'fraction',answers:[3,2],hint:'Keep 27 first and 18 second; divide both by 9.',why:'27/18=3/2. A ratio need not be less than 1.'},{label:'14 : 35',kind:'fraction',answers:[2,5],hint:'The common factor 7 gives 2/5.',why:'14/35=2/5.'},{label:'15 red : 40 total',kind:'fraction',answers:[3,8],hint:'Total is already 40. Divide 15 and 40 by 5.',why:'15/40=3/8; the denominator counts all 40.'}])}],done,'Chapter practice · set 1 of 3')}],+['final2','Chapter practice',()=>panel(0),{ask:done=>quiz(SCREEN,[{id:'p-supplies',prompt:'6 pens, 10 pencils, 4 erasers. Enter each ratio in LOWEST TERMS.',build:rgInputs([{label:'pens : pencils',kind:'pair',answers:[3,5],hint:'6:10 reduces by 2 to 3:5; use whole-number counts.',why:'Pens:pencils=6:10=3:5.'},{label:'pencils : pens',kind:'pair',answers:[5,3],hint:'Pencils come first: 10:6 reduces to 5:3.',why:'Pencils:pens=10:6=5:3.'},{label:'pens : all items',kind:'pair',answers:[3,10],hint:'Total 6+10+4=20, not 16. Simplify 6:20.',why:'Pens:all=6:20=3:10.'},{label:'erasers : all items',kind:'pair',answers:[1,5],hint:'Four erasers, twenty items: 4:20 reduces to 1:5.',why:'Erasers:all=4:20=1:5.'}])}],done,'Chapter practice · set 2 of 3')}],+['final3','Chapter practice',()=>panel(0),{ask:done=>quiz(SCREEN,[{id:'p-denominator-part',prompt:['Blue : coral = ',$m(F(2,3)),'. What does the denominator describe?'],build:choice(['The coral count','All beads','The blue count'],0,'The second quantity is coral. This part-to-part ratio does not say that two thirds of ALL beads are blue.',['','The denominator is the second named quantity, coral. The bag also has white beads.','Blue is the first quantity, in the numerator.'])},{id:'p-denominator-whole',prompt:['Blue : all = ',$m(F(1,3)),'. What does the denominator describe?'],build:choice(['Only coral beads','All beads','Only white beads'],1,'All beads. This comparison DOES describe the blue fraction of the whole bag.',['The word ALL makes the second quantity the whole bag.','','The second quantity includes every colour.'])},{id:'p-map-units',prompt:'A map key says “2 cm on map represents 10 km in real world.” What does 2 cm : 10 km compare?',build:choice(['Map centimetres to real kilometres','Two real centimetres to ten real kilometres','Two kilometres to ten centimetres'],0,'Map distance in centimetres compared with real distance in kilometres. Both units belong with their quantities.',['','The first distance is measured on the map.','Order matters: the map distance, 2 cm, comes first; the real distance, 10 km, comes second.'])}],done,'Chapter practice · set 3 of 3')}],['finish','Finished',()=>panel(0),{ask:finishCard}]].map(([id,title,run,extra])=>({id,title,run,...extra}));boot();diff --git a/site/math-notebook/ch16/index.html b/site/math-notebook/ch16/index.htmlindex c404a6b..1ddaf52 100644--- a/site/math-notebook/ch16/index.html+++ b/site/math-notebook/ch16/index.html@@ -10,26 +10,26 @@ const urTitle=(p,s,sub='')=>{urText(p,s,100,110,.1,43);if(sub)urText(p,sub,100,1function urParcel(p,id,x,y){const g=G(p,{x,y});g.dataset.objectId=id;mk('rect',{x:-24,y:-21,width:48,height:42,rx:3,fill:mix(COL.board,COL.whole,.3),stroke:COL.whole,'stroke-width':3},g);path(g,'M-24 -7H24 M0 -21V-7',{stroke:COL.whole,'stroke-width':2});return g;}function urDelivery(p,grouped=false){const parcels=Array.from({length:12},(_,i)=>urParcel(p,'parcel-'+i,grouped?550+i%4*100:350+i%6*100,grouped?290+Math.floor(i/4)*130:325+Math.floor(i/6)*100));const times=[0,1,2].map(i=>{const g=G(p,{x:1120,y:290+i*130});g.dataset.timeId='minute-'+i;mk('rect',{x:-100,y:-40,width:200,height:80,rx:10,fill:'none',stroke:COL.nat,'stroke-width':3},g);T(g,'1 minute',{y:11,size:30,fill:COL.nat,anchor:'middle'});return g;});return {parcels,times};}function urRegroup(model,t){model.parcels.forEach((e,i)=>tw(e,{x:550+i%4*100,y:290+Math.floor(i/4)*130},t,2,io));}-function urDistance(p,id,x,y,n,w=100){const g=G(p,{x,y});g.dataset.distanceId=id;g.dataset.km=String(n/4);for(let i=0;i<n;i++)mk('rect',{x:i*w,y:0,width:w,height:70,fill:mix(COL.board,COL.whole,.3),stroke:COL.whole,'stroke-width':2},g);return g;}-function urSwim(p){const cells=[0,1,2].map(i=>urDistance(p,'observed-'+i,300+i*100,300,1));const time=G(p,{x:300,y:480});mk('rect',{width:300,height:70,fill:mix(COL.board,COL.nat,.25),stroke:COL.nat,'stroke-width':3},time);T(time,'½ hour',{x:150,y:44,size:31,fill:COL.nat,anchor:'middle'});urText(p,'distance · each tile = ¼ km',300,265,0,30,COL.whole);urText(p,'time',300,450,0,30,COL.nat);return {cells,time};}+function urDistance(p,id,x,y,n,w=180){const g=G(p,{x,y});g.dataset.distanceId=id;g.dataset.km=String(n/4);for(let i=0;i<n;i++)mk('rect',{x:i*w,y:0,width:w,height:70,fill:mix(COL.board,COL.whole,.3),stroke:COL.whole,'stroke-width':2},g);return g;}+function urSwim(p,x0=300){const cells=[0,1,2].map(i=>urDistance(p,'observed-'+i,x0+i*180,295,1));const time=G(p,{x:x0,y:460});mk('rect',{width:540,height:70,fill:mix(COL.board,COL.nat,.25),stroke:COL.nat,'stroke-width':3},time);T(time,'½ hour',{x:270,y:46,size:33,fill:COL.nat,anchor:'middle'});urText(p,'distance · each tile = ¼ km',x0,275,0,30,COL.whole);urText(p,'time',x0,440,0,30,COL.nat);return {cells,time};}function urBottle(p,id,x,y){const g=G(p,{x,y});g.dataset.bottleId=id;path(g,'M-12 -44H12V-26L25 -10V40Q25 47 18 47H-18Q-25 47 -25 40V-10L-12 -26Z',{fill:mix(COL.board,COL.nat,.2),stroke:COL.nat,'stroke-width':3});path(g,'M-23 10H23',{stroke:COL.nat,'stroke-width':3});return g;}-function urMoney(p){const bottles=[0,1,2,3].map(i=>urBottle(p,'bottle-'+i,275+i*350,285));const dimes=Array.from({length:36},(_,i)=>{const g=G(p,{x:440+i%12*60,y:390+Math.floor(i/12)*60});g.dataset.dimeId='dime-'+i;g.dataset.cents='10';mk('circle',{r:17,fill:mix(COL.board,COL.whole,.35),stroke:COL.whole,'stroke-width':2},g);return g;});urText(p,'36 dime tiles · each = $0.10 · total = $3.60',800,625,0,32,COL.whole,'middle');return {bottles,dimes};}+function urMoney(p){const bottles=[0,1,2,3].map(i=>urBottle(p,'bottle-'+i,275+i*350,285));const dimes=Array.from({length:36},(_,i)=>{const g=G(p,{x:440+i%12*60,y:390+Math.floor(i/12)*60});g.dataset.dimeId='dime-'+i;g.dataset.cents='10';mk('circle',{r:18,fill:mix(COL.board,COL.whole,.35),stroke:COL.whole,'stroke-width':2},g);mk('circle',{r:14,fill:'none',stroke:COL.whole,'stroke-width':1},g);T(g,'10¢',{y:5,size:14,weight:600,fill:COL.chalk,anchor:'middle'});return g;});urText(p,'36 dime tiles · each = $0.10 · total = $3.60',800,625,0,32,COL.whole,'middle');return {bottles,dimes};}function urPack(p,x,y,name,n,cost,t=0){const g=G(p,{x,y});urText(g,name,0,0,t,33,COL.chalk);const money=mk('rect',{x:0,y:40,width:cost*70,height:65,fill:mix(COL.board,COL.whole,.3),stroke:COL.whole,'stroke-width':2},g);const count=mk('rect',{x:0,y:165,width:n*70,height:65,fill:mix(COL.board,COL.nat,.25),stroke:COL.nat,'stroke-width':2},g);const costLab=urText(g,'$'+cost.toFixed(2)+' total',0,140,t,30,COL.whole),countLab=urText(g,n+' notebooks',0,265,t,30,COL.nat);return {g,money,count,n,cost,costLab,countLab};}const BEATS=[['intro','Unit Rate and Unit Price',(m,D)=>{const g=G(scene,{o:0,y:24});T(g,'Unit 2 · Ratios, Proportions, and Percents · Chapter 16',{x:800,y:200,size:28,fill:COL.dim,anchor:'middle'});T(g,'Unit Rate',{x:800,y:330,size:86,weight:600,anchor:'middle'});T(g,'and Unit Price',{x:800,y:435,size:86,weight:600,anchor:'middle'});T(g,'4 parcels / 1 minute',{x:800,y:580,size:52,fill:COL.task,anchor:'middle'});tw(g,{o:1,y:0},.2,1,out);urText(g,'Keep the units · compare per one',800,735,m('sub'),36,COL.dim,'middle');hide(g,D-.8,.7);}],['rate','Different quantities, different units',m=>{const p=panel(0);urTitle(p,'Twelve parcels · three minutes');S.urDelivery=urDelivery(p);urText(p,'12 parcels',590,245,m('units'),35,COL.whole,'middle');urText(p,'3 minutes',1120,205,m('units'),35,COL.nat,'middle');urText(p,'parcels per minute',800,680,m('ordered'),48,COL.task,'middle');urText(p,'parcels ÷ minutes',800,790,m('ordered',2),38,COL.chalk,'middle');}],-['groups','Share the same work across time',m=>{const p=panel(0);urTitle(p,'Same twelve parcels · three equal groups','Equal sharing represents the average; actual minute counts can vary.');S.urDelivery=urDelivery(p);urRegroup(S.urDelivery,m('share'));[0,1,2].forEach(i=>urText(p,'4 parcels',350,300+i*130,m('each'),32,COL.whole,'middle'));urText(p,'12 parcels / 3 minutes = 4 parcels / 1 minute',800,755,m('rate'),37,COL.task,'middle');}],+['groups','Share the same work across time',m=>{const p=panel(0);urTitle(p,'Same twelve parcels · three equal groups');S.urDelivery=urDelivery(p);urRegroup(S.urDelivery,m('share'));[0,1,2].forEach(i=>urText(p,'4 parcels',350,300+i*130,m('each'),32,COL.whole,'middle'));urText(p,'12 parcels / 3 minutes = 4 parcels / 1 minute',800,755,m('rate'),37,COL.task,'middle');}],['unit','Make the denominator one',m=>{const p=panel(0);urTitle(p,'Unit rate = rate per ONE');S.urDelivery=urDelivery(p,true);const focus=mk('rect',{x:480,y:225,width:760,height:125,rx:14,fill:'none',stroke:COL.task,'stroke-width':4},p);put(focus,{o:0});show(focus,m('one'));urMath(p,'12 ÷ 3 = 4',395,690,m('divide'),53,COL.whole);urMath(p,'3 ÷ 3 = 1',1130,690,m('divide',1),53,COL.nat);urText(p,'4 parcels per 1 minute',800,785,m('one'),47,COL.task,'middle');urText(p,'4 parcels per minute, on average',800,850,m('meaning'),29,COL.dim,'middle');}],['direction','The question chooses the direction',m=>{const p=panel(0);urTitle(p,'Parcels per minute ↔ minutes per parcel');const a=G(p,{x:800,y:330}),b=G(p,{x:800,y:510});T(a,'12 parcels',{size:52,anchor:'middle',fill:COL.whole});T(b,'3 minutes',{size:52,anchor:'middle',fill:COL.nat});const rule=path(p,'M560 405H1040',{stroke:COL.chalk,'stroke-width':3});hide(rule,m('swap'),.2);show(rule,m('swap',2),.2);const first=urText(p,'12 ÷ 3 = 4 parcels/minute',800,710,m('forward'),44,COL.chalk,'middle');hide(first,m('swap'),.5);tw(a,{x:1000,y:420},m('swap'),1,io);tw(b,{x:600,y:420},m('swap'),1,io);tw(a,{x:800,y:510},m('swap',1),1,io);tw(b,{x:800,y:330},m('swap',1),1,io);urText(p,'3 ÷ 12 = ¼ minute/parcel',800,710,m('inverse'),44,COL.task,'middle');urText(p,'Same work · different question · different units',800,815,m('inverse',2),32,COL.dim,'middle');S.urSwap={a,b,rule};}],['q1','Choose the per-minute picture',()=>{const p=panel(0);urTitle(p,'Four parcels per minute','Which picture puts FOUR parcels beside ONE minute?');S.urChoices=[[4,1],[1,4],[3,1]].map(([n,time],i)=>{const x=290+i*510,g=G(p);for(let j=0;j<n;j++)urParcel(g,'q1-'+i+'-'+j,x+(j-(n-1)/2)*62,315);mk('rect',{x:x-130,y:415,width:260,height:80,rx:12,fill:'none',stroke:COL.nat,'stroke-width':3},g);urText(g,time+(time===1?' minute':' minutes'),x,465,0,33,COL.nat,'middle');urText(g,n+(n===1?' parcel':' parcels'),x,250,0,32,COL.whole,'middle');return {el:g,box:[x-220,210,440,350],label:n+' parcels in '+time+' minutes'};});},{ask:done=>quiz(BAND,[{id:'c-per-minute',prompt:'Select the picture for 4 parcels per minute.',build:pickEls(S.urChoices,0,'Four parcels beside one minute. Units tell you the direction.',i=>i===1?'That is one parcel in four minutes, not four parcels per minute.':'That shows three parcels per minute; the requested count is four.')}],done)}],-['swim','Divide by fractional time',m=>{const p=panel(0);urTitle(p,'A swimmer: ¾ km in ½ hour','Labelled model; screen pixels are not physical kilometres.');S.urSwim=urSwim(p);urText(p,'¾ km',750,345,m('distance'),44,COL.whole);urText(p,'½ hour',750,525,m('time'),44,COL.nat);urMath(p,[F('3/4','1/2')],1170,415,m('question'),67);urText(p,'kilometres ÷ hours',1170,610,m('question'),30,COL.task,'middle');urText(p,'Wanted: kilometres per ONE hour',800,800,m('question',2),39,COL.task,'middle');}],-['reciprocal','How many half hours fit?',m=>{const p=panel(0);urTitle(p,'One hour contains TWO half hours','Projection assumes the swimmer keeps the same pace.');S.urSwim=urSwim(p);const time2=G(p,{x:600,y:650,o:0});mk('rect',{width:300,height:70,fill:mix(COL.board,COL.nat,.25),stroke:COL.nat,'stroke-width':3},time2);T(time2,'½ hour',{x:150,y:44,size:31,fill:COL.nat,anchor:'middle'});show(time2,m('extend'),.5);tw(time2,{y:480},m('extend'),2,io);const copies=[0,1,2].map(i=>{const e=urDistance(p,'projected-'+i,600+i*100,400,1);put(e,{o:0});show(e,m('extend'),.5);tw(e,{y:300},m('extend'),2,io);return e;});urText(p,'first half hour',450,405,0,26,COL.dim,'middle');urText(p,'another half hour · same pace',750,405,m('extend',2),25,COL.dim,'middle');urText(p,'1 hour',1080,525,m('extend',2),37,COL.nat);urMath(p,[F(3,4),' ÷ ',F(1,2)],400,700,m('divide'),48);urMath(p,'=',650,700,m('reciprocal'),48);urMath(p,[F(3,4),' × 2'],900,700,m('reciprocal'),48);urText(p,'= 1.5 km/hour',1250,700,m('answer'),39,COL.task,'middle');urText(p,'Distance and time both double; the pace stays the same.',800,835,m('answer',1),31,COL.dim,'middle');S.urSwim.copies=copies;S.urSwim.time2=time2;}],+['swim','Divide by fractional time',m=>{const p=panel(0);urTitle(p,'A swimmer: ¾ km in ½ hour');S.urSwim=urSwim(p);urText(p,'¾ km',880,347,m('distance'),48,COL.whole);urText(p,'½ hour',880,512,m('time'),48,COL.nat);urText(p,'¾ km',1270,418,m('question'),50,COL.whole,'middle');const fb=path(p,'M1160 440H1380',{stroke:COL.chalk,'stroke-width':4});put(fb,{o:0});show(fb,m('question'));urText(p,'½ hour',1270,495,m('question'),50,COL.nat,'middle');urText(p,'kilometres ÷ hours',1270,590,m('question'),32,COL.task,'middle');urText(p,'Wanted: kilometres per ONE hour',800,760,m('question',2),42,COL.task,'middle');}],+['reciprocal','How many half hours fit?',m=>{const p=panel(0);urTitle(p,'One hour contains TWO half hours','¾ km in ½ hour');S.urSwim=urSwim(p,260);const time2=G(p,{x:800,y:570,o:0});mk('rect',{width:540,height:70,fill:mix(COL.board,COL.nat,.25),stroke:COL.nat,'stroke-width':3},time2);T(time2,'½ hour',{x:270,y:46,size:33,fill:COL.nat,anchor:'middle'});show(time2,m('extend'),.5);tw(time2,{y:460},m('extend'),2,io);const copies=[0,1,2].map(i=>{const e=urDistance(p,'projected-'+i,800+i*180,395,1);put(e,{o:0});show(e,m('extend'),.5);tw(e,{y:295},m('extend'),2,io);return e;});urText(p,'first half hour',530,568,0,27,COL.dim,'middle');urText(p,'another half hour · same pace',1070,568,m('extend',2),27,COL.dim,'middle');const brace=path(p,'M262 590V604H1338V590 M800 604V614',{stroke:COL.nat,'stroke-width':3,fill:'none'});put(brace,{o:0});show(brace,m('extend',2));urText(p,'1 hour',800,650,m('extend',2),36,COL.nat,'middle');const eq=tokens(p,[[F(3,4)],' ÷ ',[F(1,2)],' = ',[F(3,4)],' × 2'],{x:810,y:752,size:72,anchor:'end',o:0});[0,0,0,1,1,1].forEach((k,i)=>show(eq[i],m(['divide','reciprocal'][k])));urText(p,'= 1.5 km/hour',830,752,m('answer'),58,COL.task);urText(p,'Distance and time both double; the pace stays the same.',800,850,m('answer',1),31,COL.dim,'middle');S.urSwim.copies=copies;S.urSwim.time2=time2;}],['q2','Extend to one hour',()=>{const p=panel(0);urTitle(p,'¾ km in ½ hour · same pace for 1 hour','All distance strips use the same scale. Which is the one-hour distance?');S.urChoices=[[3,25,'⅜ km'],[3,50,'¾ km'],[6,50,'1½ km']].map(([n,w,label],i)=>{const x=290+i*510,g=G(p);for(let j=0;j<n;j++)mk('rect',{x:x-n*w/2+j*w,y:300,width:w,height:70,fill:mix(COL.board,COL.whole,.3),stroke:COL.whole,'stroke-width':2},g);urText(g,label,x,435,0,43,COL.whole,'middle');urText(g,'in 1 hour',x,525,0,31,COL.nat,'middle');g.dataset.km=String(n*w/200);return {el:g,box:[x-220,245,440,330],label:label+' in one hour'};});},{ask:done=>quiz(BAND,[{id:'c-half-hour',prompt:'Pick the distance for ONE hour at the same pace.',build:pickEls(S.urChoices,2,'One hour is two half hours: ¾ × 2 = 1½ kilometres.',i=>i===0?'That multiplies the distance by ½. Divide by ½ hour to get per hour.':'¾ kilometre is the half-hour distance. One whole hour gives twice as far.')}],done)}],-['average','A fractional rate; whole completed objects',m=>{const p=panel(0);urTitle(p,'Seven completed badges in two minutes','One possible steady schedule; every badge stays whole.');const badges=Array.from({length:7},(_,i)=>{const g=G(p,{x:350+i*125,y:310});g.dataset.badgeId='badge-'+i;g.dataset.completion=String(2*(i+1)/7);mk('circle',{r:25,fill:mix(COL.board,COL.whole,.3),stroke:COL.whole,'stroke-width':3},g);T(g,String(i+1),{y:9,size:25,anchor:'middle',fill:COL.whole});tw(g,{x:200+1000*(i+1)/7,y:420},m('timeline'),2,io);return g;});const axis=G(p,{o:0});path(axis,'M200 500H1200',{stroke:COL.nat,'stroke-width':3});[0,1,2].forEach(i=>{path(axis,`M${200+i*500} 488V512`,{stroke:COL.nat,'stroke-width':3});T(axis,i+' min',{x:200+i*500,y:555,size:30,fill:COL.nat,anchor:'middle'});});path(axis,'M700 365V500', {stroke:COL.task,'stroke-width':3,'stroke-dasharray':'8 8'});show(axis,m('timeline'));urText(p,'1 minute falls between badges 3 and 4',800,640,m('average'),31,COL.task,'middle');urText(p,'7 ÷ 2 = 3.5 badges/minute on average',800,735,m('average'),42,COL.chalk,'middle');urText(p,'Total work ÷ total time · no badge is cut in half',800,835,m('whole'),32,COL.dim,'middle');S.urBadges=badges;}],-['price','Cost goes on top',m=>{const p=panel(0);urTitle(p,'Four bottles cost $3.60','Invented price · four identical bottles');[0,1,2,3].forEach(i=>urBottle(p,'price-'+i,370+i*180,350));urText(p,'$3.60 cost',1200,305,m('cost'),45,COL.whole,'middle');path(p,'M1010 370H1390',{stroke:COL.chalk,'stroke-width':3});urText(p,'4 bottles',1200,450,m('items'),45,COL.nat,'middle');urText(p,'$3.60 ÷ 4 bottles',800,670,m('fraction'),50,COL.chalk,'middle');urText(p,'Wanted: dollars per bottle',800,805,m('fraction',2),38,COL.task,'middle');}],+['average','A fractional rate; whole completed objects',m=>{const p=panel(0);urTitle(p,'Seven completed badges in two minutes','One possible steady schedule; every badge stays whole.');const badges=Array.from({length:7},(_,i)=>{const g=G(p,{x:350+i*125,y:310});g.dataset.badgeId='badge-'+i;g.dataset.completion=String(2*(i+1)/7);mk('circle',{r:25,fill:mix(COL.board,COL.whole,.3),stroke:COL.whole,'stroke-width':3},g);T(g,String(i+1),{y:9,size:25,anchor:'middle',fill:COL.whole});tw(g,{x:200+1000*(i+1)/7,y:420},m('timeline'),2,io);return g;});const axis=G(p,{o:0});path(axis,'M200 500H1200',{stroke:COL.nat,'stroke-width':3});[0,1,2].forEach(i=>{path(axis,`M${200+i*500} 488V512`,{stroke:COL.nat,'stroke-width':3});T(axis,i+' min',{x:200+i*500,y:555,size:30,fill:COL.nat,anchor:'middle'});});path(axis,'M700 365V500', {stroke:COL.task,'stroke-width':3,'stroke-dasharray':'8 8'});show(axis,m('timeline'));urText(p,'1 minute falls between badges 3 and 4',800,640,m('timeline',4.3),31,COL.task,'middle');urText(p,'7 ÷ 2 = 3.5 badges/minute on average',800,735,m('average'),42,COL.chalk,'middle');urText(p,'Total work ÷ total time · no badge is cut in half',800,835,m('whole'),32,COL.dim,'middle');S.urBadges=badges;}],+['price','Cost goes on top',m=>{const p=panel(0);urTitle(p,'Four bottles cost $3.60');[0,1,2,3].forEach(i=>urBottle(p,'price-'+i,370+i*180,350));urText(p,'$3.60 cost',1200,305,m('cost'),45,COL.whole,'middle');const bar=path(p,'M1010 370H1390',{stroke:COL.chalk,'stroke-width':3});put(bar,{o:0});show(bar,m('cost'));urText(p,'4 bottles',1200,450,m('items'),45,COL.nat,'middle');urText(p,'$3.60 ÷ 4 bottles',800,670,m('fraction'),50,COL.chalk,'middle');urText(p,'Wanted: dollars per bottle',800,805,m('fraction',2),38,COL.task,'middle');}],['splitprice','Share the cost without changing the total',m=>{const p=panel(0);urTitle(p,'Thirty-six dimes shared among four bottles');S.urMoney=urMoney(p);S.urMoney.dimes.forEach((e,i)=>{const b=Math.floor(i/9),j=i%9;tw(e,{x:235+b*350+j%3*40,y:390+Math.floor(j/3)*55},m('share'),2,io);});[0,1,2,3].forEach(i=>urText(p,'9 dimes = $0.90',275+i*350,555,m('each'),29,COL.whole,'middle'));urText(p,'$3.60 ÷ 4 = $0.90 per bottle',800,755,m('price'),47,COL.task,'middle');urText(p,'Four equal costs still total $3.60',800,840,m('price',1),31,COL.dim,'middle');}],-['compare','Compare the cost of one matching item',m=>{const p=panel(0);urTitle(p,'Notebook packs A and B','Both packs use the same cost scale and the same item-count scale.');S.urPacks=[urPack(p,230,270,'Pack A: 3 for $4.50',3,4.5),urPack(p,890,270,'Pack B: 5 for $7.00',5,7)];urText(p,'Identical notebooks · no extra charges',800,210,m('assumption'),28,COL.task,'middle');S.urPacks.forEach((a,i)=>{hide(a.costLab,m('normalize'),.4);hide(a.countLab,m('normalize'),.4);urText(a.g,'$'+(a.cost/a.n).toFixed(2)+' per notebook',0,140,m('normalize',2),30,COL.whole);urText(a.g,'1 notebook',0,265,m('normalize',2),30,COL.nat);tw(a.money,{'a_width':a.cost/a.n*70},m('normalize'),2,io);tw(a.count,{'a_width':70},m('normalize'),2,io);urText(p,'÷ '+a.n+' for both bars',500+i*660,565,m('normalize'),28,COL.task,'middle');urText(p,'$'+(a.cost/a.n).toFixed(2)+' / 1 notebook',465+i*660,630,m('normalize',2),37,COL.chalk,'middle');});urText(p,'Pack B: $0.10 less per notebook',800,765,m('compare'),42,COL.task,'middle');urText(p,'Higher total cost can still mean lower unit price.',800,845,m('compare',1),30,COL.dim,'middle');}],-['q3','Choose the lower unit price',()=>{const p=panel(0);urTitle(p,'Same markers · no extra charges','Compare dollars per marker, not total cost alone.');S.urChoices=[[4,2.8],[6,3.9]].map(([n,c],i)=>{const x=450+i*700,g=G(p);for(let j=0;j<n;j++)mk('rect',{x:x+(j-(n-1)/2)*48-10,y:270,width:20,height:100,rx:5,fill:mix(COL.board,COL.nat,.3),stroke:COL.nat,'stroke-width':2},g);urText(g,'Pack '+['A','B'][i]+': '+n+' markers',x,225,0,36,COL.nat,'middle');urText(g,'$'+c.toFixed(2)+' total',x,440,0,36,COL.whole,'middle');urText(g,'$'+(c/n).toFixed(2)+' per marker',x,545,0,41,COL.task,'middle');g.dataset.count=String(n);g.dataset.cost=String(c);return {el:g,box:[x-290,190,580,410],label:'Pack '+['A','B'][i]+', '+(c/n).toFixed(2)+' dollars per marker'};});},{ask:done=>quiz(BAND,[{id:'c-unit-price',prompt:'Pick the pack with the LOWER price per marker.',build:pickEls(S.urChoices,1,'Pack B: $3.90 ÷ 6 = $0.65 per marker, lower than $0.70.',()=> 'Pack A costs less in total, but each marker costs $0.70. Pack B is $0.65 per marker.')}],done)}],+['compare','Compare the cost of one matching item',m=>{const p=panel(0);urTitle(p,'Notebook packs A and B');S.urPacks=[urPack(p,230,270,'Pack A: 3 for $4.50',3,4.5),urPack(p,890,270,'Pack B: 5 for $7.00',5,7)];urText(p,'Identical notebooks · no extra charges',100,165,m('assumption'),27,COL.task);S.urPacks.forEach((a,i)=>{hide(a.costLab,m('normalize'),.4);hide(a.countLab,m('normalize'),.4);urText(a.g,'1 notebook',0,265,m('normalize',2),30,COL.nat);tw(a.money,{'a_width':a.cost/a.n*70},m('normalize'),2,io);tw(a.count,{'a_width':70},m('normalize'),2,io);const by=urText(p,'÷ '+a.n+' for both bars',465+i*660,620,m('normalize'),30,COL.task,'middle');hide(by,m('normalize',2),.4);urText(p,'$'+(a.cost/a.n).toFixed(2)+' / 1 notebook',465+i*660,630,m('normalize',[6.9,9.7][i]),40,COL.chalk,'middle');});urText(p,'Pack B: $0.10 less per notebook',800,765,m('compare'),42,COL.task,'middle');urText(p,'Higher total cost can still mean lower unit price.',800,845,m('compare',1),30,COL.dim,'middle');}],+['q3','Choose the lower unit price',()=>{const p=panel(0);urTitle(p,'Same markers · no extra charges','Compare dollars per marker, not total cost alone.');S.urChoices=[[4,2.8],[6,3.9]].map(([n,c],i)=>{const x=450+i*700,g=G(p);for(let j=0;j<n;j++)mk('rect',{x:x+(j-(n-1)/2)*48-10,y:270,width:20,height:100,rx:5,fill:mix(COL.board,COL.nat,.3),stroke:COL.nat,'stroke-width':2},g);urText(g,'Pack '+['A','B'][i]+': '+n+' markers',x,225,0,36,COL.nat,'middle');urText(g,'$'+c.toFixed(2)+' total',x,440,0,36,COL.whole,'middle');g.dataset.count=String(n);g.dataset.cost=String(c);return {el:g,box:[x-290,190,580,410],label:'Pack '+['A','B'][i]+', '+n+' markers for $'+c.toFixed(2)};});},{ask:done=>quiz(BAND,[{id:'c-unit-price',prompt:'Pick the pack with the LOWER price per marker.',build:pickEls(S.urChoices,1,'Pack B: $3.90 ÷ 6 = $0.65 per marker, lower than $0.70.',()=> 'Pack A costs less in total, but each marker costs $0.70. Pack B is $0.65 per marker.')}],done)}],['trap','Let the units catch a reversed division',m=>{const p=panel(0);urTitle(p,'Unit price asks COST per ITEM');urText(p,'4 bottles ÷ $3.60',800,320,m('flip'),51,COL.chalk,'middle');urText(p,'gives bottles per dollar',800,405,m('flip'),33,COL.dim,'middle');const cross=path(p,'M480 275L1120 345 M480 345L1120 275',{stroke:COL.bad,'stroke-width':4},{d:0});draw(cross,m('flip',2),.8);urText(p,'$3.60 ÷ 4 bottles = $0.90 per bottle',800,555,m('correct'),44,COL.task,'middle');urText(p,'Compare matching units AND identical products.',800,720,m('compare'),37,COL.chalk,'middle');urText(p,'A pack is not automatically one bottle.',800,815,m('compare',1),32,COL.dim,'middle');}],['wrap','Per one, with meaning',m=>{const p=panel(0);urTitle(p,'Four habits for rates and prices');[['Name the direction; keep both units.','w1'],['Divide first quantity by second; make denominator 1.','w2'],['Fractional time still means divide by time.','w3'],['Price = cost/item; fractional counts can describe averages.','w4']].forEach(([s,key],i)=>{const g=G(p,{x:-16,y:285+i*145,o:0});mk('circle',{cx:130,cy:-10,r:26,fill:COL.task},g);T(g,String(i+1),{x:130,y:0,size:30,anchor:'middle',fill:COL.board});T(g,s,{x:195,size:32});tw(g,{x:0,o:1},m(key),.6);});}],['final1','Chapter practice',()=>panel(0),{ask:done=>quiz(SCREEN,[{id:'p-rates',prompt:'Find the unit rate in the units shown. Exact fractions or decimals are accepted.',build:blanks([@@ -37,16 +37,16 @@ const BEATS=[{parts:['⅔ km in ⅙ hour: ',{box:'4'},' km/hour'],why:'(2/3) ÷ (1/6) = (2/3) × 6 = 4 kilometres per hour.'},{parts:['9 signs in 4 hours: ',{box:'2.25'},' signs/hour on average'],why:'9 ÷ 4 = 2.25 completed signs per hour on average; each sign stays whole.'},{parts:['8 minutes for 4 parcels: ',{box:'2'},' minutes/parcel'],why:'Time per parcel: 8 minutes ÷ 4 parcels = 2 minutes per parcel.'}-])}],done,'Chapter practice 1 of 3')}],+])}],done,'Chapter practice · set 1 of 3')}],['final2','Chapter practice',()=>panel(0),{ask:done=>quiz(SCREEN,[{id:'p-prices',prompt:'Calculate cost per item. The $ and units are already supplied.',build:blanks([{parts:['$5.40 for 6 folders: $',{box:'0.90'},' per folder'],why:'5.40 ÷ 6 = 0.90 dollars per folder.'},{parts:['$8.75 for 5 rolls: $',{box:'1.75'},' per roll'],why:'8.75 ÷ 5 = 1.75 dollars per roll.'},{parts:['$6.30 for 9 cards: $',{box:'0.70'},' per card'],why:'6.30 ÷ 9 = 0.70 dollars per card.'}-])}],done,'Chapter practice 2 of 3')}],+])}],done,'Chapter practice · set 2 of 3')}],['final3','Chapter practice',()=>panel(0),{ask:done=>quiz(SCREEN,[-{id:'p-compare',prompt:'Identical pencils, no extra charges: A has 8 for $3.20; B has 10 for $4.50. Which has the lower cost per pencil?',build:choice(['Pack A: $0.40 per pencil','Pack B: $0.45 per pencil','Equal unit prices'],0,'A: $3.20 ÷ 8 = $0.40 per pencil, less than B at $0.45.',['','More pencils does not guarantee a lower unit price. Compare $0.40 with $0.45.','The unit prices differ: $0.40 and $0.45.'])},+{id:'p-compare',prompt:'Identical pencils, no extra charges: A has 8 for $3.20; B has 10 for $4.50. Which has the lower cost per pencil?',build:choice(['Pack A','Pack B','Same unit price'],0,'A: $3.20 ÷ 8 = $0.40 per pencil, less than B at $0.45.',['','More pencils does not guarantee a lower unit price. Compare $0.40 with $0.45.','The unit prices differ: $0.40 and $0.45.'])},{id:'p-average',prompt:'A potter finishes 5 whole pots in 2 hours. What does 2.5 pots/hour mean?',build:choice(['Every hour must end with half a pot completed','An average: 5 completed pots divided by 2 hours','The potter completed only 2 whole pots'],1,'An average of 2.5 pots/hour summarizes five whole completed pots in two hours.',['The average is total completed pots divided by total time; no completed pot is cut in half.','','There were five completed pots, not two.'])}-],done,'Chapter practice 3 of 3')}],+],done,'Chapter practice · set 3 of 3')}],['finish','Finished',()=>panel(0),{ask:finishCard}]].map(([id,title,run,extra])=>({id,title,run,...extra}));boot();diff --git a/site/math-notebook/ch17/index.html b/site/math-notebook/ch17/index.htmlindex 6f9c5b8..98dac05 100644--- a/site/math-notebook/ch17/index.html+++ b/site/math-notebook/ch17/index.html@@ -10,44 +10,45 @@ const prTitle=(p,s,sub='')=>{prText(p,s,100,110,.1,43);if(sub)prText(p,sub,100,1function prCup(p,id,x,y,col){const g=G(p,{x,y});g.dataset.cupId=id;g.dataset.cups='1';path(g,'M-20 -25H20L15 25H-15Z',{fill:mix(COL.board,col,.35),stroke:col,'stroke-width':3});path(g,'M-18 -12H18',{stroke:col,'stroke-width':2});return g;}function prRecipe(p,a=2,b=3,groups=1,y=300){return [0,1,2].map(i=>{const g=G(p,{x:400+i*380,y:i<groups?0:80,o:i<groups?1:0});g.dataset.batchId='batch-'+i;const top=Array.from({length:a},(_,j)=>prCup(g,'batch-'+i+'-top-'+j,(j-(a-1)/2)*60,y,COL.whole));const bottom=Array.from({length:b},(_,j)=>prCup(g,'batch-'+i+'-bottom-'+j,(j-(b-1)/2)*60,y+150,COL.nat));return {g,top,bottom};});}function prUnits(p,a,b,top,bot,x,y,t=0){const g=G(p,{o:0});T(g,a+' '+top,{x,y:y-55,size:39,fill:COL.whole,anchor:'middle'});path(g,`M${x-235} ${y}H${x+235}`,{stroke:COL.chalk,'stroke-width':3});T(g,b+' '+bot,{x,y:y+70,size:39,fill:COL.nat,anchor:'middle'});show(g,t);return g;}-function prBars(p,a,b,top,bot,u=90){const x=200;prText(p,top,x,250,0,32,COL.whole);prText(p,bot,x,460,0,32,COL.nat);const first=mk('rect',{x,y:280,width:a*u,height:70,fill:mix(COL.board,COL.whole,.3),stroke:COL.whole,'stroke-width':3},p),second=mk('rect',{x,y:490,width:b*u,height:70,fill:mix(COL.board,COL.nat,.3),stroke:COL.nat,'stroke-width':3},p);const firstLab=prText(p,a+' '+top,x,395,0,32,COL.whole),secondLab=prText(p,b+' '+bot,x,605,0,32,COL.nat),factor=prText(p,'scale × 1',1250,345,0,39,COL.task,'middle');return {first,second,firstLab,secondLab,factor,a,b,u,top,bot};}-function prScale(v,k,t){prog(q=>{const f=1+(k-1)*q;v.first.setAttribute('width',v.a*v.u*f);v.second.setAttribute('width',v.b*v.u*f);v.first.dataset.amount=String(v.a*f);v.second.dataset.amount=String(v.b*f);const fmt=n=>(q>0&&q<1?'≈ ':'')+String(+n.toFixed(3));v.firstLab.textContent=fmt(v.a*f)+' '+(v.a*f===1?v.top.replace(/^cups /,'cup '):v.top);v.secondLab.textContent=fmt(v.b*f)+' '+(v.b*f===1?v.bot.replace(/^cups /,'cup '):v.bot);v.factor.textContent='scale × '+fmt(f);},t,3,io);}+function prBars(p,a,b,top,bot,u=90){const x=200;const first=mk('rect',{x,y:280,width:a*u,height:70,fill:mix(COL.board,COL.whole,.3),stroke:COL.whole,'stroke-width':3},p),second=mk('rect',{x,y:490,width:b*u,height:70,fill:mix(COL.board,COL.nat,.3),stroke:COL.nat,'stroke-width':3},p);const firstLab=prText(p,a+' '+top,x,395,0,32,COL.whole),secondLab=prText(p,b+' '+bot,x,605,0,32,COL.nat),factor=prText(p,'scale × 1',1250,345,0,39,COL.task,'middle');return {first,second,firstLab,secondLab,factor,a,b,u,top,bot};}+function prScale(v,k,t){prog(q=>{const f=1+(k-1)*q;v.first.setAttribute('width',v.a*v.u*f);v.second.setAttribute('width',v.b*v.u*f);v.first.dataset.amount=String(v.a*f);v.second.dataset.amount=String(v.b*f);const e=q<1?0:1,g=1+(k-1)*e,fmt=n=>n===.75?'¾':String(+n.toFixed(3)),lab=(n,u)=>fmt(n)+' '+(n<=1?u.replace(/^cups /,'cup '):u);v.firstLab.textContent=lab(v.a*g,v.top);v.secondLab.textContent=lab(v.b*g,v.bot);v.factor.textContent='scale × '+fmt(g);},t,3,io);}function prProduct(p,x,y,cols,rows,col){const g=G(p,{x,y});g.dataset.cols=String(cols);g.dataset.rows=String(rows);for(let r=0;r<rows;r++)for(let c=0;c<cols;c++)mk('rect',{x:c*22,y:r*22,width:22,height:22,fill:mix(COL.board,col,.3),stroke:col,'stroke-width':1.5},g);return g;}const BEATS=[['intro','Proportions',(m,D)=>{const g=G(scene,{o:0,y:24});T(g,'Unit 2 · Ratios, Proportions, and Percents · Chapter 17',{x:800,y:200,size:28,fill:COL.dim,anchor:'middle'});T(g,'Proportions',{x:800,y:380,size:96,weight:600,anchor:'middle'});M(g,[F(2,3),' = ',F(6,9)],{x:800,y:575,size:76,fill:COL.task,anchor:'middle'});tw(g,{o:1,y:0},.2,1,out);prText(g,'Different batch size · same balance',800,745,m('sub'),37,COL.dim,'middle');hide(g,D-.8,.7);}],['recipe','An ordered recipe',m=>{const p=panel(0);prTitle(p,'Two cups of syrup · three cups of water','Invented recipe · every drawn cup represents 1 cup of liquid');S.prRecipe=prRecipe(p);prText(p,'syrup',130,310,m('syrup'),34,COL.whole);prText(p,'water',130,460,m('water'),34,COL.nat);prUnits(p,2,3,'cups syrup','cups water',1130,370,m('ratio'));prText(p,'Keep syrup first, water second.',800,760,m('ratio',2),40,COL.task,'middle');}],['copies','Three copies, same recipe',m=>{const p=panel(0);prTitle(p,'Copy the WHOLE recipe','Original batch stays; two new batches use the same amounts.');S.prRecipe=prRecipe(p);prText(p,'syrup',130,310,0,34,COL.whole);prText(p,'water',130,460,0,34,COL.nat);S.prRecipe.slice(1).forEach(s=>{show(s.g,m('copy'),.5);tw(s.g,{y:0},m('copy'),2,io);});[0,1,2].forEach(i=>prText(p,'batch '+(i+1),400+i*380,560,i?m('copy',2):0,29,COL.dim,'middle'));prText(p,'6 cups syrup / 9 cups water',800,665,m('total'),44,COL.chalk,'middle');prMath(p,[F(2,3),' = ',F(6,9)],800,785,m('same'),58,COL.task);}],-['scale','Both amounts share one factor',m=>{const p=panel(0);prTitle(p,'Scale both liquid amounts together','Both bars use the same cup scale; intermediate readouts use ≈.');S.prBars=prBars(p,2,3,'cups syrup','cups water');prScale(S.prBars,3,m('grow'));prMath(p,[F('2 × 3','3 × 3'),' = ',F(2,3)],800,740,m('cancel'),55,COL.task);prText(p,'Same nonzero factor · denominators ≠ 0',800,845,m('rule'),32,COL.dim,'middle');}],-['q1','Choose the equivalent batch',()=>{const p=panel(0);prTitle(p,'Keep 2 syrup cups for every 3 water cups','Select the batch that preserves the recipe. Each cup represents 1 cup.');S.prChoices=[[4,6],[4,3],[6,6]].map(([a,b],i)=>{const x=285+i*515,g=G(p);for(let j=0;j<a;j++)prCup(g,'q1-'+i+'-s-'+j,x+(j-(a-1)/2)*48,300,COL.whole);for(let j=0;j<b;j++)prCup(g,'q1-'+i+'-w-'+j,x+(j-(b-1)/2)*48,455,COL.nat);prText(g,a+' cups syrup',x,240,0,32,COL.whole,'middle');prText(g,b+' cups water',x,550,0,32,COL.nat,'middle');g.dataset.top=String(a);g.dataset.bottom=String(b);return {el:g,box:[x-220,205,440,380],label:a+' syrup cups and '+b+' water cups'};});},{ask:done=>quiz(BAND,[{id:'c-batch',prompt:'Which picture keeps syrup/water = 2/3?',build:pickEls(S.prChoices,0,'4/6 = 2/3: BOTH amounts doubled.',i=>i===1?'Only syrup doubled; water stayed at three. Double both amounts.':'Equal amounts give 1/1, not two syrup cups for every three water cups.')}],done)}],+['scale','Both amounts share one factor',m=>{const p=panel(0);prTitle(p,'Scale both liquid amounts together','Both bars use the same cup scale.');S.prBars=prBars(p,2,3,'cups syrup','cups water');prScale(S.prBars,3,m('grow'));prMath(p,[F('2 × 3','3 × 3'),' = ',F(2,3)],800,740,m('cancel'),55,COL.task);prText(p,'Same nonzero factor · denominators ≠ 0',800,845,m('rule'),32,COL.dim,'middle');}],+['q1','Choose the equivalent batch',()=>{const p=panel(0);prTitle(p,'Keep 2 syrup cups for every 3 water cups','Select the batch that preserves the recipe. Each cup represents 1 cup.');S.prChoices=[[4,6],[4,3],[6,6]].map(([a,b],i)=>{const x=285+i*515,g=G(p);for(let j=0;j<a;j++)prCup(g,'q1-'+i+'-s-'+j,x+(j-(a-1)/2)*56,300,COL.whole);for(let j=0;j<b;j++)prCup(g,'q1-'+i+'-w-'+j,x+(j-(b-1)/2)*56,455,COL.nat);prText(g,a+' cups syrup',x,240,0,32,COL.whole,'middle');prText(g,b+' cups water',x,550,0,32,COL.nat,'middle');g.dataset.top=String(a);g.dataset.bottom=String(b);return {el:g,box:[x-220,205,440,380],label:a+' syrup cups and '+b+' water cups'};});},{ask:done=>quiz(BAND,[{id:'c-batch',prompt:'Which picture keeps syrup/water = 2/3?',build:pickEls(S.prChoices,0,'4/6 = 2/3: BOTH amounts doubled.',i=>i===1?'Only syrup doubled; water stayed at three. Double both amounts.':'Equal amounts give 1/1, not two syrup cups for every three water cups.')}],done)}],['common','Where cross products come from',m=>{const p=panel(0);prTitle(p,'Make a common denominator','Multiplying by 9/9 or 3/3 multiplies by ONE.');prMath(p,[F(2,3)],400,310,0,84,COL.whole);prMath(p,[F(6,9)],1130,310,0,84,COL.nat);prMath(p,[F('2 × 9','3 × 9')],400,510,m('expand'),66,COL.whole);prMath(p,[F('6 × 3','9 × 3')],1130,510,m('expand',1),66,COL.nat);prMath(p,[F(18,27),' = ',F(18,27)],800,705,m('shared'),63,COL.task);prText(p,'Same denominator 27: compare 18 with 18.',800,840,m('compare'),33,COL.chalk,'middle');}],['cross','The diagonal shortcut has a reason',m=>{const p=panel(0);prTitle(p,'Equal ratios ⇔ equal cross products','The common denominator is b × d; it must be nonzero.');prMath(p,[F(2,3)],580,340,0,93);prMath(p,[F(6,9)],1020,340,0,93);const diagonals=path(p,'M610 280L990 350 M610 350L990 280',{stroke:COL.task,'stroke-width':4},{d:0});draw(diagonals,m('diagonal'),1.2);prText(p,'2 × 9 = 18 6 × 3 = 18',800,520,m('diagonal',1.3),44,COL.task,'middle');prMath(p,[F('a','b'),' = ',F('c','d'),' ⇔ a × d = c × b'],800,675,m('general'),51);prText(p,'b ≠ 0 and d ≠ 0',800,820,m('condition'),39,COL.dim,'middle');S.prDiagonals=diagonals;}],['unequal','Unequal products, unequal ratios',m=>{const p=panel(0);prTitle(p,'Do 5/8 and 8/12 form a proportion?');prMath(p,[F(5,8),' ',F(8,12)],800,350,0,85);prMath(p,'5 × 12 = 60',430,570,m('products'),52,COL.whole);prMath(p,'8 × 8 = 64',1160,570,m('products',2),52,COL.nat);prMath(p,'60 ≠ 64',800,710,m('different'),63,COL.task);prText(p,'Not a proportion: the ordered ratios differ.',800,835,m('check'),34,COL.chalk,'middle');}],['q2','Choose the matching cross-product areas',()=>{const p=panel(0);prTitle(p,'Compare 2/4 with 6/12','Which picture shows the correct cross products? Each square = 1.');S.prChoices=[[[12,2],[6,4]],[[10,2],[6,4]],[[12,2],[5,4]]].map(([a,b],i)=>{const x=90+i*520,g=G(p);const top=prProduct(g,x+30,280,...a,COL.whole),bot=prProduct(g,x+30,455,...b,COL.nat);prText(g,a[1]+' × '+a[0],x+150,245,0,34,COL.whole,'middle');prText(g,b[0]+' × '+b[1],x+150,420,0,34,COL.nat,'middle');prText(g,String(a[0]*a[1]),x+355,315,0,38,COL.whole,'middle');prText(g,String(b[0]*b[1]),x+355,510,0,38,COL.nat,'middle');return {el:g,box:[x,210,440,370],label:a[1]+' times '+a[0]+' and '+b[0]+' times '+b[1],top,bot};});},{ask:done=>quiz(BAND,[{id:'c-products',prompt:'Choose 2 × 12 and 6 × 4. Do their areas match?',build:pickEls(S.prChoices,0,'Both actual rectangles contain 24 unit squares. Equal products give 2/4 = 6/12.',i=>i===1?'Use twelve, the second denominator, not ten. 2 × 12 = 24.':'Use six, the second numerator, not five. 6 × 4 = 24.')}],done)}],-['unknown','A letter names a missing amount',m=>{const p=panel(0);prTitle(p,'Same recipe · 3 concentrate cups for 4 water cups');prUnits(p,3,4,'cups concentrate','cups water',410,330);prMath(p,'=',795,340,0,56);S.prUnknown=prUnits(p,'x',12,'cups concentrate','cups water',1180,330,m('blank'));prText(p,'Matching ingredient units in matching positions',800,460,m('units'),31,COL.task,'middle');S.prRecipe=prRecipe(p,3,4,1,545);S.prRecipe.slice(1).forEach(s=>{show(s.g,m('groups'),.5);tw(s.g,{y:0},m('groups'),2,io);});prText(p,'concentrate',115,550,0,26,COL.whole);prText(p,'water',115,700,0,26,COL.nat);prText(p,'x = 9 cups of concentrate',800,825,m('answer'),40,COL.task,'middle');}],-['solve','Undo four copies by sharing',m=>{const p=panel(0);prTitle(p,'3/4 = x/12: find the missing number','Counters model the arithmetic product 36, not recipe cups.');prMath(p,'3 × 12 = 4 × x',800,245,m('product'),48);S.prCounters=Array.from({length:36},(_,i)=>{const e=G(p,{x:250+i%12*90,y:345+Math.floor(i/12)*65});e.dataset.counterId='counter-'+i;mk('circle',{r:17,fill:mix(COL.board,COL.whole,.35),stroke:COL.whole,'stroke-width':2},e);const group=Math.floor(i/9),j=i%9;tw(e,{x:350+group*300+(j%3-1)*60,y:345+Math.floor(j/3)*65},m('share'),2,io);return e;});[0,1,2,3].forEach(i=>{const box=mk('rect',{x:250+i*300,y:295,width:200,height:225,rx:12,fill:'none',stroke:COL.task,'stroke-width':2},p);put(box,{o:0});show(box,m('share',2));prText(p,'9 in group '+(i+1),350+i*300,575,m('share',2),28,COL.task,'middle');});prMath(p,'36 ÷ 4 = 9',800,695,m('divide'),56,COL.task);prText(p,'Check: 3/4 = 9/12 · 4 × 9 = 3 × 12',800,825,m('verify'),34,COL.chalk,'middle');}],+['unknown','A letter names a missing amount',m=>{const p=panel(0);prTitle(p,'Same recipe · 3 concentrate cups for 4 water cups');prUnits(p,3,4,'cups concentrate','cups water',410,330);prMath(p,'=',795,340,0,56);S.prUnknown=prUnits(p,'x',12,'cups concentrate','cups water',1180,330,m('blank'));prText(p,'Matching ingredient units in matching positions',800,490,m('units'),31,COL.task,'middle');S.prRecipe=prRecipe(p,3,4,1,585);S.prRecipe.slice(1).forEach(s=>{show(s.g,m('groups'),.5);tw(s.g,{y:0},m('groups'),2,io);});prText(p,'concentrate',115,590,0,30,COL.whole);prText(p,'water',115,740,0,30,COL.nat);prText(p,'x = 9 cups of concentrate',800,825,m('answer'),40,COL.task,'middle');}],+['solve','Undo four copies by sharing',m=>{const p=panel(0);prTitle(p,'3/4 = x/12: find the missing number','The 36 counters are just a number, not recipe cups.');prMath(p,'3 × 12 = 4 × x',800,245,m('product'),48);S.prCounters=Array.from({length:36},(_,i)=>{const e=G(p,{x:250+i%12*90,y:345+Math.floor(i/12)*65});e.dataset.counterId='counter-'+i;mk('circle',{r:17,fill:mix(COL.board,COL.whole,.35),stroke:COL.whole,'stroke-width':2},e);const group=Math.floor(i/9),j=i%9;tw(e,{x:350+group*300+(j%3-1)*60,y:345+Math.floor(j/3)*65},m('share'),2,io);return e;});[0,1,2,3].forEach(i=>{const box=mk('rect',{x:250+i*300,y:295,width:200,height:225,rx:12,fill:'none',stroke:COL.task,'stroke-width':2},p);put(box,{o:0});show(box,m('share',2));prText(p,'9 in group '+(i+1),350+i*300,575,m('share',2),28,COL.task,'middle');});prMath(p,'36 ÷ 4 = 9',800,695,m('divide'),56,COL.task);prText(p,'Check: 3/4 = 9/12 · 4 × 9 = 3 × 12',800,825,m('verify'),34,COL.chalk,'middle');}],['q3','Complete the recipe',()=>{const p=panel(0);prTitle(p,'Same recipe: 3 cups concentrate / 4 cups water','Use 12 cups water. Which completed picture has the right amount AND units?');S.prChoices=[[9,12,'concentrate','water'],[16,12,'concentrate','water'],[9,12,'water','concentrate']].map(([a,b,top,bot],i)=>{const x=285+i*515,g=G(p),topCol=top==='concentrate'?COL.whole:COL.nat,botCol=bot==='concentrate'?COL.whole:COL.nat;prText(g,a+' cups '+top,x,255,0,30,topCol,'middle');mk('rect',{x:x-150,y:300,width:a*18,height:65,fill:mix(COL.board,topCol,.3),stroke:topCol,'stroke-width':3},g);prText(g,b+' cups '+bot,x,455,0,30,botCol,'middle');mk('rect',{x:x-150,y:495,width:b*18,height:65,fill:mix(COL.board,botCol,.3),stroke:botCol,'stroke-width':3},g);Object.assign(g.dataset,{top:String(a),bottom:String(b),topUnit:top,bottomUnit:bot});return {el:g,box:[x-220,215,440,385],label:a+' cups '+top+' above '+b+' cups '+bot};});},{ask:done=>quiz(BAND,[{id:'c-missing',prompt:'Choose the completed concentrate/water ratio.',build:pickEls(S.prChoices,0,'9 cups concentrate / 12 cups water = 3/4. Water tripled, so concentrate tripled.',i=>i===1?'Multiply three concentrate cups by three, not four water cups by four.':'The ingredient units are reversed. Concentrate must be above water in BOTH ratios.')}],done)}],['decimal','An exact missing decimal',m=>{const p=panel(0);prTitle(p,'Find y: exact fractions or exact decimals');prMath(p,[F(5,8),' = ',F('y',14)],800,330,0,83);prMath(p,'8 × y = 5 × 14 = 70',800,505,m('cross'),57);prMath(p,'y = 70 ÷ 8 = 8.75',800,660,m('divide'),58,COL.task);prText(p,'Check: 8 × 8.75 = 70 · 8.75 = 35/4 exactly',800,815,m('verify'),32,COL.chalk,'middle');}],-['travel','A proportion needs the same speed',m=>{const p=panel(0);prTitle(p,'Train: 84 km in 3 hours','Prediction assumes the train maintains the same speed.');S.prBars=prBars(p,84,3,'km','hours',4);S.prBars.second.setAttribute('width',3*112);-prText(p,'Distance and time use separate, consistent scales.',800,210,m('assume'),27,COL.dim,'middle');prText(p,'km / hours in BOTH ratios',1250,500,m('units'),29,COL.task,'middle');prog(q=>{const f=1+4/3*q,a=84*f,b=3*f;S.prBars.first.setAttribute('width',a*4);S.prBars.second.setAttribute('width',b*112);S.prBars.first.dataset.amount=String(a);S.prBars.second.dataset.amount=String(b);const approx=q>0&&q<1?'≈ ':'';S.prBars.firstLab.textContent=approx+String(+a.toFixed(3))+' km';S.prBars.secondLab.textContent=approx+String(+b.toFixed(3))+' hours';S.prBars.factor.textContent='same speed';},m('extend'),3,io);prText(p,'28 km/hour × 7 hours = 196 km',800,745,m('answer'),42,COL.task,'middle');prText(p,'84/3 = 196/7 · observation + constant-speed assumption',800,840,m('answer',2),29,COL.dim,'middle');}],-['constant','The constant is a directed unit rate',m=>{const p=panel(0);prTitle(p,'Same recipe · concentrate per water','Both liquid bars use the same scale; both amounts divide by 4.');S.prBars=prBars(p,3,4,'cups concentrate','cups water',160);prScale(S.prBars,.25,m('normalize'));prText(p,'¾ cup concentrate',1250,420,m('rate'),30,COL.whole,'middle');prText(p,'per 1 cup water',1250,470,m('rate'),30,COL.nat,'middle');prText(p,'Reverse direction: 4/3 cups water per cup concentrate',800,735,m('reverse'),34,COL.chalk,'middle');prText(p,'Unit rate = 3/4 · This normalization scale factor = 1/4',800,840,m('reverse',2),31,COL.task,'middle');}],-['data','A table supports a model',m=>{const p=panel(0);prTitle(p,'Two observations from a pump','Observed values are consistent with a constant rate.');prText(p,'litres delivered',250,280,0,34,COL.whole);prText(p,'minutes',250,400,0,34,COL.nat);[0,1].forEach(i=>{prText(p,String([21,35][i]),790+i*340,280,0,49,COL.whole,'middle');prText(p,String([3,5][i]),790+i*340,400,0,49,COL.nat,'middle');prText(p,[21,35][i]+' ÷ '+[3,5][i]+' = 7 L/min',790+i*340,530,m('rates'),32,COL.task,'middle');});prText(p,'Constant in this direction: 7 litres per minute',800,645,m('one'),38,COL.task,'middle');prText(p,'IF the pump stays steady: 8 minutes gives 56 litres.',800,755,m('assumption'),33,COL.chalk,'middle');prText(p,'Finite data alone do not guarantee future amounts.',800,850,m('assumption',3),30,COL.dim,'middle');}],-['wrap','Equal ratios, meaningful units',m=>{const p=panel(0);prTitle(p,'Four habits for proportions');[['Equal ordered ratios; matching units; denominators ≠ 0.','w1'],['Scale BOTH quantities by the same nonzero factor.','w2'],['Common denominators explain cross products and missing numbers.','w3'],['Constant = directed unit rate; predictions need assumptions.','w4']].forEach(([s,key],i)=>{const g=G(p,{x:-16,y:285+i*145,o:0});mk('circle',{cx:130,cy:-10,r:26,fill:COL.task},g);T(g,String(i+1),{x:130,y:0,size:30,anchor:'middle',fill:COL.board});T(g,s,{x:195,size:31});tw(g,{x:0,o:1},m(key),.6);});}],+['travel','A proportion needs the same speed',m=>{const p=panel(0);prTitle(p,'Train: 84 km in 3 hours','We assume the train keeps the same speed.');S.prBars=prBars(p,84,3,'km','hours',4);S.prBars.second.setAttribute('width',3*112);S.prBars.factor.remove();+const eq1=prMath(p,[F(84,3),' = ',F('d',7)],1250,420,m('units',3.7),60);+prText(p,'Distance and time use separate, consistent scales.',800,210,m('assume'),27,COL.dim,'middle');prText(p,'km / hours in BOTH ratios',1250,560,m('units'),29,COL.task,'middle');prog(q=>{const f=1+4/3*q,a=84*f,b=3*f;S.prBars.first.setAttribute('width',a*4);S.prBars.second.setAttribute('width',b*112);S.prBars.first.dataset.amount=String(a);S.prBars.second.dataset.amount=String(b);const e=q<1?0:1,g=1+4/3*e;S.prBars.firstLab.textContent=+(84*g).toFixed(3)+' km';S.prBars.secondLab.textContent=+(3*g).toFixed(3)+' hours';},m('extend'),3,io);prText(p,'28 km/hour × 7 hours = 196 km',800,745,m('answer'),42,COL.task,'middle');hide(eq1,m('answer'),.3);prMath(p,[F(84,3),' = ',F(196,7)],1250,420,m('answer'),60,COL.task);prText(p,'84/3 = 196/7 · if the speed stays the same',800,840,m('answer',2),29,COL.dim,'middle');}],+['constant','The constant is a directed unit rate',m=>{const p=panel(0);prTitle(p,'Same recipe · concentrate per water','Both liquid bars use the same scale; both amounts divide by 4.');S.prBars=prBars(p,3,4,'cups concentrate','cups water',160);S.prBars.factor.remove();prScale(S.prBars,.25,m('normalize'));prText(p,'¾ cup concentrate',1250,420,m('rate'),30,COL.whole,'middle');prText(p,'per 1 cup water',1250,470,m('rate'),30,COL.nat,'middle');prText(p,'Reverse direction: 4/3 cups water per cup concentrate',800,735,m('reverse'),34,COL.chalk,'middle');prText(p,'For every 1 cup of water: ¾ cup of concentrate',800,840,m('reverse',2),31,COL.task,'middle');}],+['data','A table supports a model',m=>{const p=panel(0);prTitle(p,'Two observations from a pump','Both measurements give the same rate.');prText(p,'litres delivered',250,280,0,34,COL.whole);prText(p,'minutes',250,400,0,34,COL.nat);[0,1].forEach(i=>{prText(p,String([21,35][i]),790+i*340,280,0,49,COL.whole,'middle');prText(p,String([3,5][i]),790+i*340,400,0,49,COL.nat,'middle');prText(p,[21,35][i]+' ÷ '+[3,5][i]+' = 7 L/min',790+i*340,530,m('rates'),32,COL.task,'middle');});prText(p,'The pump gives 7 litres every minute',800,645,m('one'),38,COL.task,'middle');prText(p,'IF the pump stays steady: 8 minutes gives 56 litres.',800,755,m('assumption'),33,COL.chalk,'middle');prText(p,'Two measurements cannot promise the pump keeps going.',800,850,m('assumption',3),30,COL.dim,'middle');}],+['wrap','Equal ratios, meaningful units',m=>{const p=panel(0);prTitle(p,'Four habits for proportions');[['Equal ordered ratios; matching units; denominators ≠ 0.','w1'],['Scale BOTH quantities by the same nonzero factor.','w2'],['Common denominators explain cross products and missing numbers.','w3'],['A unit rate is "per 1"; predictions need the rate to stay the same.','w4']].forEach(([s,key],i)=>{const g=G(p,{x:-16,y:285+i*145,o:0});mk('circle',{cx:130,cy:-10,r:26,fill:COL.task},g);T(g,String(i+1),{x:130,y:0,size:30,anchor:'middle',fill:COL.board});T(g,s,{x:195,size:31});tw(g,{x:0,o:1},m(key),.6);});}],['final1','Chapter practice',()=>panel(0),{ask:done=>quiz(SCREEN,[{id:'p-proportions',prompt:'Do these ordered ratios form a proportion? Compare cross products.',build:grid([{parts:[F(4,7),' and ',F(12,21)],ans:['yes'],why:'4 × 21 = 84 and 12 × 7 = 84. Equal products: yes.'},{parts:[F(5,6),' and ',F(10,15)],ans:['no'],why:'5 × 15 = 75, but 10 × 6 = 60. Unequal products: no.'},{parts:[F('1.2',3),' and ',F(2,5)],ans:['yes'],why:'1.2 × 5 = 6 and 2 × 3 = 6. Equal products: yes.'}-],[['yes','Yes'],['no','No']],{multi:false})}],done,'Chapter practice 1 of 3')}],+],[['yes','Yes'],['no','No']],{multi:false})}],done,'Chapter practice · set 1 of 3')}],['final2','Chapter practice',()=>panel(0),{ask:done=>quiz(SCREEN,[{id:'p-missing',prompt:'Find each missing number. Use exact fractions or exact decimals.',build:blanks([-{parts:[F(8,12),' = ',F(14,'x'),': x = ',{box:'21'}],why:'8 × x = 12 × 14 = 168; x = 168 ÷ 8 = 21.'},-{parts:[F(5,8),' = ',F('y',14),': y = ',{box:'8.75'}],why:'8 × y = 5 × 14 = 70; y = 70 ÷ 8 = 8.75.'},-{parts:[F('z','2.5'),' = ',F(3,4),': z = ',{box:'1.875'}],why:'4 × z = 2.5 × 3 = 7.5; z = 7.5 ÷ 4 = 1.875.'}-])}],done,'Chapter practice 2 of 3')}],+{parts:[F(8,12),' = ',F(14,'x'),', x = ',{box:'21'}],why:'8 × x = 12 × 14 = 168; x = 168 ÷ 8 = 21.'},+{parts:[F(3,8),' = ',F('y',20),', y = ',{box:'7.5'}],why:'8 × y = 3 × 20 = 60; y = 60 ÷ 8 = 7.5.'},+{parts:[F('z','2.5'),' = ',F(3,4),', z = ',{box:'1.875'}],why:'4 × z = 2.5 × 3 = 7.5; z = 7.5 ÷ 4 = 1.875.'}+])}],done,'Chapter practice · set 2 of 3')}],['final3','Chapter practice',()=>panel(0),{ask:done=>quiz(SCREEN,[{id:'p-context',prompt:'Use the stated same recipe, constant price or speed. Keep units in order.',build:blanks([{parts:['Same paint: 3 blue cups / 5 white cups; 12 blue need ',{box:'20'},' white cups'],why:'Blue amount × 4 requires white amount × 4: 5 × 4 = 20 cups.'},{parts:['Constant price, no fee: 4 tickets cost $6.40; 10 cost $',{box:'16'}],why:'$6.40 ÷ 4 = $1.60/ticket; 10 × $1.60 = $16.'},{parts:['Same speed: 72 km in 2 hours; 5 hours gives ',{box:'180'},' km'],why:'72 ÷ 2 = 36 km/hour; 5 × 36 = 180 km.'},-{parts:['Table: 21 L in 3 min, 35 L in 5 min; unit rate ',{box:'7'},' L/min'],why:'Both observed ratios give 7 litres/minute; future predictions require steady flow.'}-])}],done,'Chapter practice 3 of 3')}],+{parts:['Table: 18 L in 3 min, 30 L in 5 min; unit rate ',{box:'6'},' L/min'],why:'Both observed ratios give 6 litres/minute; future predictions require steady flow.'}+])}],done,'Chapter practice · set 3 of 3')}],['finish','Finished',()=>panel(0),{ask:finishCard}]].map(([id,title,run,extra])=>({id,title,run,...extra}));boot();diff --git a/site/math-notebook/ch18/index.html b/site/math-notebook/ch18/index.htmlindex 96a5c8a..06adbdf 100644--- a/site/math-notebook/ch18/index.html+++ b/site/math-notebook/ch18/index.html@@ -7,50 +7,52 @@ const CHAPTER={number:18,title:'Converting Measurements',minutes:13,language:'enconst cvText=(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 cvMath=(p,s,x,y,t=0,size=52,col=COL.chalk)=>{const e=M(p,Array.isArray(s)?s:[s],{x,y,size,fill:col,anchor:'middle',o:0});e.querySelectorAll('tspan').forEach(span=>{if(!/^[xy]$/.test(span.textContent))span.setAttribute('font-style','normal');});show(e,t);return e;};const cvTitle=(p,s,sub='')=>{cvText(p,s,100,110,.1,43);if(sub)cvText(p,sub,100,165,.15,27,COL.dim);};-function cvTape(p,x,y,w,n,label,t=0){const g=G(p,{x,y,o:0});g.dataset.quantity=label;const bar=mk('rect',{x:0,y:0,width:w,height:65,fill:mix(COL.board,COL.whole,.3),stroke:COL.whole,'stroke-width':3},g);for(let i=1;i<n;i++)path(g,`M${i*w/n} 0V65`,{stroke:COL.whole,'stroke-width':2});T(g,label,{x:w/2,y:110,size:34,anchor:'middle',fill:COL.whole});show(g,t);return {g,bar,w,x,y};}+function cvTape(p,x,y,w,n,label,t=0,right=false){const g=G(p,{x,y,o:0});g.dataset.quantity=label;const bar=mk('rect',{x:0,y:0,width:w,height:65,fill:mix(COL.board,COL.whole,.3),stroke:COL.whole,'stroke-width':3},g);for(let i=1;i<n;i++)path(g,`M${i*w/n} 0V65`,{stroke:COL.whole,'stroke-width':2});T(g,label,right?{x:w+30,y:45,size:34,anchor:'start',fill:COL.whole}:{x:w/2,y:110,size:34,anchor:'middle',fill:COL.whole});show(g,t);return {g,bar,w,x,y};}function cvCuts(v,n,t,col=COL.task){const g=G(v.g,{o:0});g.dataset.parts=String(n);for(let i=0;i<=n;i++){const e=path(g,`M${i*v.w/n} -10V75`,{stroke:col,'stroke-width':2});e.dataset.cut=String(i);e.dataset.position=String(i*v.w/n);}show(g,t,.9);return g;}-function cvLiquid(p,n=48,layout='loose'){return Array.from({length:n},(_,i)=>{const xy=cvPosition(i,layout),g=G(p,{x:xy[0],y:xy[1]});g.dataset.cellId='fluid-'+i;g.dataset.flOz='1';mk('rect',{width:18,height:18,fill:mix(COL.board,COL.whole,.45),stroke:COL.whole,'stroke-width':1.5},g);return g;});}-function cvPosition(i,layout){const cup=Math.floor(i/8),j=i%8;if(layout==='loose')return [615+Math.floor(cup/2)*48+j%2*24,300+cup%2*96+Math.floor(j/2)*24];if(layout==='cups')return [285+Math.floor(cup/2)*480+j%2*24,270+cup%2*240+Math.floor(j/2)*24];const k=Math.floor(i/16),n=i%16;return [285+k*480+n%2*24,300+Math.floor(n/2)*24];}+function cvLiquid(p,n=48,layout='loose',size=36){return Array.from({length:n},(_,i)=>{const xy=cvPosition(i,layout),g=G(p,{x:xy[0],y:xy[1]});g.dataset.cellId='fluid-'+i;g.dataset.flOz='1';mk('rect',{width:size,height:size,fill:mix(COL.board,COL.whole,.45),stroke:COL.whole,'stroke-width':2},g);return g;});}+function cvPosition(i,layout){const cup=Math.floor(i/8),j=i%8;if(layout==='one')return [370+j%2*64,280+Math.floor(j/2)*64];if(layout==='loose')return [672+Math.floor(cup/2)*88+j%2*44,245+cup%2*176+Math.floor(j/2)*44];if(layout==='cups')return [360+Math.floor(cup/2)*400+j%2*44,245+cup%2*255+Math.floor(j/2)*44];const k=Math.floor(i/16),n=i%16;return [360+k*400+n%2*44,245+Math.floor(n/2)*44];}function cvRegroup(cells,layout,t){cells.forEach((e,i)=>{const [x,y]=cvPosition(i,layout);tw(e,{x,y},t,3,io);});}-function cvGroups(p,n,layout,t){for(let k=0;k<n;k++){const [x,y]=cvPosition(k*(layout==='cups'?8:16),layout),w=60,h=layout==='cups'?108:204,g=G(p,{o:0});mk('rect',{x:x-9,y:y-9,width:w,height:h,rx:8,fill:'none',stroke:COL.task,'stroke-width':2},g);T(g,(layout==='cups'?'1 cup':'1 pint'),{x:x+(w-18)/2,y:y+h+32,size:28,fill:COL.task,anchor:'middle'});show(g,t);}}+function cvGroups(p,n,layout,t){return Array.from({length:n},(_,k)=>{const [x,y]=cvPosition(k*(layout==='cups'?8:16),layout),w=98,h=layout==='cups'?186:362,g=G(p,{o:t>0?0:1});mk('rect',{x:x-9,y:y-9,width:w,height:h,rx:10,fill:'none',stroke:COL.task,'stroke-width':3},g);T(g,(layout==='cups'?'1 cup':'1 pint'),{x:x+40,y:y+h+26,size:32,fill:COL.task,anchor:'middle'});if(t>0)show(g,t);return g;});}+// One pound outline around the gathered counters, its label right under it.+function cvPound(p,t,tl=t){const g=G(p,{o:t>0?0:1}),l=G(p,{o:tl>0?0:1});mk('rect',{x:605,y:265,width:235,height:235,rx:16,fill:'none',stroke:COL.task,'stroke-width':3},g);T(l,'1 lb = 16 oz',{x:722.5,y:560,size:41,fill:COL.task,anchor:'middle'});if(t>0)show(g,t);if(tl>0)show(l,tl);}function cvOz(p,grouped=false){return Array.from({length:16},(_,i)=>{const g=G(p,{x:(grouped?640:300)+i%4*(grouped?55:95),y:300+Math.floor(i/4)*(grouped?55:95)});g.dataset.ounceId='mass-'+i;mk('circle',{r:18,fill:mix(COL.board,COL.whole,.4),stroke:COL.whole,'stroke-width':2},g);return g;});}function cvRows(p,rows,x,y,t,size=32,gap=65){rows.forEach((s,i)=>cvText(p,s,x,y+i*gap,t+i*.35,size));}const BEATS=[['intro','Converting measurements',(m,D)=>{const g=G(scene,{o:0,y:24});T(g,'Unit 2 · Ratios, Proportions, and Percents · Chapter 18',{x:800,y:200,size:28,fill:COL.dim,anchor:'middle'});T(g,'Converting',{x:800,y:345,size:90,weight:600,anchor:'middle'});T(g,'Measurements',{x:800,y:450,size:90,weight:600,anchor:'middle'});cvTape(g,440,545,720,2,'2 feet = 24 inches');tw(g,{o:1,y:0},.2,1,out);cvText(g,'Same quantity · new unit',800,775,m('sub'),39,COL.task,'middle');hide(g,D-.8,.7);}],-['length','Same tape, smaller units',m=>{const p=panel(0);cvTitle(p,'Two feet stays two feet','US customary length · subdivisions change, physical length stays fixed');S.cvTape=cvTape(p,260,325,960,2,'2 ft');cvCuts(S.cvTape,24,m('inches'));cvText(p,'12 inches in each foot · 24 inches altogether',800,545,m('inches',1),37,COL.task,'middle');cvRows(p,['12 in = 1 ft','3 ft = 1 yd','1,760 yd = 1 mi'],600,650,m('yards'),36,60);}],+['length','Same tape, smaller units',m=>{const p=panel(0);cvTitle(p,'Two feet stays two feet','US customary length · subdivisions change, physical length stays fixed');S.cvTape=cvTape(p,260,325,960,2,'2 ft');cvCuts(S.cvTape,24,m('inches'));cvText(p,'12 inches in each foot · 24 inches altogether',800,545,m('inches',1),37,COL.task,'middle');cvText(p,'12 in = 1 ft',600,650,m('yards',-2.5),36);cvRows(p,['3 ft = 1 yd','1,760 yd = 1 mi'],600,710,m('yards'),36,60);}],['larger','Group into larger units',m=>{const p=panel(0);cvTitle(p,'36 inches · 3 feet · 1 yard','Same fixed tape; larger units mean fewer units.');S.cvTape=cvTape(p,260,310,1080,36,'36 in');S.cvFootCuts=cvCuts(S.cvTape,3,m('feet'));cvText(p,'3 feet',800,535,m('feet',1),48,COL.task,'middle');const bracket=path(p,'M260 590V615H1340V590',{stroke:COL.task,'stroke-width':4},{d:0});draw(bracket,m('yard'),1);cvText(p,'1 yard',800,685,m('yard',1),48,COL.task,'middle');cvText(p,'36 ÷ 12 = 3 3 ÷ 3 = 1',800,820,m('yard',2),38,COL.chalk,'middle');}],-['weight','Mass ounces, pounds and short tons',m=>{const p=panel(0);cvTitle(p,'16 ounces = 1 pound','Each counter represents 1 oz of mass; every counter stays.');S.cvOz=cvOz(p);S.cvOz.forEach((e,i)=>tw(e,{x:640+i%4*55,y:300+Math.floor(i/4)*55},m('gather'),3,io));cvText(p,'1 lb = 16 oz',1050,400,m('gather',3),41,COL.task,'middle');cvText(p,'1 US short ton = 2,000 lb',800,715,m('ton'),46,COL.chalk,'middle');cvText(p,'Metric grams and kilograms measure MASS.',800,825,m('ton',2),32,COL.dim,'middle');}],-['capacity','US liquid capacity chain',m=>{const p=panel(0);cvTitle(p,'1 cup = 8 fluid ounces','US liquid measures · each cell represents 1 fl oz');S.cvLiquid=cvLiquid(p,8,'pints');cvText(p,'1 cup',430,530,0,42,COL.whole,'middle');cvRows(p,['3 tsp = 1 tbsp','2 tbsp = 1 fl oz','8 fl oz = 1 cup','2 cups = 1 pt','2 pt = 1 qt','4 qt = 1 US gal'],850,275,m('chain'),34,68);cvText(p,'oz: mass fl oz: liquid volume',800,825,m('different'),37,COL.task,'middle');}],+['weight','Mass ounces, pounds and short tons',m=>{const p=panel(0);cvTitle(p,'16 ounces = 1 pound','Each counter represents 1 oz of mass; every counter stays.');S.cvOz=cvOz(p);S.cvOz.forEach((e,i)=>tw(e,{x:640+i%4*55,y:300+Math.floor(i/4)*55},m('gather'),3,io));cvPound(p,m('gather',3),m('gather',4.5));cvText(p,'1 US short ton = 2,000 lb',800,700,m('ton'),46,COL.chalk,'middle');cvText(p,'Metric grams and kilograms measure MASS.',800,815,m('ton',2),32,COL.dim,'middle');}],+['capacity','US liquid capacity chain',m=>{const p=panel(0);cvTitle(p,'1 cup = 8 fluid ounces','US liquid measures · each cell represents 1 fl oz');S.cvLiquid=cvLiquid(p,8,'one',56);mk('rect',{x:354,y:264,width:152,height:280,rx:14,fill:'none',stroke:COL.task,'stroke-width':3},p);cvText(p,'1 cup · 8 fl oz',430,600,0,40,COL.task,'middle');cvRows(p,['3 tsp = 1 tbsp','2 tbsp = 1 fl oz','8 fl oz = 1 cup','2 cups = 1 pt','2 pt = 1 qt','4 qt = 1 US gal'],850,275,m('chain'),34,68);cvText(p,'oz: mass fl oz: liquid volume',800,825,m('different'),37,COL.task,'middle');}],['q1','Choose the matching inch tape',()=>{const p=panel(0);cvTitle(p,'Match this 2-foot tape','All tapes use the same length scale.');cvTape(p,680,225,240,2,'2 ft');S.cvChoices=[24,12,36].map((n,i)=>{const x=110+i*520,g=G(p);const tape=cvTape(g,x,440,n*10,n,n+' in');g.dataset.inches=String(n);return {el:g,box:[x-30,410,445,220],label:n+' inches',bar:tape.bar};});},{ask:done=>quiz(BAND,[{id:'c-length',prompt:'Which inch tape has the same length as 2 feet?',build:pickEls(S.cvChoices,0,'2 × 12 = 24 inches. The 24-inch tape matches the 2-foot tape.',i=>i===1?'12 inches is only 1 foot. Two feet need two groups of twelve.':'36 inches equals 3 feet, so that tape is too long.')}],done)}],['proportion','A proportion keeps units aligned',m=>{const p=panel(0);cvTitle(p,'How many quarts are in 14 pints?','Every cell below represents 1 pint.');S.cvPints=Array.from({length:14},(_,i)=>{const g=G(p,{x:170+i*88,y:330});g.dataset.pintId='pint-'+i;mk('rect',{width:60,height:70,fill:mix(COL.board,COL.whole,.35),stroke:COL.whole,'stroke-width':2},g);tw(g,{x:170+Math.floor(i/2)*175+i%2*60},m('pair'),2,io);return g;});for(let i=0;i<7;i++){const g=G(p,{o:0});mk('rect',{x:165+i*175,y:320,width:130,height:90,rx:8,fill:'none',stroke:COL.task,'stroke-width':2},g);T(g,'1 qt',{x:230+i*175,y:455,size:28,fill:COL.task,anchor:'middle'});show(g,m('pair',2));}cvMath(p,[F('x quarts','14 pints'),' = ',F('1 quart','2 pints')],800,620,m('ratio'),52);cvMath(p,'2x = 14 x = 7 quarts',800,800,m('solve'),47,COL.task);}],-['chain','48 fluid ounces into cups',m=>{const p=panel(0);cvTitle(p,'Start with 48 fl oz','Every original square = 1 fl oz; square sizes never change.');S.cvLiquid=cvLiquid(p);cvRegroup(S.cvLiquid,'cups',m('cups'));cvGroups(p,6,'cups',m('cups',3));cvText(p,'48 fl oz ÷ (8 fl oz/cup) = 6 cups',800,780,m('step'),43,COL.task,'middle');}],-['chainpints','Six cups into three pints',m=>{const p=panel(0);cvTitle(p,'Same 48 fl oz · regroup the same squares','Six groups of 8 become three groups of 16.');S.cvLiquid=cvLiquid(p,48,'cups');cvRegroup(S.cvLiquid,'pints',m('pints'));cvGroups(p,3,'pints',m('pints',3));cvText(p,'48 fl oz = 6 cups = 3 pints',800,690,m('chain'),50,COL.task,'middle');cvText(p,'48 ÷ 8 = 6 6 ÷ 2 = 3',800,820,m('chain',2),40,COL.chalk,'middle');}],+['chain','48 fluid ounces into cups',m=>{const p=panel(0);cvTitle(p,'Start with 48 fl oz','Every original square = 1 fl oz; square sizes never change.');S.cvLiquid=cvLiquid(p);cvRegroup(S.cvLiquid,'cups',m('cups'));cvGroups(p,6,'cups',m('cups',3));cvText(p,'48 fl oz ÷ (8 fl oz/cup) = 6 cups',800,800,m('step'),43,COL.task,'middle');}],+['chainpints','Six cups into three pints',m=>{const p=panel(0);cvTitle(p,'Same 48 fl oz · regroup the same squares','Six groups of 8 become three groups of 16.');S.cvLiquid=cvLiquid(p,48,'cups');cvGroups(p,6,'cups',0).forEach(g=>hide(g,m('pints')));cvRegroup(S.cvLiquid,'pints',m('pints'));cvGroups(p,3,'pints',m('pints',3));cvText(p,'48 fl oz = 6 cups = 3 pints',800,720,m('chain'),50,COL.task,'middle');cvText(p,'48 ÷ 8 = 6 6 ÷ 2 = 3',800,825,m('chain',2),40,COL.chalk,'middle');}],['q2','Choose the conserved liquid amount',()=>{const p=panel(0);cvTitle(p,'Match 48 fluid ounces','Every small square = 1 fl oz; each outlined group = 1 US liquid pint.');S.cvChoices=[3,6,2].map((n,i)=>{const x=115+i*520,g=G(p);for(let k=0;k<n;k++){const xx=x+k%3*110,yy=295+Math.floor(k/3)*145;mk('rect',{x:xx-6,y:yy-6,width:88,height:88,rx:7,fill:'none',stroke:COL.task,'stroke-width':2},g);for(let j=0;j<16;j++){const e=mk('rect',{x:xx+j%4*19,y:yy+Math.floor(j/4)*19,width:16,height:16,fill:mix(COL.board,COL.whole,.4),stroke:COL.whole,'stroke-width':1},g);e.dataset.flOz='1';}}cvText(g,n+' pints',x+170,605,0,38,COL.whole,'middle');g.dataset.pints=String(n);return {el:g,box:[x-25,260,440,380],label:n+' pints'};});},{ask:done=>quiz(BAND,[{id:'c-liquid',prompt:'Which picture has exactly 48 fl oz?',build:pickEls(S.cvChoices,0,'3 pints × 16 fl oz/pint = 48 fl oz. Every original fluid-ounce cell fits.',i=>i===1?'Six pints contain 96 fl oz. Six CUPS, not six pints, equal 48 fl oz.':'Two pints contain 32 fl oz. You need three groups of sixteen.')}],done)}],['metric','Metric length units',m=>{const p=panel(0);cvTitle(p,'1 centimeter · 10 millimeters','The 1 cm section is drawn larger to see its divisions.');S.cvTape=cvTape(p,350,300,900,1,'1 cm');cvCuts(S.cvTape,10,m('split'));cvText(p,'10 mm = 1 cm',800,550,m('split',1),49,COL.task,'middle');cvRows(p,['100 cm = 1 m','1,000 m = 1 km'],580,695,m('metre'),44,100);}],-['metricmass','Metric mass units',m=>{const p=panel(0);cvTitle(p,'Ten 100-gram blocks · 1 kilogram','Same blocks, same mass.');S.cvMass=Array.from({length:10},(_,i)=>{const g=G(p,{x:290+i*100,y:300});g.dataset.grams='100';mk('rect',{width:85,height:90,fill:mix(COL.board,COL.whole,.4),stroke:COL.whole,'stroke-width':2},g);T(g,'100 g',{x:42,y:140,size:25,fill:COL.whole,anchor:'middle'});return g;});S.cvMass.forEach((g,i)=>tw(g,{x:375+i*85},m('grams'),3,io));cvText(p,'1 kg = 1,000 g',800,585,m('grams'),52,COL.task,'middle');cvText(p,'1,000 mg = 1 g',800,730,m('milli'),47,COL.chalk,'middle');cvText(p,'½ kg = 500 g · mass stays mass',800,835,m('milli',3),32,COL.dim,'middle');}],+['metricmass','Metric mass units',m=>{const p=panel(0);cvTitle(p,'Ten 100-gram blocks · 1 kilogram','Same blocks, same mass.');S.cvMass=Array.from({length:10},(_,i)=>{const g=G(p,{x:290+i*100,y:300});g.dataset.grams='100';mk('rect',{width:85,height:90,fill:mix(COL.board,COL.whole,.4),stroke:COL.whole,'stroke-width':2},g);hide(T(g,'100 g',{x:42,y:140,size:25,fill:COL.whole,anchor:'middle'}),m('grams'),.4);return g;});S.cvMass.forEach((g,i)=>tw(g,{x:375+i*85},m('grams'),3,io));const kg=(x0,x1,y,t)=>{const b=G(p,{o:0});path(b,`M${x0} ${y}V${y+20}H${x1}V${y}`,{stroke:COL.task,'stroke-width':4,fill:'none'});T(b,'1 kg',{x:(x0+x1)/2,y:y+70,size:42,fill:COL.task,anchor:'middle'});show(b,t);return b;};hide(kg(290,1275,465,m('grams',-2.5)),m('grams'),.4);kg(375,1225,410,m('grams',3));cvText(p,'1 kg = 1,000 g',800,600,m('grams',1.5),52,COL.task,'middle');cvText(p,'1,000 mg = 1 g',800,730,m('milli'),47,COL.chalk,'middle');cvText(p,'½ kg = 500 g · mass stays mass',800,835,m('milli',3),32,COL.dim,'middle');}],['metricchain','Kilometers through meters to centimeters',m=>{const p=panel(0);cvTitle(p,'A fixed 3-kilometer tape','Readout changes; this physical length never changes.');S.cvTape=cvTape(p,300,300,1000,3,'3 km');cvMath(p,'3 km × (1,000 m/km) = 3,000 m',800,555,m('metres'),47);cvMath(p,'3,000 m × (100 cm/m) = 300,000 cm',800,700,m('centimetres'),44,COL.task);cvText(p,'Same tape: 3 km = 3,000 m = 300,000 cm',800,830,m('check'),33,COL.whole,'middle');}],-['q3','Choose the matching metric tape',()=>{const p=panel(0);cvTitle(p,'Match the 3-kilometer reference','All bars use the same length scale.');cvTape(p,575,225,450,3,'3 km');S.cvChoices=[300000,3000,30000].map((n,i)=>{const x=90+i*520,g=G(p);const tape=cvTape(g,x,435,n*.0015,1,n.toLocaleString('en-US')+' cm');g.dataset.centimeters=String(n);return {el:g,box:[x-25,400,485,235],label:n+' centimeters',bar:tape.bar};});},{ask:done=>quiz(BAND,[{id:'c-metric',prompt:'Which centimeter bar represents the same 3 km?',build:pickEls(S.cvChoices,0,'3 × 1,000 × 100 = 300,000 cm. The same-scale bar matches.',i=>i===1?'3,000 is the number of METERS. Multiply by 100 to convert those meters to centimeters.':'30,000 cm is only 300 meters. Each kilometer is 100,000 centimeters.')}],done)}],-['crosslength','Exact and rounded length factors',m=>{const p=panel(0);cvTitle(p,'3 inches = 7.62 centimeters exactly','Two scales mark the same conserved physical segment.');S.cvTape=cvTape(p,350,305,762,3,'3 in');const metric=G(p,{o:0});for(let i=0;i<=7;i++){path(metric,`M${350+i*100} 400V425`,{stroke:COL.task,'stroke-width':3});T(metric,String(i),{x:350+i*100,y:465,size:27,fill:COL.task,anchor:'middle'});}path(metric,'M1112 390V430',{stroke:COL.task,'stroke-width':4});T(metric,'7.62 cm',{x:1190,y:465,size:31,fill:COL.task,anchor:'middle'});show(metric,m('cm'));cvText(p,'1 in = 2.54 cm 1 yd = 0.9144 m',800,580,m('cm',1),42,COL.chalk,'middle');cvText(p,'1 m ≈ 3.28 ft 1 mi ≈ 1.61 km',800,735,m('rounded'),41,COL.task,'middle');cvText(p,'= exact ≈ approximate',800,835,m('rounded',2),33,COL.dim,'middle');}],-['crossmass','Mass conversion factors',m=>{const p=panel(0);cvTitle(p,'Same 1-pound mass','Same original 16 mass-ounce counters; new readout.');S.cvOz=cvOz(p,true);cvText(p,'1 lb = 16 oz',1040,400,0,41,COL.whole,'middle');cvRows(p,['1 lb ≈ 453.592 g','1 lb ≈ 0.454 kg'],350,625,m('grams'),43,85);cvText(p,'1 oz ≈ 28.350 g',1090,710,m('ounce'),41,COL.task,'middle');cvText(p,'Rounded factors: state the factor and round the final result.',800,845,m('ounce',2),30,COL.dim,'middle');}],+['q3','Choose the matching metric tape',()=>{const p=panel(0);cvTitle(p,'Match the 3-kilometer reference','All bars use the same length scale.');cvTape(p,350,215,450,3,'3 km',0,true);S.cvChoices=[300000,3000,30000].map((n,i)=>{const x=350,y=365+i*105,g=G(p);const tape=cvTape(g,x,y,n*.0015,1,n.toLocaleString('en-US')+' cm',0,true);g.dataset.centimeters=String(n);return {el:g,box:[x-25,y-17,720,99],label:n+' centimeters',bar:tape.bar};});},{ask:done=>quiz(BAND,[{id:'c-metric',prompt:'Which centimeter bar represents the same 3 km?',build:pickEls(S.cvChoices,0,'3 × 1,000 × 100 = 300,000 cm. The same-scale bar matches.',i=>i===1?'3,000 is the number of METERS. Multiply by 100 to convert those meters to centimeters.':'30,000 cm is only 300 meters. Each kilometer is 100,000 centimeters.')}],done)}],+['crosslength','Exact and rounded length factors',m=>{const p=panel(0);cvTitle(p,'3 inches = 7.62 centimeters exactly','Two scales mark the same conserved physical segment.');S.cvTape=cvTape(p,350,305,762,3,'3 in');const metric=G(p,{o:0});for(let i=0;i<=7;i++){path(metric,`M${350+i*100} 440V465`,{stroke:COL.task,'stroke-width':3});T(metric,String(i),{x:350+i*100,y:505,size:27,fill:COL.task,anchor:'middle'});}path(metric,'M1112 430V470',{stroke:COL.task,'stroke-width':4});T(metric,'7.62 cm',{x:1190,y:505,size:31,fill:COL.task,anchor:'middle'});show(metric,m('cm'));cvText(p,'1 in = 2.54 cm 1 yd = 0.9144 m',800,610,m('cm',1),42,COL.chalk,'middle');cvText(p,'1 m ≈ 3.28 ft 1 mi ≈ 1.61 km',800,735,m('rounded'),41,COL.task,'middle');cvText(p,'= exact ≈ approximate',800,835,m('rounded',2),33,COL.dim,'middle');}],+['crossmass','Mass conversion factors',m=>{const p=panel(0);cvTitle(p,'Same 1-pound mass','Same original 16 mass-ounce counters; new readout.');S.cvOz=cvOz(p,true);cvPound(p,0);cvText(p,'1 lb ≈ 453.592 g',920,350,m('grams'),43);cvText(p,'1 lb ≈ 0.454 kg',920,440,m('grams',6.1),43);cvText(p,'1 oz ≈ 28.350 g',800,690,m('ounce'),43,COL.task,'middle');cvText(p,'Rounded factors: state the factor and round the final result.',800,845,m('ounce',2),30,COL.dim,'middle');}],['crosscapacity','US liquid units to metric volume',m=>{const p=panel(0);cvTitle(p,'One US liquid pint · same liquid','Capacity conversions use fl oz, never mass oz.');const g=G(p);path(g,'M260 260H600L570 625H290Z',{fill:'none',stroke:COL.whole,'stroke-width':4});path(g,'M276 420H584L566 620H294Z',{fill:mix(COL.board,COL.whole,.4),stroke:COL.whole,'stroke-width':2});cvText(p,'1 US pint of liquid',430,705,0,33,COL.whole,'middle');cvRows(p,['1 pt ≈ 473.177 mL','1 pt ≈ 0.473 L','1 fl oz ≈ 29.574 mL','1 US gal ≈ 3.785 L'],810,300,m('metric'),38,105);cvText(p,'Same container · same volume',800,845,m('same'),37,COL.task,'middle');}],-['litres','Nine liters into US gallons',m=>{const p=panel(0);cvTitle(p,'9 liters · how many US liquid gallons?','Given rounded factor: 1 US gal ≈ 3.785 L');S.cvTape=cvTape(p,260,290,1080,1,'9 L');S.cvGallonCuts=G(p,{o:0});[0,3.785,7.57,9].forEach((v,i)=>{const x=260+v*120,e=path(S.cvGallonCuts,`M${x} 270V375`,{stroke:COL.task,'stroke-width':3});e.dataset.liters=String(v);e.dataset.position=String(x);});show(S.cvGallonCuts,m('divide'));cvText(p,'1 gallon',487.1,465,m('divide',1),32,COL.task,'middle');cvText(p,'1 gallon',941.3,465,m('divide',1),32,COL.task,'middle');cvText(p,'part',1254.2,465,m('divide',1),30,COL.task,'middle');cvMath(p,[F('1 gal','3.785 L'),' ≈ ',F('x gal','9 L')],800,620,m('divide',2),53);cvMath(p,'x ≈ 9 ÷ 3.785 ≈ 2.38 US gal',800,795,m('rounded'),49,COL.task);}],+['litres','Nine liters into US gallons',m=>{const p=panel(0);cvTitle(p,'9 liters · how many US liquid gallons?','Given rounded factor: 1 US gal ≈ 3.785 L');S.cvTape=cvTape(p,260,290,1080,1,'9 L');S.cvGallonCuts=G(p,{o:0});[0,3.785,7.57,9].forEach((v,i)=>{const x=260+v*120,e=path(S.cvGallonCuts,`M${x} 270V375`,{stroke:COL.task,'stroke-width':3});e.dataset.liters=String(v);e.dataset.position=String(x);});show(S.cvGallonCuts,m('divide'));cvText(p,'1 gallon',487.1,465,m('divide',1),32,COL.task,'middle');cvText(p,'1 gallon',941.3,465,m('divide',1),32,COL.task,'middle');cvText(p,'part',1254.2,465,m('divide',1),30,COL.task,'middle');cvMath(p,'x ≈ 9 ÷ 3.785 ≈ 2.38 US gal',800,590,m('rounded'),49,COL.task);cvMath(p,[F('1 gal','3.785 L'),' ≈ ',F('x gal','9 L')],800,745,m('rounded',6.6),53);}],['wrap','Four habits for conversions',m=>{const p=panel(0);cvTitle(p,'Same amount · new unit');[['Keep length, mass and capacity in their own unit chains.','w1'],['Write units; match their positions in proportions.','w2'],['Use known factors; check larger unit versus smaller count.','w3'],['Exact: = Rounded: ≈ Follow requested decimal places.','w4']].forEach(([s,key],i)=>{const g=G(p,{x:-16,y:285+i*145,o:0});mk('circle',{cx:130,cy:-10,r:26,fill:COL.task},g);T(g,String(i+1),{x:130,y:0,size:30,anchor:'middle',fill:COL.board});T(g,s,{x:195,size:31});tw(g,{x:0,o:1},m(key),.6);});}],['final1','Chapter practice',()=>panel(0),{ask:done=>quiz(SCREEN,[{id:'p-customary',prompt:'US customary units. Give exact answers.',build:blanks([{parts:['18 feet = ',{box:'216'},' inches'],why:'18 × 12 = 216 inches. The length stays fixed.'},{parts:[{box:'9'},' US gallons = 36 quarts'],why:'36 ÷ 4 = 9 US liquid gallons.'},{parts:['42 teaspoons = ',{box:'7'},' fluid ounces'],why:'3 tsp/tbsp × 2 tbsp/fl oz = 6 tsp/fl oz; 42 ÷ 6 = 7 fl oz.'},{parts:['2.75 miles = ',{box:'14520'},' feet'],why:'1 mile = 1,760 × 3 = 5,280 feet; 2.75 × 5,280 = 14,520 feet.'}-])}],done,'Chapter practice 1 of 3')}],+])}],done,'Chapter practice · set 1 of 3')}],['final2','Chapter practice',()=>panel(0),{ask:done=>quiz(SCREEN,[{id:'p-metric',prompt:'Use the stated factors. Round only the final answer as requested.',build:blanks([{parts:['0.06 km = ',{box:'60000'},' mm (exact)'],why:'0.06 × 1,000 m/km × 1,000 mm/m = 60,000 mm.'},{parts:['25 cm ≈ ',{box:'9.84'},' in; 1 in = 2.54 cm (2 decimal places)'],why:'25 ÷ 2.54 = 9.8425…; nearest hundredth: approximately 9.84 inches.'},{parts:['12 oz ≈ ',{box:'340.2'},' g; 1 oz ≈ 28.35 g (1 decimal place)'],why:'Using the stated rounded factor: 12 × 28.35 = 340.2; approximately 340.2 g.'},{parts:['3.5 US pt ≈ ',{box:'1.6555'},' L; 1 pt ≈ 0.473 L (4 decimal places)'],why:'3.5 × 0.473 = 1.6555; approximately 1.6555 liters using the rounded factor.'}-])}],done,'Chapter practice 2 of 3')}],+])}],done,'Chapter practice · set 2 of 3')}],['final3','Chapter practice',()=>panel(0),{ask:done=>quiz(SCREEN,[{id:'p-context',prompt:'Convert first, then compare. For the hills use 1 m ≈ 3.28 ft; round to 1 decimal place.',build:blanks([{parts:['5-mile hike; already walked 8,200 ft. Remaining: ',{box:'18200'},' ft'],why:'5 × 5,280 = 26,400 ft total; 26,400 − 8,200 = 18,200 ft remain.'},{parts:['Hill heights: 1,375 m and 920 m. Difference ≈ ',{box:'1492.4'},' ft'],why:'1,375 − 920 = 455 m; using 1 m ≈ 3.28 ft gives 455 × 3.28 ≈ 1,492.4 ft. Round to one decimal place.',hint:'For the hills use 1 m ≈ 3.28 ft; round the final answer to 1 decimal place.'}-])}],done,'Chapter practice 3 of 3')}],+])}],done,'Chapter practice · set 3 of 3')}],['finish','Finished',()=>panel(0),{ask:finishCard}]].map(([id,title,run,extra])=>({id,title,run,...extra}));boot();diff --git a/site/math-notebook/ch19/index.html b/site/math-notebook/ch19/index.htmlindex 10538a1..be0a6df 100644--- a/site/math-notebook/ch19/index.html+++ b/site/math-notebook/ch19/index.html@@ -1,5 +1,5 @@<!doctype html>-<html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1"><title>Percent — Elementary Mathematics</title><link rel="stylesheet" href="../lib/engine.css"><link rel="expect" href="#bar" blocking="render"><style>.band .prompt{font-size:27px}.screen .blanks .bline{gap:12px}.screen .blanks .box{width:8ch!important}.screen .blanks .why{font-size:21px}.screen .blanks .bline svg tspan{font-style:normal}</style></head><body>+<html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1"><title>Percent — Elementary Mathematics</title><link rel="stylesheet" href="../lib/engine.css"><link rel="expect" href="#bar" blocking="render"><style>.band .prompt{font-size:27px}.screen .blanks .bline{gap:12px}.screen .blanks .box{width:8ch!important}.screen .blanks .why{font-size:21px}.screen .blanks .bline svg tspan{font-style:normal}.screen .blanks .bline svg.m{zoom:1.2}.screen .blanks .bline svg.m:has(path){zoom:1.45}</style></head><body><script src="../lib/engine.js"></script><script src="audio/en/timings.js"></script><script>'use strict';const CHAPTER={number:19,title:'Percent',minutes:13,language:'en', next: '../ch20/' };@@ -17,45 +17,49 @@ function pcBar(p,x,y,w,n,d=100,t=0,h=110){const g=G(p,{x,y,o:0});g.dataset.fraction=n+'/'+d;const shade=mk('rect',{width:w*n/d,height:h,fill:COL.whole,'fill-opacity':.55},g);shade.dataset.area=String(w*n/d*h);const outline=mk('rect',{width:w,height:h,fill:'none',stroke:COL.chalk,'stroke-width':3},g);const cuts=pcCuts({g,w,h},d,0,COL.dim);show(g,t);return {g,shade,outline,cuts,x,y,w,h,n,d};}-function pcCuts(b,n,t,col=COL.task){const g=G(b.g,{o:0});g.dataset.parts=String(n);for(let i=1;i<n;i++){const e=path(g,`M${i*b.w/n} 0V${b.h}`,{stroke:col,'stroke-width':n>50?1:2});e.dataset.cut=String(i);e.dataset.position=String(i*b.w/n);}show(g,t,.8);return g;}-function pcGridChoices(p,ns){return ns.map((n,i)=>{const x=170+i*480,g=G(p);const model=pcGrid(g,x,295,250,Math.floor(n));if(n%1){const e=mk('rect',{x:Math.floor(n)%10*25,y:Math.floor(n/10)*25,width:25*(n%1),height:25,fill:COL.whole,'fill-opacity':.55},model.g);e.dataset.partialHundredth=String(n%1);}- pcText(g,String.fromCharCode(65+i),x+125,255,0,33,COL.dim,'middle');pcText(g,n+' of 100 cells',x+125,610,0,31,COL.whole,'middle');g.dataset.percent=String(n);return {el:g,box:[x-20,230,290,410],label:n+' percent',model};});}-function pcMovePoint(p,from,start,to,x,y,t){const g=G(p),s=50;for(let i=0;i<from.length;i++)pcText(g,from[i],x+i*s,y,0,58);const dot=pcText(g,'.',x+start*s-15,y,0,48,COL.task);tw(dot,{x:x+to*s-15},t,2,io);return dot;}+function pcCuts(b,n,t,col=COL.task){const g=G(b.g,{o:0}),fine=n>50;g.dataset.parts=String(n);for(let i=1;i<n;i++){const e=path(g,`M${i*b.w/n} 0V${b.h}`,{stroke:fine?COL.dim:col,'stroke-width':fine?1:2,'stroke-opacity':fine?.5:1});e.dataset.cut=String(i);e.dataset.position=String(i*b.w/n);}show(g,t,.8);return g;}+function pcGridChoices(p,ns){return ns.map((n,i)=>{const x=170+i*480,g=G(p);const model=pcGrid(g,x,290,300,Math.floor(n));if(n%1){const e=mk('rect',{x:Math.floor(n)%10*30,y:Math.floor(n/10)*30,width:30*(n%1),height:30,fill:COL.whole,'fill-opacity':.55},model.g);e.dataset.partialHundredth=String(n%1);}+ pcText(g,String.fromCharCode(65+i),x+150,262,0,33,COL.dim,'middle');g.dataset.percent=String(n);return {el:g,box:[x-20,225,340,385],label:n+' percent',model};});}+function pcMovePoint(p,digs,from,to,x,y,t,t1,zero){const g=G(p,{o:0}),s=34.5,dw=15.1,dir=Math.sign(to-from),pos=(i,d)=>x+i*s+(i>=d?dw:0);+ const ds=[...digs].map((c,i)=>{const e=T(g,c,{x:pos(i,from),y,size:58,o:zero==='in'&&i===0?0:1});return e;});const dot=T(g,'.',{x:x+from*s,y,size:58,fill:COL.task});dot.dataset.t1=String(t1);+ for(let k=0,d=from;d!==to;k++,d+=dir){const i=dir<0?d-1:d,t0=t1+k;tw(ds[i],{x:pos(i,d+dir)},t0,1,io);tw(dot,{x:x+(d+dir)*s},t0,1,io);tw(dot,{y:y-48},t0,.5,out);tw(dot,{y},t0+.5,.5,io);}+ const tz=t1+Math.abs(to-from);if(zero==='in')show(ds[0],tz,.5);else if(zero==='out')hide(ds[0],tz,.5);show(g,t);return dot;}const BEATS=[['intro','Percent',(m,D)=>{const g=G(scene,{o:0,y:24});T(g,'Unit 2 · Ratios, Proportions, and Percents · Chapter 19',{x:800,y:220,size:28,fill:COL.dim,anchor:'middle'});T(g,'Percent',{x:800,y:380,size:94,weight:600,anchor:'middle'});pcMath(g,['37% = ',F('37','100'),' = 0.37'],800,525,.3,65,COL.whole);tw(g,{o:1,y:0},.2,1,out);pcText(g,'Three forms · one amount',800,715,m('sub'),40,COL.task,'middle');hide(g,D-.8,.7);}],['hundred','Per hundred',m=>{const p=panel(0);pcTitle(p,'Percent means per hundred','One square = one whole · 100 equal cells');S.pcHundred=pcGrid(p,210,250,460,0,0,'garden');pcShade(S.pcHundred,37,m('shade'));pcMath(p,['37% = ',F('37','100')],1110,375,m('names'),60,COL.whole);pcMath(p,'= 0.37',1110,510,m('names',2),60);pcText(p,'100% = 1 0% = 0',1110,680,m('whole'),36,COL.task,'middle');pcText(p,'The whole sets the meaning of 100%.',800,825,m('whole',2),34,COL.dim,'middle');}],-['fraction','Simplify without changing area',m=>{const p=panel(0);pcTitle(p,'40% · forty of one hundred cells','The same forty original cells stay shaded.');S.pcForty=pcGrid(p,210,250,460,40,0,'forty');S.pcGroups=G(p,{o:0});for(let i=0;i<5;i++){const e=mk('rect',{x:210,y:250+i*92,width:460,height:92,fill:'none',stroke:COL.task,'stroke-width':4},S.pcGroups);e.dataset.groupCells='20';}show(S.pcGroups,m('groups'));pcMath(p,['40% = ',F('40','100')],1110,340,0,57,COL.whole);pcMath(p,[F('40 ÷ 20','100 ÷ 20'),' = ',F('2','5')],1110,515,m('simplify'),54);pcText(p,'Two of five equal groups',1110,650,m('simplify',2),32,COL.task,'middle');pcText(p,'Percent as fraction: number over 100, then simplify.',800,825,m('rule'),34,COL.dim,'middle');}],+['fraction','Simplify without changing area',m=>{const p=panel(0);pcTitle(p,'40% · forty of one hundred cells','The same forty original cells stay shaded.');S.pcForty=pcGrid(p,210,250,460,40,0,'forty');S.pcGroups=G(p,{o:0});for(let i=0;i<5;i++){const e=mk('rect',{x:210,y:250+i*92,width:460,height:92,fill:'none',stroke:COL.task,'stroke-width':4},S.pcGroups);e.dataset.groupCells='20';}show(S.pcGroups,m('groups'));pcMath(p,['40% = ',F('40','100')],1110,340,0,57,COL.whole);pcMath(p,[F('40 ÷ 20','100 ÷ 20'),' = ',F('2','5')],1110,515,m('simplify'),54);pcText(p,'Two of five equal groups',1110,650,m('groups',4.5),32,COL.task,'middle');pcText(p,'Percent as fraction: number over 100, then simplify.',800,825,m('rule'),34,COL.dim,'middle');}],['q1','Choose forty percent',()=>{const p=panel(0);pcTitle(p,'Each square is ONE whole','Same size · 100 equal cells in every square');S.pcChoices=pcGridChoices(p,[40,4,60]);},{ask:done=>quiz(BAND,[{id:'c-hundred',prompt:'Which picture shows 40% of one whole?',build:pickEls(S.pcChoices,0,'40% means forty of one hundred equal cells. Picture A fills four complete rows.',i=>i===1?'Four cells out of one hundred is 4%, not 40%. Forty needs four full rows.':'Sixty cells is 60%. For 40%, fill forty and leave sixty unfilled.')}],done)}],['equivalent','Build an equivalent fraction',m=>{const p=panel(0);pcTitle(p,'Seven twentieths · same strip, smaller pieces');S.pcEquivalent=pcBar(p,220,290,1120,7,20);S.pcSubcuts=pcCuts(S.pcEquivalent,100,m('split'));pcText(p,'20 × 5 = 100 equal pieces',800,520,m('split',1),38,COL.task,'middle');pcMath(p,[F('7','20'),' = ',F('7 × 5','20 × 5'),' = ',F('35','100'),' = 35%'],800,680,m('result'),61,COL.whole);pcText(p,'Same blue area. Both fraction numbers get the same factor.',800,825,m('check'),32,COL.dim,'middle');}],-['divide','Any fraction can use division',m=>{const p=panel(0);pcTitle(p,'Three eighths is exactly 37.5%','One strip = 1 whole · the half-hundredth is real');S.pcEighth=pcBar(p,220,290,1120,3,8);pcMath(p,[F('3','8'),' = 3 ÷ 8 = 0.375'],800,550,m('decimal'),58);pcMath(p,'0.375 × 100 = 37.5',800,685,m('percent'),60,COL.whole);pcText(p,'Percent form: 37.5%',800,760,m('percent',1),30,COL.whole,'middle');pcCuts(S.pcEighth,100,m('cuts'));pcText(p,'37 complete hundredths + ½ of the next',800,825,m('cuts',1),35,COL.task,'middle');}],-['decimal','Percent to decimal',m=>{const p=panel(0);pcTitle(p,'68% battery · the same charge in decimal form');S.pcBattery=pcBar(p,220,275,1120,68);pcMath(p,['68% = ',F('68','100')],420,550,m('fraction'),55);pcMath(p,'68 ÷ 100 = 0.68',1130,550,m('divide'),55,COL.whole);S.pcLeftDot=pcMovePoint(p,'068',3,1,700,720,m('divide'));pcText(p,'÷ 100 · two places LEFT',1060,720,m('divide'),31,COL.task);pcText(p,'The amount stays 68 hundredths of ONE whole.',800,835,m('same'),33,COL.dim,'middle');}],+['divide','Any fraction can use division',m=>{const p=panel(0);pcTitle(p,'Three eighths is exactly 37.5%','One strip = 1 whole · the half-hundredth is real');S.pcEighth=pcBar(p,220,240,1120,3,8,0,100);const e1=pcMath(p,[F('3','8'),' = 3 ÷ 8 = 0.375'],800,500,m('decimal'),54),e2=pcMath(p,'0.375 × 100 = 37.5 → 37.5%',800,650,m('percent'),52,COL.whole);[e1,e2].forEach(e=>tw(e,{x:470},m('cuts',.3),1.2,io));pcCuts(S.pcEighth,100,m('cuts'));+ const z=G(p,{o:0});mk('rect',{x:612,y:240,width:44.8,height:100,fill:'none',stroke:COL.task,'stroke-width':3},z);path(z,'M612 340L880 520M656.8 340L1320 520',{stroke:COL.task,'stroke-width':2,'stroke-opacity':.6});S.pcZoom=pcBar(z,880,520,440,2.5,4,0,110);for(let i=0;i<=4;i++)T(z,(35+i)+'%',{x:880+i*110,y:670,size:26,fill:COL.dim,anchor:'middle'});show(z,m('cuts',1.5));pcText(p,'37 complete hundredths + ½ of the next',800,825,m('cuts',1),35,COL.task,'middle');}],+['decimal','Percent to decimal',m=>{const p=panel(0);pcTitle(p,'68% battery · the same charge in decimal form');S.pcBattery=pcBar(p,220,260,1120,68);mk('rect',{x:1342,y:288,width:20,height:54,rx:5,fill:COL.chalk},p);pcMath(p,['68% = ',F('68','100')],520,530,m('fraction'),55);pcMath(p,'68 ÷ 100 = 0.68',1080,530,m('divide'),55,COL.whole);S.pcLeftDot=pcMovePoint(p,'068',3,1,600,700,m('divide'),m('divide',3.9),'in');pcText(p,'÷ 100 · two places LEFT',800,700,m('divide',3.9),34,COL.task);pcText(p,'The amount stays 68 hundredths of ONE whole.',800,835,m('same'),33,COL.dim,'middle');}],['q2','Choose six percent',()=>{const p=panel(0);pcTitle(p,'Match 0.06 of one whole','One square = 1 · a partial cell must have its true area');S.pcChoices=pcGridChoices(p,[6,60,.6]);},{ask:done=>quiz(BAND,[{id:'c-decimal',prompt:'Which picture equals the decimal 0.06?',build:pickEls(S.pcChoices,0,'0.06 is six hundredths, so it equals 6%. Six of the hundred cells are filled.',i=>i===1?'Sixty hundredths is 0.60, or 60%. That is ten times the asked share.':'0.6% is six tenths of ONE hundredth cell. Its decimal is 0.006, ten times smaller than 0.06.')}],done)}],-['back','Decimal to percent',m=>{const p=panel(0);pcTitle(p,'0.42 of one whole · forty-two hundredths');S.pcBack=pcBar(p,220,270,1120,42);pcMath(p,'0.42 × 100 = 42',800,520,m('percent'),62,COL.whole);pcText(p,'Percent form: 42%',800,585,m('percent',1),32,COL.whole,'middle');S.pcRightDot=pcMovePoint(p,'042',1,3,250,670,m('moves'));pcText(p,'× 100 · two places RIGHT',670,670,m('moves'),34,COL.task);pcText(p,'0.07 = 7% 1.2 = 120%',800,770,m('moves',3),40);pcText(p,'Decimal and percent are names for the same ratio.',800,845,m('meaning'),31,COL.dim,'middle');}],+['back','Decimal to percent',m=>{const p=panel(0);pcTitle(p,'0.42 of one whole · forty-two hundredths');S.pcBack=pcBar(p,220,270,1120,42);pcMath(p,'0.42 × 100 = 42 → 42%',800,520,m('percent'),62,COL.whole);S.pcRightDot=pcMovePoint(p,'042',1,3,500,670,m('moves'),m('moves',.6),'out');pcText(p,'× 100 · two places RIGHT',690,670,m('moves'),34,COL.task);pcText(p,'0.07 = 7% 1.2 = 120%',800,770,m('moves',3),40);pcText(p,'Decimal and percent are names for the same ratio.',800,845,m('meaning'),31,COL.dim,'middle');}],['partial','A percent with a decimal point',m=>{const p=panel(0);pcTitle(p,'2.5% means two and a half hundredths','Top strip: one whole = 100%');S.pcSmall=pcBar(p,260,250,1000,0);tw(S.pcSmall.shade,{'a_width':25},m('fill'),1.5,io);const inset=G(p,{o:0});S.pcInset=pcBar(inset,260,505,600,2.5,3,0,135);show(inset,m('zoom'));pcText(p,'ENLARGED: first three 1% cells',560,475,m('zoom'),28,COL.task,'middle');pcText(p,'Each inset cell = 1% of the whole',560,700,m('zoom',1),29,COL.dim,'middle');pcMath(p,'2.5% = 0.025',1160,550,m('convert'),47,COL.whole);pcMath(p,[F('2.5','100'),' = ',F('25','1000'),' = ',F('1','40')],1160,700,m('convert',2),49);pcText(p,'Divide by 100 even when the percent has a decimal point.',800,835,m('convert',4),32,COL.dim,'middle');}],['tiny','A tiny percent',m=>{const p=panel(0);pcTitle(p,'0.004% · keep the leading zeros');pcMath(p,'0.004% = 0.004 ÷ 100 = 0.00004',800,300,m('convert'),58,COL.whole);const g=G(p,{o:0});path(g,'M260 555H1260',{stroke:COL.chalk,'stroke-width':3});for(let i=0;i<=5;i++){path(g,`M${260+i*200} 540V570`,{stroke:COL.dim,'stroke-width':2});T(g,(i*.002).toFixed(3)+'%',{x:260+i*200,y:620,size:26,anchor:'middle'});}S.pcTinyDot=mk('circle',{cx:660,cy:555,r:13,fill:COL.whole},g);S.pcTinyDot.dataset.percent='.004';T(g,'0.004%',{x:660,y:505,size:34,fill:COL.whole,anchor:'middle'});show(g,m('scale'));pcText(p,'MAGNIFIED SCALE: 0% to 0.01% only',800,430,m('scale'),32,COL.task,'middle');pcMath(p,['0.00004 = ',F('1','25000')],800,735,m('fraction'),54);pcText(p,'Below 1% means below 0.01 of a whole.',800,835,m('fraction',2),34,COL.dim,'middle');}],-['beyond','More than one hundred percent',m=>{const p=panel(0);pcTitle(p,'160% · one whole plus sixty hundredths','Every full strip is the same reference whole.');S.pcFull=pcBar(p,150,280,600,100);S.pcExtra=pcBar(p,850,280,600,60,100,m('extra'));pcText(p,'100%',450,450,0,40,COL.whole,'middle');pcText(p,'60%',1150,450,m('extra'),40,COL.whole,'middle');pcMath(p,['160% = ',F('160','100'),' = ',F('8','5'),' = 1.6'],800,620,m('names'),62);pcText(p,'1.6 kilometers is 160% of a 1-kilometer reference.',800,770,m('context'),33,COL.task,'middle');pcText(p,'100% identifies the reference whole; it is not always a maximum.',800,840,m('context',2),30,COL.dim,'middle');}],-['q3','Choose one hundred sixty percent',()=>{const p=panel(0);pcTitle(p,'Reference: one full strip = 100%','All strips use the same length scale.');pcBar(p,620,205,180,100,100,0,90);S.pcChoices=[160,16,60].map((n,i)=>{const x=120+i*480,g=G(p);pcBar(g,x,400,180,Math.min(n,100),100,0,90);if(n>100)pcBar(g,x+200,400,180,n-100,100,0,90);pcText(g,String.fromCharCode(65+i),x+170,355,0,32,COL.dim,'middle');pcText(g,n/100+' wholes',x+170,590,0,33,COL.whole,'middle');g.dataset.percent=String(n);return {el:g,box:[x-20,310,410,330],label:n+' percent'};});},{ask:done=>quiz(BAND,[{id:'c-beyond',prompt:'Which picture represents 160% of the reference whole?',build:pickEls(S.pcChoices,0,'160% is 1.6 wholes: one complete strip plus sixty hundredths of another equal strip.',i=>i===1?'0.16 of a whole is 16%. Divide 160 by 100 to get 1.6, not 0.16.':'0.6 of a whole is only 60%. Include the complete first whole as well.')}],done)}],-['context','Observed shares',m=>{const p=panel(0);pcTitle(p,'9 of 12 seeds sprouted','One strip = all 12 seeds · blue = sprouted');S.pcSeeds=pcBar(p,200,280,1200,9,12);pcCuts(S.pcSeeds,4,m('groups'));pcMath(p,[F('9','12'),' = ',F('3','4'),' = ',F('75','100'),' = 75%'],800,565,m('hundred'),61,COL.whole);pcCuts(S.pcSeeds,100,m('hundred'));pcMath(p,[F('3','12'),' = ',F('1','4'),' = 25%'],800,710,m('rest'),53);pcText(p,'Sprouted 75% + not sprouted 25% = 100%',800,830,m('rest',2),37,COL.task,'middle');}],-['rounding','Rounding a percent',m=>{const p=panel(0);pcTitle(p,'5 of 9 sketches use watercolors','Exact share: five ninths · round only the final percent');S.pcRound=pcBar(p,220,255,900,5,9);pcMath(p,[F('5','9'),' = 0.',OV('5')],1290,310,m('decimal'),55);pcMath(p,['0.',OV('5'),' × 100 = 55.',OV('5')],800,550,m('percent'),56);pcText(p,'Percent form: 55.555…%',800,625,m('percent',1),31,COL.whole,'middle');const guide=G(p,{o:0});path(guide,'M724 240V390',{stroke:COL.task,'stroke-width':3});T(guide,'56% guide',{x:900,y:425,size:30,fill:COL.task,anchor:'middle'});path(guide,'M900 395L724 375',{stroke:COL.task,'stroke-width':2});show(guide,m('round'));S.pcRoundGuide=guide;pcMath(p,'≈ 56% (nearest whole percent)',800,710,m('round'),53,COL.task);pcText(p,'Exact blue endpoint: 55.555…% · rounded guide: 56%',800,835,m('round',2),32,COL.dim,'middle');}],+['beyond','More than one hundred percent',m=>{const p=panel(0);pcTitle(p,'160% · one whole plus sixty hundredths','Every full strip is the same reference whole.');S.pcFull=pcBar(p,150,280,600,100);S.pcExtra=pcBar(p,850,280,600,60,100,m('extra'));pcText(p,'100%',450,450,0,40,COL.whole,'middle');pcText(p,'60%',1150,450,m('extra'),40,COL.whole,'middle');pcMath(p,['160% = ',F('160','100'),' = ',F('8','5'),' = 1',F('3','5'),' = 1.6'],800,620,m('names'),62);pcText(p,'1.6 kilometers is 160% of a 1-kilometer reference.',800,770,m('context'),33,COL.task,'middle');pcText(p,'100% identifies the reference whole; it is not always a maximum.',800,840,m('context',2),30,COL.dim,'middle');}],+['q3','Choose one hundred sixty percent',()=>{const p=panel(0);pcTitle(p,'Reference: one full strip = 100%','All strips use the same length scale.');pcBar(p,710,215,180,100,100,0,90);S.pcChoices=[160,16,60].map((n,i)=>{const x=[170,710,1150][i],g=G(p),w=n>100?380:180;pcBar(g,x,420,180,Math.min(n,100),100,0,90);if(n>100)pcBar(g,x+200,420,180,n-100,100,0,90);pcText(g,String.fromCharCode(65+i),x+w/2,385,0,32,COL.dim,'middle');g.dataset.percent=String(n);return {el:g,box:[x-20,345,w+40,190],label:n+' percent'};});},{ask:done=>quiz(BAND,[{id:'c-beyond',prompt:'Which picture represents 160% of the reference whole?',build:pickEls(S.pcChoices,0,'160% is 1.6 wholes: one complete strip plus sixty hundredths of another equal strip.',i=>i===1?'0.16 of a whole is 16%. Divide 160 by 100 to get 1.6, not 0.16.':'0.6 of a whole is only 60%. Include the complete first whole as well.')}],done)}],+['context','Observed shares',m=>{const p=panel(0);pcTitle(p,'9 of 12 seeds sprouted','One strip = all 12 seeds · blue = sprouted');S.pcSeeds=pcBar(p,200,280,1200,9,12);pcCuts(S.pcSeeds,4,m('groups'));pcMath(p,[F('9','12'),' = ',F('3','4'),' = ',F('75','100'),' = 75%'],800,565,m('hundred'),61,COL.whole);pcMath(p,[F('3','12'),' = ',F('1','4'),' = 25%'],800,710,m('rest'),53);pcText(p,'Sprouted 75% + not sprouted 25% = 100%',800,830,m('rest',2),37,COL.task,'middle');}],+['rounding','Rounding a percent',m=>{const p=panel(0);pcTitle(p,'5 of 9 sketches use watercolors','Exact share: five ninths · round only the final percent');S.pcRound=pcBar(p,220,230,900,5,9,0,100);pcMath(p,[F('5','9'),' = 0.',OV('5')],1290,295,m('decimal'),55);pcMath(p,['0.',OV('5'),' × 100 = 55.',OV('5'),' → 55.',OV('5'),'%'],800,665,m('percent'),54);const guide=G(p,{o:0});path(guide,'M724 215V345',{stroke:COL.task,'stroke-width':3});mk('rect',{x:706,y:230,width:36,height:100,fill:'none',stroke:COL.task,'stroke-width':2},guide);path(guide,'M706 330L484 420M742 330L964 420',{stroke:COL.task,'stroke-width':2,'stroke-opacity':.6});S.pcRoundInset=pcBar(guide,484,420,480,14/9,4,0,100);path(guide,'M724 405V535',{stroke:COL.task,'stroke-width':4});for(let i=0;i<=4;i++)T(guide,(54+i)+'%',{x:484+i*120,y:572,size:26,fill:i===2?COL.task:COL.dim,anchor:'middle'});show(guide,m('round'));S.pcRoundGuide=guide;pcMath(p,'≈ 56% (nearest whole percent)',800,755,m('round'),50,COL.task);pcText(p,'Exact blue endpoint: 55.555…% · rounded guide: 56%',800,840,m('round',2),32,COL.dim,'middle');}],['wrap','Four percent connections',m=>{const p=panel(0);pcTitle(p,'Three forms · one amount');[['Percent means per hundred. First identify ONE whole.','w1'],['Percent as a fraction: number over 100; simplify.','w2'],['Percent ÷ 100 = decimal. Decimal × 100 = percent number.','w3'],['Fraction: divide top by bottom. Round only when asked.','w4']].forEach(([s,key],i)=>{const g=G(p,{x:-16,y:285+i*145,o:0});mk('circle',{cx:130,cy:-10,r:26,fill:COL.task},g);T(g,String(i+1),{x:130,y:0,size:30,anchor:'middle',fill:COL.board});T(g,s,{x:195,size:31});tw(g,{x:0,o:1},m(key),.6);});}],['final1','Chapter practice',()=>panel(0),{ask:done=>quiz(SCREEN,[{id:'p-from',prompt:'Convert. Fractions must be in lowest terms; decimals exact.',build:blanks([{parts:['32% = ',{box:'8/25',lowest:true},' (fraction)'],why:'32/100 simplifies by dividing numerator and denominator by 4: 8/25.'},{parts:['180% = ',{box:'9/5',lowest:true},' (fraction)'],why:'180/100 = 9/5 = 1 4/5. Values above 100% are greater than one whole.'},{parts:['7.2% = ',{box:'0.072'},' (decimal)'],why:'7.2 ÷ 100 = 0.072. The decimal point moves two places left.'},{parts:['0.006% = ',{box:'0.00006'},' (decimal)'],why:'0.006 ÷ 100 = 0.00006. Keep the leading zeros.'}-])}],done,'Chapter practice 1 of 3')}],+])}],done,'Chapter practice · set 1 of 3')}],['final2','Chapter practice',()=>panel(0),{ask:done=>quiz(SCREEN,[{id:'p-to',prompt:'Write each as a percent. Type the number before the printed % sign.',build:blanks([{parts:[F('7','20'),' = ',{box:'35'},'%'],why:'7/20 = 35/100 = 35%.'},{parts:[F('7','16'),' = ',{box:'43.75'},'%'],why:'7 ÷ 16 = 0.4375; multiply by 100 to get 43.75%.'},{parts:['0.009 = ',{box:'0.9'},'%'],why:'0.009 × 100 = 0.9, so the percent is 0.9%.'},{parts:['1.35 = ',{box:'135'},'%'],why:'1.35 × 100 = 135, so it is 135% of the reference whole.'}-])}],done,'Chapter practice 2 of 3')}],+])}],done,'Chapter practice · set 2 of 3')}],['final3','Chapter practice',()=>panel(0),{ask:done=>quiz(SCREEN,[{id:'p-shares',prompt:'Describe each share. Only the vote question asks for rounding.',build:blanks([{parts:['12 of 15 puzzles solved: ',{box:'80'},'% solved'],why:'12/15 = 4/5 = 0.8 = 80%.'},{parts:['14 of 20 tiles blue: ',{box:'30'},'% NOT blue'],why:'20 − 14 = 6 tiles are not blue; 6/20 = 0.3 = 30%.'},{parts:['4 of 7 votes: ≈ ',{box:'57'},'% (nearest whole percent)'],why:'4/7 × 100 = 57.142857…; nearest whole percent is approximately 57%.'},{parts:['1.5% = ',{box:'3/200',lowest:true},' of a whole (lowest terms)'],why:'1.5/100 = 15/1000 = 3/200. A decimal percent is still per hundred.'}-])}],done,'Chapter practice 3 of 3')}],+])}],done,'Chapter practice · set 3 of 3')}],['finish','Finished',()=>panel(0),{ask:finishCard}]].map(([id,title,run,extra])=>({id,title,run,...extra}));boot();diff --git a/site/math-notebook/ch20/index.html b/site/math-notebook/ch20/index.htmlindex a0c2afe..a1c7153 100644--- a/site/math-notebook/ch20/index.html+++ b/site/math-notebook/ch20/index.html@@ -9,43 +9,44 @@ const wwMath=(p,s,x,y,t=0,size=52,col=COL.chalk)=>{const e=M(p,Array.isArray(s)?const wwTitle=(p,s,sub='')=>{wwText(p,s,100,110,.1,43);if(sub)wwText(p,sub,100,165,.15,27,COL.dim);};function wwBar(p,x,y,w,part,whole,t=0,h=110,cuts=10){const g=G(p,{x,y,o:0});g.dataset.whole=String(whole);g.dataset.part=String(part);const shade=mk('rect',{width:w*part/whole,height:h,fill:COL.whole,'fill-opacity':.55},g);const outline=mk('rect',{width:w,height:h,fill:'none',stroke:COL.chalk,'stroke-width':3},g);const lines=G(g);for(let i=1;i<cuts;i++)path(lines,`M${w*i/cuts} 0V${h}`,{stroke:COL.dim,'stroke-width':2});show(g,t);return {g,shade,outline,lines,w,h,part,whole};}function wwRoleBar(p,part,whole,unit='meters',y=285){const b=wwBar(p,220,y,1160,part,whole);wwText(p,'WHOLE: '+whole+' '+unit+' = 100%',800,y-35,0,34,COL.chalk,'middle');wwText(p,'PART: '+part+' '+unit,220+1160*part/whole/2,y+165,0,34,COL.whole,'middle');return b;}-function wwChoices(p,parts,whole){return parts.map((n,i)=>{const x=140+i*480,g=G(p),b=wwBar(g,x,340,360,n,whole,0,110);wwText(g,String.fromCharCode(65+i),x+180,265,0,34,COL.dim,'middle');wwText(g,'whole '+whole+' meters',x+180,315,0,29,COL.chalk,'middle');wwText(g,'blue '+n+' meters',x+180,515,0,31,COL.whole,'middle');return {el:g,box:[x-20,225,400,360],label:'Picture '+String.fromCharCode(65+i)+', blue '+n+' of '+whole+' meters',bar:b};});}-function wwCounters(p){const groups=[];for(let i=0;i<10;i++){const x=190+(i%5)*250,y=i<5?300:560,g=G(p,{o:i<4?1:0});g.dataset.groupId='group-'+i;const counters=[];for(let j=0;j<3;j++){const k=i*3+j,c=G(g,{x:i<4?200+k*100:x+j*52,y:i<4?340:y});c.dataset.counterId='unit-'+k;c.dataset.amount='1';mk('circle',{r:18,fill:i<4?COL.whole:COL.faint,stroke:i<4?COL.whole:COL.chalk,'stroke-width':2},c);counters.push(c);}const outline=G(g,{o:0});mk('rect',{x:x-25,y:y-42,width:155,height:90,rx:9,fill:'none',stroke:COL.task,'stroke-width':2.5},outline);T(outline,'10% = 3 units',{x:x+52,y:y+100,size:25,fill:COL.task,anchor:'middle'});groups.push({g,counters,outline,x,y});}return groups;}+// labels(n,i): the text under each strip (q1: the blue amount; q2: the percent), so a choice never repeats the prompt.+function wwChoices(p,parts,whole,labels){return parts.map((n,i)=>{const x=140+i*480,g=G(p),b=wwBar(g,x,340,360,n,whole,0,110),[s,col,aria]=labels(n,i);wwText(g,String.fromCharCode(65+i),x+180,265,0,34,COL.dim,'middle');wwText(g,'whole '+whole+' meters',x+180,315,0,29,COL.chalk,'middle');wwText(g,s,x+180,520,0,36,col,'middle');return {el:g,box:[x-20,225,400,360],label:'Picture '+String.fromCharCode(65+i)+', '+aria,bar:b};});}+function wwCounters(p){const groups=[];for(let i=0;i<10;i++){const x=210+(i%5)*265,y=i<5?330:530,g=G(p,{o:i<4?1:0});g.dataset.groupId='group-'+i;const counters=[];for(let j=0;j<3;j++){const k=i*3+j,c=G(g,{x:i<4?250+k*100:x+j*60,y});c.dataset.counterId='unit-'+k;c.dataset.amount='1';mk('circle',{r:22,fill:i<4?COL.whole:COL.faint,stroke:i<4?COL.whole:COL.chalk,'stroke-width':2},c);counters.push(c);}const outline=G(g,{o:0});mk('rect',{x:x-32,y:y-50,width:184,height:100,rx:10,fill:'none',stroke:COL.task,'stroke-width':3},outline);groups.push({g,counters,outline,x,y});}return groups;}const BEATS=[-['intro','Percent Word Problems',(m,D)=>{const g=G(scene,{o:0,y:24});T(g,'Unit 2 · Ratios, Proportions, and Percents · Chapter 20',{x:800,y:195,size:28,fill:COL.dim,anchor:'middle'});T(g,'Percent Word',{x:800,y:330,size:85,weight:600,anchor:'middle'});T(g,'Problems',{x:800,y:440,size:85,weight:600,anchor:'middle'});T(g,'part = decimal rate × whole',{x:800,y:590,size:48,fill:COL.task,anchor:'middle'});tw(g,{o:1,y:0},.2,1,out);wwText(g,'Find the missing role · check its meaning',800,745,m('sub'),35,COL.dim,'middle');hide(g,D-.8,.7);}],-['roles','Three roles',m=>{const p=panel(0);wwTitle(p,'One route · three roles','One full strip represents 80 meters');S.wwRoles=wwBar(p,220,295,1160,24,80);wwText(p,'WHOLE: 80 meters = 100%',800,255,m('whole'),36,COL.chalk,'middle');wwText(p,'PART: 24 meters',394,470,m('part'),33,COL.whole,'middle');wwText(p,'RATE: 30% = 0.30',1070,485,m('rate'),40,COL.task,'middle');wwMath(p,'24 = 0.30 × 80',800,665,m('equation'),65);wwText(p,'part = decimal rate × whole',800,810,m('equation',2),36,COL.dim,'middle');}],-['translate','Words into a comparison',m=>{const p=panel(0);wwTitle(p,'What is 30% of 80?','Useful cues in this percent sentence · roles still come first');[['What',400,COL.whole],['is',630,COL.chalk],['30%',780,COL.task],['of',995,COL.chalk],['80',1140,COL.chalk]].forEach(([word,x,col])=>wwText(p,word,x,310,0,64,col,'middle'));wwText(p,'unknown part: x',210,485,m('unknown'),34,COL.whole);wwText(p,'is: =',600,485,m('is'),34);wwText(p,'of: ×',1030,485,m('of'),34);wwMath(p,'30% = 0.30',800,605,m('decimal'),49,COL.task);wwMath(p,'x = 0.30 × 80',800,720,m('roles'),64);wwText(p,'Identify the whole, part and rate; do not rely only on keywords.',800,835,m('roles',2),29,COL.dim,'middle');}],+['intro','Percent Word Problems',(m,D)=>{const g=G(scene,{o:0,y:24});T(g,'Unit 2 · Ratios, Proportions, and Percents · Chapter 20',{x:800,y:195,size:28,fill:COL.dim,anchor:'middle'});T(g,'Percent Word',{x:800,y:330,size:85,weight:600,anchor:'middle'});T(g,'Problems',{x:800,y:450,size:85,weight:600,anchor:'middle'});T(g,'part = decimal rate × whole',{x:800,y:590,size:48,fill:COL.task,anchor:'middle'});tw(g,{o:1,y:0},.2,1,out);wwText(g,'Find the missing role · check its meaning',800,745,m('sub'),35,COL.dim,'middle');hide(g,D-.8,.7);}],+['roles','Three roles',m=>{const p=panel(0);wwTitle(p,'One route · three roles','One full strip represents 80 meters');S.wwRoles=wwBar(p,220,295,1160,24,80);wwText(p,'WHOLE: 80 meters = 100%',800,255,m('whole'),36,COL.chalk,'middle');wwText(p,'PART: 24 meters',394,470,m('part'),33,COL.whole,'middle');wwText(p,'RATE: 30% = 0.30',394,530,m('rate'),36,COL.task,'middle');wwMath(p,'24 = 0.30 × 80',800,665,m('equation'),65);wwText(p,'part = decimal rate × whole',800,810,m('equation',2),36,COL.dim,'middle');}],+['translate','Words into a comparison',m=>{const p=panel(0);wwTitle(p,'What is 30% of 80?','Useful cues in this percent sentence · roles still come first');const X=[480,660,820,980,1140];[['What',COL.whole],['is',COL.chalk],['30%',COL.task],['of',COL.chalk],['80?',COL.chalk]].forEach(([word,col],i)=>wwText(p,word,X[i],310,0,64,col,'middle'));[['x','unknown part','unknown',COL.whole],['=','equals','is',COL.chalk],['30%','','of',COL.task],['×','times','of',COL.chalk],['80','','of',COL.chalk]].forEach(([sym,cap,key,col],i)=>{wwText(p,sym,X[i],425,m(key),58,col,'middle');if(cap)wwText(p,cap,X[i],475,m(key),26,COL.dim,'middle');});wwMath(p,'30% = 0.30',800,600,m('decimal'),49,COL.task);wwMath(p,'x = 0.30 × 80',800,720,m('decimal',3.8),64);wwText(p,'Identify the whole, part and rate; do not rely only on keywords.',800,835,m('roles',2),29,COL.dim,'middle');}],['part','Find the part',m=>{const p=panel(0);wwTitle(p,'Find 30% of an 80-meter route','The whole stays 80 meters throughout.');S.wwPart=wwBar(p,220,280,1160,0,80);hide(S.wwPart.lines,0,0);show(S.wwPart.lines,m('tens'));wwText(p,'10 equal groups · each 10% = 8 meters',800,470,m('tens'),37,COL.task,'middle');for(let i=0;i<3;i++){const r=mk('rect',{x:i*116,y:0,width:116,height:110,fill:COL.whole,'fill-opacity':.55},S.wwPart.g);r.dataset.selectedGroup=String(i);put(r,{o:0});show(r,m('select')+i*.8,.5);}wwMath(p,'3 × 8 = 24',800,635,m('answer'),64,COL.whole);wwText(p,'30% of 80 meters = 24 meters',800,795,m('answer',2),40,COL.whole,'middle');}],['multiply','Multiply rate by whole',m=>{const p=panel(0);wwTitle(p,'Find the part · multiply');S.wwMultiply=wwRoleBar(p,24,80);wwMath(p,'30% = 0.30',800,555,m('convert'),51,COL.task);wwMath(p,'x = 0.30 × 80 = 24',800,680,m('product'),61,COL.whole);wwText(p,'30% < 50% and 24 < 40',800,820,m('check'),34,COL.dim,'middle');}],-['q1','Choose the part',()=>{const p=panel(0);wwTitle(p,'Each whole is 40 meters','Pick the blue part that matches 30% of this whole.');S.wwChoices=wwChoices(p,[12,30,28],40);},{ask:done=>quiz(BAND,[{id:'c-part',prompt:'Which picture shows 30% of 40 meters?',build:pickEls(S.wwChoices,0,'0.30 × 40 = 12 meters. Picture A shades three of ten equal groups.',i=>i===1?'30 is the percent number, not the number of meters. Thirty meters would be 75% of forty.':'Twenty-eight meters is 70% of forty. We need the smaller thirty-percent part, twelve meters.')}],done)}],-['rate','Find the percent',m=>{const p=panel(0);wwTitle(p,'18 is what percent of 60?','r means the decimal rate · the whole is 60 meters');S.wwRate=wwRoleBar(p,18,60);wwMath(p,['r = ',F('18','60')],425,590,m('ratio'),58,COL.task);wwMath(p,'r = 0.30',1100,590,m('decimal'),57,COL.task);wwMath(p,'0.30 × 100 = 30',800,755,m('percent'),63);wwText(p,'Decimal rate r = 0.30 · reported percent = 30%',800,835,m('percent',2),30,COL.dim,'middle');}],+['q1','Choose the part',()=>{const p=panel(0);wwTitle(p,'Each whole is 40 meters','Pick the blue part that matches 30% of this whole.');S.wwChoices=wwChoices(p,[12,30,28],40,n=>['blue '+n+' meters',COL.whole,'blue '+n+' of 40 meters']);},{ask:done=>quiz(BAND,[{id:'c-part',prompt:'Which picture shows 30% of 40 meters?',build:pickEls(S.wwChoices,0,'0.30 × 40 = 12 meters. Picture A shades three of ten equal groups.',i=>i===1?'30 is the percent number, not the number of meters. Thirty meters would be 75% of forty.':'Twenty-eight meters is 70% of forty. We need the smaller thirty-percent part, twelve meters.')}],done)}],+['rate','Find the percent',m=>{const p=panel(0);wwTitle(p,'18 is what percent of 60?','r means the decimal rate · the whole is 60 meters');S.wwRate=wwRoleBar(p,18,60);wwMath(p,['r = ',F('18','60')],425,590,m('ratio'),58,COL.task);wwMath(p,'r = 0.30',1100,590,m('decimal'),57,COL.task);wwMath(p,'0.30 × 100 = 30 → 30%',800,755,m('percent'),63);wwText(p,'Decimal rate r = 0.30 · reported percent = 30%',800,835,m('percent',2),30,COL.dim,'middle');}],['ratecheck','Check the decimal rate',m=>{const p=panel(0);wwTitle(p,'18 = r × 60','Part ÷ whole gives the decimal rate.');S.wwRateCheck=wwRoleBar(p,18,60);wwMath(p,'r = 18 ÷ 60 = 0.30',800,560,m('divide'),57,COL.task);wwMath(p,'0.30 × 60 = 18',800,695,m('check'),63,COL.whole);wwText(p,'meters ÷ meters: a ratio · report 30%, not 30 meters',800,825,m('units'),31,COL.dim,'middle');}],-['reverse','Same roles, different word order',m=>{const p=panel(0);wwTitle(p,'What percentage of 8 is 3?','Whole: 8 units · part: 3 units · missing: percent');S.wwReverse=wwBar(p,220,275,1160,3,8,0,110,8);wwText(p,'WHOLE: 8 units = 100%',800,240,m('roles'),34,COL.chalk,'middle');wwText(p,'PART: 3 units',437.5,440,m('roles'),32,COL.whole,'middle');wwMath(p,['r × 8 = 3 r = ',F('3','8'),' = 0.375'],800,595,m('ratio'),55,COL.task);wwMath(p,'0.375 × 100 = 37.5',800,755,m('percent'),61);wwText(p,'Reported percent: 37.5% · exact, no rounding',800,835,m('percent',2),31,COL.dim,'middle');}],-['q2','Choose the percent',()=>{const p=panel(0);wwTitle(p,'The whole is 60 meters','Which blue section is exactly 18 meters?');S.wwChoices=wwChoices(p,[18,1.8,42],60);S.wwChoices.forEach(c=>c.box[3]=430);[30,3,70].forEach((n,i)=>wwText(S.wwChoices[i].el,n+'%',320+i*480,610,0,39,COL.task,'middle'));},{ask:done=>quiz(BAND,[{id:'c-rate',prompt:'Which picture represents 18 out of 60, and therefore its percent?',build:pickEls(S.wwChoices,0,'18 ÷ 60 = 0.30, so 18 is 30% of 60. Picture A has the required eighteen-meter blue part.',i=>i===1?'3% of 60 is only 1.8. The decimal rate is 0.30, which converts to 30%.':'70% of 60 is 42. That is the unfilled share of the correct picture, not its eighteen-meter part.')}],done)}],-['whole','Reconstruct the whole',m=>{const p=panel(0);wwTitle(p,'12 is 40% of what whole?','Each counter = 1 unit · blue counters are the known part');S.wwGroups=wwCounters(p);S.wwTotal=wwText(p,'Visible total: 12 units',800,810,0,37,COL.chalk,'middle');S.wwGroups.slice(0,4).forEach(group=>{group.counters.forEach((c,j)=>tw(c,{x:group.x+j*52,y:group.y},m('groups'),2,io));show(group.outline,m('groups')+2);});wwText(p,'4 equal groups = 40% · 1 group = 10%',800,215,m('unit'),33,COL.task,'middle');S.wwGroups.slice(4).forEach(group=>put(group.outline,{o:1}));prog(q=>{const n=Math.floor(q*6+1e-8);S.wwGroups.slice(4).forEach((group,i)=>put(group.g,{o:i<n?1:0}));S.wwTotal.textContent='Visible total: '+(12+n*3)+' units';},m('extend'),4.8,lin);wwText(p,'10 equal groups = 100% · WHOLE = 30 units',800,740,m('answer'),35,COL.task,'middle');}],+['reverse','Same roles, different word order',m=>{const p=panel(0);wwTitle(p,'What percentage of 8 is 3?','Whole: 8 units · part: 3 units · missing: percent');S.wwReverse=wwBar(p,220,275,1160,3,8,0,110,8);wwText(p,'WHOLE: 8 units = 100%',800,240,m('roles'),34,COL.chalk,'middle');wwText(p,'PART: 3 units',437.5,440,m('roles'),32,COL.whole,'middle');wwMath(p,['r × 8 = 3 r = ',F('3','8'),' = 0.375'],800,595,m('ratio'),55,COL.task);wwMath(p,'0.375 × 100 = 37.5 → 37.5%',800,755,m('percent'),61);wwText(p,'Reported percent: 37.5% · exact, no rounding',800,835,m('percent',2),31,COL.dim,'middle');}],+['q2','Choose the percent',()=>{const p=panel(0);wwTitle(p,'18 meters of a 60-meter route are blue','What percent of the whole is that?');S.wwChoices=wwChoices(p,[18,1.8,42],60,(n,i)=>{const r=[30,3,70][i]+'%';return ['blue: '+r,COL.task,'blue '+r+' of 60 meters'];});},{ask:done=>quiz(BAND,[{id:'c-rate',prompt:'18 out of 60 meters is blue. Which percent is that?',build:pickEls(S.wwChoices,0,'18 ÷ 60 = 0.30, so 18 is 30% of 60. Picture A shades 30% of the whole.',i=>i===1?'3% of 60 is only 1.8. The decimal rate is 0.30, which converts to 30%.':'70% of 60 is 42. That is the unfilled share of the correct picture, not its eighteen-meter part.')}],done)}],+['whole','Reconstruct the whole',m=>{const p=panel(0);wwTitle(p,'12 is 40% of what whole?','Each counter = 1 unit · blue counters are the known part');S.wwGroups=wwCounters(p);S.wwTotal=wwText(p,'Visible total: 12 units',800,815,0,37,COL.chalk,'middle');S.wwGroups.slice(0,4).forEach(group=>{group.counters.forEach((c,j)=>tw(c,{x:group.x+j*60,y:group.y},m('groups'),2,io));show(group.outline,m('groups')+2);});wwText(p,'4 equal groups = 40%, so 1 group = 10% = 3 units',800,655,m('unit'),35,COL.task,'middle');S.wwGroups.slice(4).forEach(group=>put(group.outline,{o:1}));prog(q=>{const n=Math.floor(q*6+1e-8);S.wwGroups.slice(4).forEach((group,i)=>put(group.g,{o:i<n?1:0}));S.wwTotal.textContent='Visible total: '+(12+n*3)+' units';},m('extend'),4.8,lin);wwText(p,'10 equal groups = 100% · WHOLE = 30 units',800,735,m('answer'),35,COL.task,'middle');}],['divide','Divide part by decimal rate',m=>{const p=panel(0);wwTitle(p,'Find the whole · 12 is 40% of w','The known part is 12 units, not the whole.');S.wwWhole=wwRoleBar(p,12,30,'units');wwMath(p,'w = 12 ÷ 0.40 = 30',800,550,m('divide'),62,COL.task);wwMath(p,'check: 0.40 × 30 = 12',800,670,m('check'),54,COL.whole);wwText(p,'12 × 0.40 = 4.8 answers a different question:',800,785,m('mistake'),30,COL.dim,'middle');wwText(p,'“What is 40% of 12?” treats 12 as the whole.',800,835,m('mistake',2),30,COL.dim,'middle');}],-['q3','Choose the whole',()=>{const p=panel(0);wwTitle(p,'Which whole has a 12-unit blue part at 40%?','SAME SCALE: 15 pixels = 1 unit in every strip');S.wwChoices=[30,4.8,20].map((whole,i)=>{const x=115+i*495,g=G(p),b=wwBar(g,x,335,whole*15,.4*whole,whole,0,110);wwText(g,String.fromCharCode(65+i),x+220,250,0,34,COL.dim,'middle');wwText(g,'whole '+whole+' units',x+220,305,0,30,COL.chalk,'middle');wwText(g,'blue '+(.4*whole).toFixed(2).replace(/\.?0+$/,'')+' units',x+220,510,0,31,COL.whole,'middle');wwText(g,'40% of this whole',x+220,600,0,29,COL.task,'middle');return {el:g,box:[x-15,220,480,410],label:'Whole '+whole+' units',bar:b};});},{ask:done=>quiz(BAND,[{id:'c-whole',prompt:'Choose the whole for which 12 is 40%.',build:pickEls(S.wwChoices,0,'12 ÷ 0.40 = 30 units. Forty percent of the 30-unit whole is exactly 12 units.',i=>i===1?'4.8 is 40% of 12. Its own forty-percent part is only 1.92, so it cannot have a twelve-unit part.':'Forty percent of 20 is 8, not 12. Divide the known part 12 by the decimal rate 0.40.')}],done)}],+['q3','Choose the whole',()=>{const p=panel(0);wwTitle(p,'Which whole has a 12-unit blue part at 40%?','All three strips are drawn to the same scale.');S.wwChoices=[30,4.8,20].map((whole,i)=>{const c=330+i*470,w=whole*15,x=c-w/2,g=G(p),b=wwBar(g,x,335,w,.4*whole,whole,0,110,whole<10?1:10);wwText(g,String.fromCharCode(65+i),c,250,0,34,COL.dim,'middle');wwText(g,'whole '+whole+' units',c,305,0,32,COL.chalk,'middle');wwText(g,'blue = 40% of this whole',c,520,0,30,COL.task,'middle');return {el:g,box:[c-235,220,470,340],label:'Whole '+whole+' units',bar:b};});},{ask:done=>quiz(BAND,[{id:'c-whole',prompt:'Choose the whole for which 12 is 40%.',build:pickEls(S.wwChoices,0,'12 ÷ 0.40 = 30 units. Forty percent of the 30-unit whole is exactly 12 units.',i=>i===1?'4.8 is 40% of 12. Its own forty-percent part is only 1.92, so it cannot have a twelve-unit part.':'Forty percent of 20 is 8, not 12. Divide the known part 12 by the decimal rate 0.40.')}],done)}],['context','A savings goal',m=>{const p=panel(0);wwTitle(p,'$72 saved · keyboard price $240','What percent of the full price has Maya saved?');S.wwSavings=wwBar(p,220,295,1160,72,240);wwText(p,'WHOLE: $240 = 100%',800,255,m('whole'),35,COL.chalk,'middle');wwText(p,'PART: $72',394,465,m('whole'),34,COL.whole,'middle');wwMath(p,['r = ',F('72','240'),' = 0.30'],800,585,m('ratio'),57,COL.task);wwMath(p,'saved: 30%',800,720,m('percent'),63,COL.whole);wwText(p,'check: 0.30 × $240 = $72',800,835,m('check'),34,COL.dim,'middle');}],-['choose','Choose from the missing role',m=>{const p=panel(0);wwTitle(p,'part = decimal rate × whole','The whole is the reference for 100%, even when the part is larger.');[['Missing part','part = decimal rate × whole','part'],['Missing percent','decimal rate = part ÷ whole; then × 100','rate'],['Missing whole','whole = part ÷ decimal rate','whole']].forEach(([role,eq,mark],i)=>{wwText(p,role,170,315+i*205,m(mark),35,COL.task);wwText(p,eq,170,380+i*205,m(mark)+.3,39,COL.chalk);});}],+['choose','Choose from the missing role',m=>{const p=panel(0);wwTitle(p,'Which role is missing?','One relationship · the missing role picks the operation');[['Missing part','part = decimal rate × whole','part',24,80],['Missing percent','decimal rate = part ÷ whole, then × 100','rate',18,60],['Missing whole','whole = part ÷ decimal rate','whole',12,30]].forEach(([role,eq,mark,part,whole],i)=>{const y=315+i*205,t=m(mark),bx=1030,bw=380,q=(s,k)=>k===mark?'?':s,qc=(k,col)=>k===mark?COL.task:col;wwText(p,role,120,y,t,35,COL.task);wwText(p,eq,120,y+62,t+.3,37,COL.chalk);wwBar(p,bx,y-30,bw,part,whole,t,74);wwText(p,'whole: '+q(String(whole),'whole'),bx+bw/2,y-48,t,28,qc('whole',COL.chalk),'middle');wwText(p,q(Math.round(100*part/whole)+'%','rate'),bx+bw*part/whole/2,y+17,t,30,qc('rate',COL.chalk),'middle');wwText(p,'part: '+q(String(part),'part'),bx+bw*part/whole/2,y+80,t,28,qc('part',COL.whole),'middle');});}],['wrap','Four habits',m=>{const p=panel(0);wwTitle(p,'Meaning first · arithmetic second');[['Identify the whole: what represents 100%?','w1'],['Name the missing role: part, decimal rate or whole.','w2'],['Use part = decimal rate × whole; choose multiply or divide.','w3'],['Check in the original question; include units or %.','w4']].forEach(([s,key],i)=>{const g=G(p,{x:-16,y:285+i*145,o:0});mk('circle',{cx:130,cy:-10,r:26,fill:COL.task},g);T(g,String(i+1),{x:130,y:0,size:30,anchor:'middle',fill:COL.board});T(g,s,{x:195,size:31});tw(g,{x:0,o:1},m(key),.6);});}],['final1','Chapter practice',()=>panel(0),{ask:done=>quiz(SCREEN,[{id:'p-part',prompt:'Find the missing part. All answers exact; type only the number.',build:blanks([{parts:['35% of 80 = ',{box:'28'}],why:'0.35 × 80 = 28. The rate is 0.35 and the whole is 80.'},{parts:['12% of 250 = ',{box:'30'}],why:'0.12 × 250 = 30. Divide the percent number by 100 first.'},{parts:['2.5% of 64 = ',{box:'1.6'}],why:'2.5% = 0.025; 0.025 × 64 = 1.6 exactly.'},{parts:['125% of 32 = ',{box:'40'}],why:'1.25 × 32 = 40. The part exceeds the 32-unit reference whole because 125% exceeds 100%.'}-])}],done,'Chapter practice 1 of 3')}],+])}],done,'Chapter practice · set 1 of 3')}],['final2','Chapter practice',()=>panel(0),{ask:done=>quiz(SCREEN,[{id:'p-rate',prompt:'Find the missing percent. Type the number before the printed % sign.',build:blanks([{parts:['9 is ',{box:'25'},'% of 36'],why:'9 ÷ 36 = 0.25; convert that decimal rate to 25%.'},{parts:['21 is ',{box:'35'},'% of 60'],why:'21 ÷ 60 = 0.35, so the reported percent is 35%.'},-{parts:['What percentage of 8 is 3? ',{box:'37.5'},'%'],why:'The part is 3, the whole is 8. 3 ÷ 8 = 0.375 = 37.5%.'},+{parts:['What percentage of 16 is 6? ',{box:'37.5'},'%'],why:'The part is 6, the whole is 16. 6 ÷ 16 = 0.375 = 37.5%.'},{parts:['45 is ',{box:'150'},'% of 30'],why:'45 ÷ 30 = 1.5 = 150%. The reference whole stays 30; the compared amount is one and a half of those wholes.'}-])}],done,'Chapter practice 2 of 3')}],+])}],done,'Chapter practice · set 2 of 3')}],['final3','Chapter practice',()=>panel(0),{ask:done=>quiz(SCREEN,[{id:'p-whole',prompt:'Find each missing whole. For the savings goal, enter dollars as a number.',build:blanks([{parts:['18 is 30% of ',{box:'60'}],why:'18 ÷ 0.30 = 60; checking gives 0.30 × 60 = 18.'},{parts:['14 is 35% of ',{box:'40'}],why:'14 ÷ 0.35 = 40; checking gives 0.35 × 40 = 14.'},{parts:['6 is 2.5% of ',{box:'240'}],why:'2.5% = 0.025; 6 ÷ 0.025 = 240. The small rate requires a larger whole.'},{parts:['$84 saved = 70% of a $',{box:'120'},' goal'],why:'84 ÷ 0.70 = 120 dollars. 70% of the $120 goal is $84.'}-])}],done,'Chapter practice 3 of 3')}],+])}],done,'Chapter practice · set 3 of 3')}],['finish','Finished',()=>panel(0),{ask:finishCard}]].map(([id,title,run,extra])=>({id,title,run,...extra}));boot();diff --git a/site/math-notebook/ch21/index.html b/site/math-notebook/ch21/index.htmlindex b8e6af7..ce3e923 100644--- a/site/math-notebook/ch21/index.html+++ b/site/math-notebook/ch21/index.html@@ -10,24 +10,24 @@ const txMath=(p,s,x,y,t=0,size=52,col=COL.chalk)=>{const e=M(p,Array.isArray(s)?const txTitle=(p,s,sub='')=>{txText(p,s,100,110,.1,43);if(sub)txText(p,sub,100,165,.15,27,COL.dim);};// price strip at u px per dollar; tax/fee segment (pink) beside it at the same scalefunction txBar(p,x,y,u,price,extra,t=0,h=100){const g=G(p,{x,y,o:0});g.dataset.price=String(price);g.dataset.extra=String(extra);const pr=mk('rect',{width:price*u,height:h,fill:COL.chalk,'fill-opacity':.14,stroke:COL.chalk,'stroke-width':3},g);const ex=mk('rect',{x:price*u,width:extra*u,height:h,fill:TAX,'fill-opacity':.7,stroke:TAX,'stroke-width':3},g);show(g,t);return {g,pr,ex,w:(price+extra)*u};}-function txChoices(p,items,u,price0){return items.map(([price,tax,total],i)=>{const x=140+i*480,g=G(p),b=txBar(g,x,360,u,price,tax,0,100);txText(g,String.fromCharCode(65+i),x+190,270,0,34,COL.dim,'middle');txText(g,'price $'+price,x,330,0,28);txText(g,'+ tax $'+tax,x,500,0,29,TAX);txText(g,'= total $'+total,x,550,0,31,TOT);return {el:g,box:[x-20,235,430,360],label:'Picture '+String.fromCharCode(65+i)+', price '+price+', tax '+tax+', total '+total,bar:b};});}+function txChoices(p,items,u,hideTotal){return items.map(([price,tax,total],i)=>{const x=140+i*480,g=G(p),b=txBar(g,x,360,u,price,tax,0,100);txText(g,String.fromCharCode(65+i),x+190,270,0,34,COL.dim,'middle');txText(g,'price $'+price,x,330,0,28);txText(g,'+ tax $'+tax,x,500,0,29,TAX);txText(g,hideTotal?'= total ?':'= total $'+total,x,550,0,31,TOT);return {el:g,box:[x-20,235,430,360],label:'Picture '+String.fromCharCode(65+i)+', price '+price+', tax '+tax+(hideTotal?'':', total '+total),bar:b};});}const BEATS=[['intro','Taxes and Fees',(m,D)=>{const g=G(scene,{o:0,y:24});T(g,'Unit 2 · Ratios, Proportions, and Percents · Chapter 21',{x:800,y:195,size:28,fill:COL.dim,anchor:'middle'});T(g,'Taxes and Fees',{x:800,y:390,size:90,weight:600,anchor:'middle'});T(g,'extra = rate × price',{x:800,y:560,size:50,fill:COL.task,anchor:'middle'});tw(g,{o:1,y:0},.2,1,out);txText(g,'Find the extra · or work back to the price',800,720,m('sub'),35,COL.dim,'middle');hide(g,D-.8,.7);}],-['rate','Sales tax is a percent',m=>{const p=panel(0);txTitle(p,'Sales tax: a percent of the price','One dollar = 100 cents · drawn as 100 equal cells');const g=G(p,{x:160,y:230,o:0});for(let i=0;i<100;i++)mk('rect',{x:(i%10)*34,y:Math.floor(i/10)*34,width:34,height:34,fill:i<8?TAX:'none','fill-opacity':.75,stroke:COL.dim,'stroke-width':1.5},g);show(g,.3);txText(p,'$1 = 100¢',330,625,m('eight'),36,COL.chalk,'middle');txText(p,'8 of the 100 cents are tax',330,675,m('eight',2),31,TAX,'middle');txText(p,'sales tax 8%',700,300,m('sales'),46,COL.task);txText(p,'8¢ extra for every 100¢',700,375,m('eight',1),34);txMath(p,['8% = 8:100 = ',F('8','100'),' = 0.08'],1060,520,m('forms'),52,COL.task);txText(p,'rates differ by state and city · the rate stays fixed as prices change',1060,650,m('forms',6),27,COL.dim,'middle');}],-['dollars','Tax on every dollar',m=>{const p=panel(0);txTitle(p,'A $40 sweater · 8% sales tax','Each chip = $1');const g=G(p,{o:0}),sl=[],hl=[];for(let i=0;i<40;i++){const x=130+(i%10)*68,y=230+Math.floor(i/10)*90,c=G(g,{x,y});mk('rect',{width:56,height:56,fill:COL.chalk,'fill-opacity':.14,stroke:COL.chalk,'stroke-width':2},c);const s=mk('rect',{y:56-56*.08,width:56,height:56*.08,fill:TAX},c);put(s,{o:0});sl.push(s);const h=mk('rect',{x:-4,y:-4,width:64,height:64,fill:'none',stroke:COL.task,'stroke-width':3},c);put(h,{o:0});hl.push(h);}+['rate','Sales tax is a percent',m=>{const p=panel(0);txTitle(p,'Sales tax: a percent of the price','One dollar = 100 cents · drawn as 100 equal cells');const g=G(p,{x:160,y:230,o:0}),pk=G(g,{o:0});for(let i=0;i<100;i++){const a={x:(i%10)*34,y:Math.floor(i/10)*34,width:34,height:34};if(i<8)mk('rect',{...a,fill:TAX,'fill-opacity':.75},pk);mk('rect',{...a,fill:'none',stroke:COL.dim,'stroke-width':1.5},g);}show(g,m('eight',2));show(pk,m('eight',5.5));txText(p,'$1 = 100¢',330,625,m('eight',2),36,COL.chalk,'middle');txText(p,'8 of the 100 cents are tax',330,675,m('eight',5.5),31,TAX,'middle');txText(p,'sales tax',700,300,m('sales'),46,COL.task);txText(p,'8%',915,300,m('eight'),46,COL.task);txText(p,'8¢ extra for every 100¢',700,375,m('forms'),34);txMath(p,['8% = 8:100 = ',F('8','100'),' = 0.08'],1060,520,m('forms',4.3),52,COL.task);txText(p,'rates differ by state and city · the rate stays fixed as prices change',1060,650,m('forms',13),27,COL.dim,'middle');}],+['dollars','Tax on every dollar',m=>{const p=panel(0);txTitle(p,'A $40 sweater · 8% sales tax','Each chip = $1');const g=G(p,{o:0}),sl=[],hl=[];for(let i=0;i<40;i++){const x=130+(i%10)*78,y=230+Math.floor(i/10)*96,c=G(g,{x,y});mk('rect',{width:64,height:64,fill:COL.chalk,'fill-opacity':.14,stroke:COL.chalk,'stroke-width':2},c);const s=mk('rect',{x:65,width:64*.08,height:64,fill:TAX},c);put(s,{o:0});sl.push(s);const h=mk('rect',{x:-4,y:-4,width:78,height:72,fill:'none',stroke:COL.task,'stroke-width':3},c);put(h,{o:0});hl.push(h);}show(g,m('price'));sl.forEach(s=>show(s,m('each'),.5));-const cnt=txText(p,'tax so far: 0¢',1010,420,m('count'),44,TAX);prog(q=>{const n=Math.floor(q*40+1e-8);hl.forEach((h,i)=>put(h,{o:i<n?1:0}));cnt.textContent='tax so far: '+n*8+'¢';},m('count'),5,lin);-txText(p,'40 × 8¢ = 320¢ = $3.20',1010,540,m('result'),44,TAX);txText(p,'more dollars, more tax: same rate each dollar',1010,620,m('result',5),27,COL.dim);}],-['method1','Method 1: multiply',m=>{const p=panel(0);txTitle(p,'Method 1 · multiply by the decimal rate','The tax is 8% of the price');const b=txBar(p,160,260,22,40,3.2);txText(p,'price $40',160+440,395,0,32,COL.chalk,'middle');txText(p,'tax',160+880+35,235,m('bar'),30,TAX,'middle');tw(b.ex,{o:1},m('bar'),.1);txMath(p,'8% = 0.08',800,520,m('convert'),52,COL.task);txMath(p,'40 × 0.08 = 3.2',800,640,m('product'),60);txText(p,'tax = $3.20 · money gets two decimal places',800,780,m('money'),38,TAX,'middle');}],-['method2','Method 2: proportion',m=>{const p=panel(0);txTitle(p,'Method 2 · same ratio, two prices','Both strips use the same scale');txBar(p,160,230,6,100,8,0,70);txText(p,'price $100 · tax $8',160+318,335,m('top'),30,COL.chalk,'middle');const b2=txBar(p,160,370,6,40,3.2,0,70);txText(p,'price $40 · tax x',160+130,475,m('bottom'),30,COL.chalk,'middle');b2.g.style.opacity=1;txMath(p,[F('8','100'),' = ',F('x','40')],800,610,m('equation'),62);txMath(p,'100x = 320',800,730,m('cross'),56);txMath(p,'x = 3.2',800,825,m('answer'),56,TAX);}],-['methods','Method 3 and a check',m=>{const p=panel(0);txTitle(p,'Three methods · one answer','Pick one, check with another');[['Multiply',['40 × 0.08 = 3.2'],'ask'],['Proportion',[F('8','100'),' = ',F('x','40'),' → x = 3.2'],'eq'],['Equation: “What is 8% of $40?”',['x = 0.08 × 40 = 3.2'],'same']].forEach(([lab,eq,k],i)=>{txText(p,lab,150,300+i*150,m(k),32,COL.dim);txMath(p,eq,420,375+i*150,m(k,.3),56);txText(p,'$3.20',1350,375+i*150,m('same',1+i*.5),50,TAX,'middle');});}],+const cnt=txText(p,'tax so far: 0¢',980,400,m('count'),44,TAX);prog(q=>{const n=Math.floor(q*40+1e-8);hl.forEach((h,i)=>put(h,{o:i<n?1:0}));cnt.textContent='tax so far: '+n*8+'¢';},m('count'),5,lin);+txText(p,'40 × 8¢ = 320¢ = $3.20',980,510,m('result'),44,TAX);txText(p,'more dollars, more tax: same rate each dollar',980,585,m('result',6.8),27,COL.dim);}],+['method1','Method 1: multiply',m=>{const p=panel(0);txTitle(p,'Method 1 · multiply by the decimal rate','The tax is 8% of the price');const b=txBar(p,160,260,22,40,3.2);txText(p,'price $40',160+440,395,0,32,COL.chalk,'middle');txText(p,'tax',160+880+35,235,m('bar'),30,TAX,'middle');put(b.ex,{o:0});show(b.ex,m('bar'));txMath(p,'8% = 0.08',800,520,m('convert'),52,COL.task);txMath(p,'40 × 0.08 = 3.2',800,640,m('product'),60);txText(p,'tax = $3.20 · money gets two decimal places',800,780,m('money'),38,TAX,'middle');}],+['method2','Method 2: proportion',m=>{const p=panel(0);txTitle(p,'Method 2 · same ratio, two prices','Both strips use the same scale');txBar(p,160,230,9,100,8,0,70);txText(p,'price $100 · tax $8',160+486,335,m('top'),30,COL.chalk,'middle');txBar(p,160,370,9,40,3.2,0,70);txText(p,'price $40 · tax x',160+194,475,m('bottom'),30,COL.chalk,'middle');txMath(p,[F('8','100'),' = ',F('x','40')],800,610,m('equation'),62);txMath(p,'100x = 320',800,730,m('cross'),56);txMath(p,'x = 3.2',800,825,m('answer'),56,TAX);txText(p,'= $3.20',935,825,m('answer',3.9),44,TAX);}],+['methods','Method 3 and a check',m=>{const p=panel(0);txTitle(p,'Three methods · one answer','Pick one, check with another');[['Multiply',['40 × 0.08 = 3.2'],.3,.5],['Proportion',[F('8','100'),' = ',F('x','40'),' → x = 3.2'],.3,.5],['Equation: “What is 8% of $40?”',['x = 0.08 × 40 = 3.2'],m('ask'),m('eq')]].forEach(([lab,eq,tl,te],i)=>{txText(p,lab,150,300+i*150,tl,32,COL.dim);txMath(p,eq,420,375+i*150,te,56);txText(p,'$3.20',1350,375+i*150,m('same',1+i*.5),50,TAX,'middle');});}],['q1','Total with tax',()=>{const p=panel(0);txTitle(p,'A $50 game · 6% sales tax','All strips use the same scale: 5 px = $1');S.txCh=txChoices(p,[[50,3,53],[50,6,56],[50,30,80]],5);},{ask:done=>quiz(BAND,[{id:'c-total',prompt:'Which picture shows the total price of the game?',build:pickEls(S.txCh,0,'0.06 × 50 = 3, so the total is $53.',i=>i===1?'$6 treats 6% as 6 dollars. 6% of $50 is only $3.':'$30 would be 60% of $50. 6% is 0.06 × 50 = $3.')}],done)}],-['total','Price plus tax',m=>{const p=panel(0);txTitle(p,'What do you pay?','price + tax = total');const b=txBar(p,160,260,22,40,3.2);txText(p,'price $40',160+440,395,0,32,COL.chalk,'middle');txText(p,'tax $3.20',160+880+35,235,0,30,TAX,'middle');txMath(p,'40 + 3.20 = 43.20',800,520,m('add'),58,TOT);const br=path(p,'M160 420V440H1040.4V420',{stroke:TOT,'stroke-width':3,fill:'none'},{d:0});draw(br,m('pct'),.8);txText(p,'100% + 8% = 108% of the price',800,495,m('pct'),0,COL.task,'middle');txMath(p,'1.08 × 40 = 43.20',800,720,m('one'),58,TOT);txText(p,'one step: (1 + rate) × price',800,810,m('one',1),32,COL.dim,'middle');}],-['original','Work back to the price',m=>{const p=panel(0);txTitle(p,'Total $53.99 · 8% tax included','What was the price before tax?');const b=txBar(p,160,255,22,40,3.2);txText(p,'original price p = 100%',160+440,390,m('pct'),32,COL.chalk,'middle');txText(p,'tax 8%',160+880+35,230,m('pct'),30,TAX,'middle');txText(p,'total $53.99 = 108%',800,462,m('receipt'),38,TOT,'middle');txMath(p,'100% + 8% = 108% = 1.08',800,540,m('pct',1),46,COL.task);txMath(p,'53.99 = 1.08 × p',800,625,m('eq'),56);txMath(p,'p = 53.99 ÷ 1.08 ≈ 49.99',800,725,m('divide'),56,COL.chalk);txText(p,'check: 1.08 × 49.99 = 53.9892 ≈ 53.99',800,820,m('check'),33,COL.dim,'middle');}],+['total','Price plus tax',m=>{const p=panel(0);txTitle(p,'What do you pay?','price + tax = total');const b=txBar(p,160,260,22,40,3.2);txText(p,'price $40',160+440,395,0,32,COL.chalk,'middle');txText(p,'tax $3.20',160+880+35,235,0,30,TAX,'middle');txMath(p,'40 + 3.20 = 43.20',800,600,m('add'),58,TOT);const br=path(p,'M160 420V440H1110.4V420',{stroke:TOT,'stroke-width':3,fill:'none'},{d:0});draw(br,m('pct'),.8);txText(p,'total = 100% + 8% = 108% of the price',635,488,m('pct'),34,TOT,'middle');txMath(p,'1.08 × 40 = 43.20',800,710,m('one'),58,TOT);txText(p,'one step: (1 + rate) × price',800,800,m('one',1),32,COL.dim,'middle');}],+['original','Work back to the price',m=>{const p=panel(0);txTitle(p,'Total $53.99 · 8% tax included','What was the price before tax?');txBar(p,160,255,18,49.99,4);txText(p,'original price p = 100%',160+450,390,m('pct'),32,COL.chalk,'middle');txText(p,'tax 8%',160+900+36,230,m('pct'),30,TAX,'middle');draw(path(p,'M160 410V428H1131.8V410',{stroke:TOT,'stroke-width':3,fill:'none'},{d:0}),m('receipt'),.8);txText(p,'total $53.99',640,472,m('receipt'),38,TOT,'end');txText(p,'= 108%',650,472,m('pct'),38,TOT);txMath(p,'100% + 8% = 108% = 1.08',800,560,m('pct',1),46,COL.task);txMath(p,'53.99 = 1.08 × p',800,645,m('eq'),56);txMath(p,'p = 53.99 ÷ 1.08 ≈ 49.99',800,735,m('divide'),56,COL.chalk);txText(p,'check: 1.08 × 49.99 = 53.9892 ≈ 53.99',800,822,m('check'),33,COL.dim,'middle');}],['mistake','Tax is of the original',m=>{const p=panel(0);txTitle(p,'A tempting shortcut','Subtract 8% of the total?');txMath(p,'53.99 − 0.08 × 53.99 ≈ 49.67',800,330,m('wrong'),54);const x=path(p,'M270 360L1330 300',{stroke:COL.bad,'stroke-width':6},{d:0});draw(x,m('why'),.6);txText(p,'The tax was 8% of the original price, not of the total.',800,470,m('why'),34,COL.task,'middle');txText(p,'test: tax on $49.67 ≈ $3.97 → total $53.64, not $53.99',800,570,m('test'),34,COL.dim,'middle');txMath(p,'p = 53.99 ÷ 1.08 ≈ 49.99',800,735,m('right'),58,TOT);}],-['q2','Which price?',()=>{const p=panel(0);txTitle(p,'The total is $54.00 · 8% tax','Same scale: 4 px = $1');S.txCh=txChoices(p,[[49.68,3.97,'53.65'],[50,4,'54.00'],[58.32,4.67,'62.99']],4);},{ask:done=>quiz(BAND,[{id:'c-orig',prompt:'Which original price gives a total of $54.00?',build:pickEls(S.txCh,1,'54 ÷ 1.08 = 50, and 1.08 × 50 = 54.',i=>i===0?'That subtracts 8% of the total. Its own tax is $3.97, so the total is only $53.65.':'That multiplies the total by 1.08, going the wrong way. Its total would be $62.99.')}],done)}],-['fee','Fees are percents too',m=>{const p=panel(0);txTitle(p,'Bike rental: $65 · 17% late fee','A fee works like a tax');const b=txBar(p,160,260,12,65,11.05);txText(p,'rental $65',160+390,395,m('bike'),32,COL.chalk,'middle');txText(p,'late fee',160+780+66,235,m('fee'),30,TAX,'middle');txMath(p,'17% = 0.17',800,520,m('rate'),50,COL.task);txMath(p,'0.17 × 65 = 11.05',800,625,m('fee'),56,TAX);txMath(p,'65 + 11.05 = 76.05',800,735,m('total'),58,TOT);txText(p,'late fee $11.05 · total $76.05',800,830,m('total',1.5),34,COL.dim,'middle');}],-['feeorig','Work back from a fee',m=>{const p=panel(0);txTitle(p,'Snowboard: total $66.08 · 12% fee included','What was the rental price?');const b=txBar(p,160,255,22,40,4.8);txText(p,'rental price = 100%',160+440,390,m('pct'),32,COL.chalk,'middle');txText(p,'fee 12%',160+880+50,230,m('pct'),30,TAX,'middle');txMath(p,'100% + 12% = 112% = 1.12',800,500,m('pct',1),46,COL.task);txMath(p,'66.08 = 1.12 × p',800,610,m('receipt'),56);txMath(p,'p = 66.08 ÷ 1.12 = 59',800,715,m('divide'),56);txText(p,'check: 0.12 × 59 = 7.08 and 59 + 7.08 = 66.08',800,820,m('check'),33,COL.dim,'middle');}],+['q2','Which price?',()=>{const p=panel(0);txTitle(p,'The total is $54.00 · 8% tax','Same scale: 4 px = $1');S.txCh=txChoices(p,[[49.68,3.97,'53.65'],[50,4,'54.00'],[58.32,4.67,'62.99']],4,true);},{ask:done=>quiz(BAND,[{id:'c-orig',prompt:'Which original price gives a total of $54.00?',build:pickEls(S.txCh,1,'54 ÷ 1.08 = 50, and 1.08 × 50 = 54.',i=>i===0?'That subtracts 8% of the total. Its own tax is $3.97, so the total is only $53.65.':'That multiplies the total by 1.08, going the wrong way. Its total would be $62.99.')}],done)}],+['fee','Fees are percents too',m=>{const p=panel(0);txTitle(p,'Bike rental: $65 · 17% late fee','A fee works like a tax');const b=txBar(p,160,260,16,65,11.05);put(b.ex,{o:0});show(b.ex,m('fee'));txText(p,'rental $65',160+520,395,m('bike'),32,COL.chalk,'middle');txText(p,'late fee',160+1040+88,235,m('fee'),30,TAX,'middle');txMath(p,'17% = 0.17',800,520,m('rate'),50,COL.task);txMath(p,'0.17 × 65 = 11.05',800,625,m('fee'),56,TAX);txMath(p,'65 + 11.05 = 76.05',800,735,m('total'),58,TOT);txText(p,'late fee $11.05 · total $76.05',800,830,m('total',1.5),34,COL.dim,'middle');}],+['feeorig','Work back from a fee',m=>{const p=panel(0);txTitle(p,'Snowboard: total $66.08 · 12% fee included','What was the rental price?');txBar(p,160,255,18,59,7.08);txText(p,'rental price p = 100%',160+531,390,m('pct'),32,COL.chalk,'middle');txText(p,'fee 12%',160+1062+64,230,m('pct'),30,TAX,'middle');draw(path(p,'M160 410V428H1349.4V410',{stroke:TOT,'stroke-width':3,fill:'none'},{d:0}),m('receipt'),.8);txText(p,'total $66.08',740,472,m('receipt'),38,TOT,'end');txText(p,'= 112%',750,472,m('pct'),38,TOT);txMath(p,'100% + 12% = 112% = 1.12',800,560,m('pct',1),46,COL.task);txMath(p,'66.08 = 1.12 × p',800,645,m('pct',5.5),56);txMath(p,'p = 66.08 ÷ 1.12 = 59',800,735,m('divide'),56);txText(p,'check: 0.12 × 59 = 7.08 and 59 + 7.08 = 66.08',800,822,m('check'),33,COL.dim,'middle');}],['q3','Fee and total',()=>{const p=panel(0);txTitle(p,'A $45 charge · 20% service fee','Strip: price + fee, to scale');txBar(p,160,260,16,45,9);txText(p,'price $45',160+360,395,0,32,COL.chalk,'middle');txText(p,'fee ?',160+720+72,235,0,30,TAX,'middle');},{ask:done=>quiz(BAND,[{id:'c-fee',prompt:'Find the fee and the total in dollars.',build:blanks([{parts:['fee $',{box:'9'},' total $',{box:'54'}],why:'0.20 × 45 = 9, and 45 + 9 = 54 (or 1.20 × 45).'}])}],done)}],['wrap','Four habits',m=>{const p=panel(0);txTitle(p,'Taxes and fees · the same percent idea');[['A tax or fee is a percent of the original price.','w1'],['Extra = rate × price. Total = price + extra = (1 + rate) × price.','w2'],['Know the total? Divide by (1 + rate) to get the original price.','w3'],['Round money to the cent; check by building the total forward.','w4']].forEach(([s,key],i)=>{const g=G(p,{x:-16,y:285+i*145,o:0});mk('circle',{cx:130,cy:-10,r:26,fill:COL.task},g);T(g,String(i+1),{x:130,y:0,size:30,anchor:'middle',fill:COL.board});T(g,s,{x:195,size:31});tw(g,{x:0,o:1},m(key),.6);});}],['final1','Chapter practice',()=>panel(0),{ask:done=>quiz(SCREEN,[{id:'p-tax',prompt:'Find the tax. Round to the nearest cent; type only the number.',build:blanks([@@ -35,19 +35,19 @@ txText(p,'40 × 8¢ = 320¢ = $3.20',1010,540,m('result'),44,TAX);txText(p,'more{parts:['8.5% tax on $12.00 = $',{box:'1.02'}],why:'0.085 × 12 = 1.02.'},{parts:['9.25% tax on $27.50 = $',{box:'2.54'}],why:'0.0925 × 27.50 = 2.54375, which rounds to 2.54.'},{parts:['8% tax on $234.25 = $',{box:'18.74'}],why:'0.08 × 234.25 = 18.74.'}-])}],done,'Chapter practice 1 of 3')}],+])}],done,'Chapter practice · set 1 of 3')}],['final2','Chapter practice',()=>panel(0),{ask:done=>quiz(SCREEN,[{id:'p-total',prompt:'Totals and original prices. Round to the nearest cent; type only the number.',build:blanks([{parts:['Total with 8.5% tax on $27.50 = $',{box:'29.84'}],why:'27.50 + 2.34 = 29.84, or 1.085 × 27.50 rounded.'},{parts:['Total $11.65 includes 6% tax. Original price = $',{box:'10.99'}],why:'11.65 ÷ 1.06 ≈ 10.99.'},{parts:['Total $21.80 includes 9% tax. Original price = $',{box:'20'}],why:'21.80 ÷ 1.09 = 20.'},{parts:['Total $63 includes 5% tax. Original price = $',{box:'60'}],why:'63 ÷ 1.05 = 60.'}-])}],done,'Chapter practice 2 of 3')}],+])}],done,'Chapter practice · set 2 of 3')}],['final3','Chapter practice',()=>panel(0),{ask:done=>quiz(SCREEN,[{id:'p-fee',prompt:'Fees. Type only the number of dollars.',build:blanks([{parts:['15% late fee on an $80 rental = $',{box:'12'}],why:'0.15 × 80 = 12.'},{parts:['Total with a 20% fee on a $45 charge = $',{box:'54'}],why:'1.20 × 45 = 54.'},{parts:['Total $66.08 includes a 12% fee. Original price = $',{box:'59'}],why:'66.08 ÷ 1.12 = 59.'},{parts:['Total $45 includes a 25% fee. Original price = $',{box:'36'}],why:'45 ÷ 1.25 = 36.'}-])}],done,'Chapter practice 3 of 3')}],+])}],done,'Chapter practice · set 3 of 3')}],['finish','Finished',()=>panel(0),{ask:finishCard}]].map(([id,title,run,extra])=>({id,title,run,...extra}));boot();diff --git a/site/math-notebook/ch22/index.html b/site/math-notebook/ch22/index.htmlindex 97c6221..8c15b7f 100644--- a/site/math-notebook/ch22/index.html+++ b/site/math-notebook/ch22/index.html@@ -12,40 +12,41 @@ const dsTitle=(p,s,sub='')=>{dsText(p,s,100,110,.1,43);if(sub)dsText(p,sub,100,1function dsBar(p,x,y,u,price,off,t=0,h=100){const g=G(p,{x,y,o:0});const pay=mk('rect',{width:(price-off)*u,height:h,fill:TOT,'fill-opacity':.4,stroke:TOT,'stroke-width':3},g);const d=mk('rect',{x:(price-off)*u,width:off*u,height:h,fill:DS,'fill-opacity':.7,stroke:DS,'stroke-width':3},g);show(g,t);return {g,pay,d,w:price*u};}// strip of the cost with a pink markup added to the rightfunction dsUp(p,x,y,u,cost,extra,t=0,h=100){const g=G(p,{x,y,o:0});mk('rect',{width:cost*u,height:h,fill:COL.chalk,'fill-opacity':.14,stroke:COL.chalk,'stroke-width':3},g);const e=mk('rect',{x:cost*u,width:extra*u,height:h,fill:UP,'fill-opacity':.7,stroke:UP,'stroke-width':3},g);show(g,t);return {g,ex:e,w:(cost+extra)*u};}+function dsBr(p,x,y,w,label,t){const g=G(p,{o:0});mk('path',{d:`M${x} ${y+14}V${y}H${x+w}V${y+14}`,fill:'none',stroke:COL.dim,'stroke-width':3},g);T(g,label,{x:x+w/2,y:y-12,size:32,fill:TOT,anchor:'middle'});show(g,t);}function dsChoices(p,items,u){return items.map(([price,disc,pay],i)=>{const x=140+i*480,g=G(p),b=dsBar(g,x,360,u,price,disc,0,100);dsText(g,String.fromCharCode(65+i),x+(price*u)/2,270,0,34,COL.dim,'middle');dsText(g,'price $'+price,x,330,0,28);dsText(g,'discount $'+disc,x,500,0,29,DS);dsText(g,'pay $'+pay,x,550,0,31,TOT);return {el:g,box:[x-20,235,430,360],label:'Picture '+String.fromCharCode(65+i)+', price '+price+', discount '+disc+', pay '+pay,bar:b};});}const BEATS=[['intro','Discounts and Markups',(m,D)=>{const g=G(scene,{o:0,y:24});T(g,'Unit 2 · Ratios, Proportions, and Percents · Chapter 22',{x:800,y:195,size:28,fill:COL.dim,anchor:'middle'});T(g,'Discounts and Markups',{x:800,y:390,size:90,weight:600,anchor:'middle'});T(g,'price − discount · cost + markup',{x:800,y:560,size:50,fill:COL.task,anchor:'middle'});tw(g,{o:1,y:0},.2,1,out);dsText(g,'Take it off · put it on · work back',800,720,m('sub'),35,COL.dim,'middle');hide(g,D-.8,.7);}],-['discount','Discount: subtract it',m=>{const p=panel(0);dsTitle(p,'A $12.50 hat · all items 20% off','sale · markdown · clearance · savings: you subtract');const b=dsBar(p,160,250,64,12.5,2.5);dsText(p,'original price $12.50',160+320,385,m('sign'),32,COL.chalk,'middle');dsText(p,'discount',160+640+80,225,m('bar'),30,DS,'middle');dsMath(p,'20% = 0.20',800,520,m('conv'),50,COL.task);dsMath(p,'0.20 × 12.50 = 2.50',800,625,m('mult'),54,DS);dsMath(p,'12.50 − 2.50 = 10.00',800,730,m('sub'),54,TOT);dsText(p,'new price $10.00',800,820,m('new'),38,TOT,'middle');tw(b.d,{y:70,o:.3},m('sub'),.9,io);}],-['pay','You pay what is left',m=>{const p=panel(0);dsTitle(p,'Same hat · what you pay','Pay = 100% − 20% = 80% of the price');const b=dsBar(p,160,250,64,12.5,2.5);dsText(p,'pay 80%',160+320,235,m('pct'),32,TOT,'middle');dsText(p,'save 20%',160+640+80,235,m('split'),30,DS,'middle');dsText(p,'100% − 20% = 80% = 0.80',800,520,m('pct'),46,COL.task,'middle');dsMath(p,'0.80 × 12.50 = 10.00',800,630,m('one'),56,TOT);dsText(p,'sale price = (1 − rate) × price',800,740,m('rule'),42,COL.task,'middle');}],+['discount','Discount: subtract it',m=>{const p=panel(0);dsTitle(p,'A $12.50 hat · all items 20% off','sale · markdown · clearance · savings: you subtract');const b=dsBar(p,200,250,96,12.5,2.5);put(b.d,{o:0});show(b.d,m('bar'));dsText(p,'original price $12.50',800,385,m('sign'),32,COL.chalk,'middle');const lb=G(p);dsText(lb,'discount',1280,225,m('bar'),30,DS,'middle');tw(lb,{y:70},m('sub'),.9,io);dsMath(p,'20% = 0.20',800,520,m('conv'),50,COL.task);dsMath(p,'0.20 × 12.50 = 2.50',800,625,m('mult'),54,DS);dsMath(p,'12.50 − 2.50 = 10.00',800,730,m('sub'),54,TOT);dsText(p,'new price $10.00',800,820,m('new'),38,TOT,'middle');tw(b.d,{y:70,o:.3},m('sub'),.9,io);}],+['pay','You pay what is left',m=>{const p=panel(0);dsTitle(p,'Same hat · what you pay','Pay = 100% − 20% = 80% of the price');const b=dsBar(p,200,250,96,12.5,2.5);put(b.d,{o:0});show(b.d,m('split'));dsText(p,'pay 80%',680,235,m('pct'),32,TOT,'middle');dsText(p,'save 20%',1280,235,m('split'),30,DS,'middle');dsMath(p,'100% − 20% = 80% = 0.80',800,520,m('pct'),50,COL.task);dsMath(p,'0.80 × 12.50 = 10.00',800,630,m('one'),56,TOT);dsText(p,'sale price = (1 − rate) × price',800,740,m('rule'),42,COL.task,'middle');}],['q1','Which picture?',()=>{const p=panel(0);dsTitle(p,'A $60 jacket · 25% off','All strips use the same scale: 5 px = $1');S.dsCh=dsChoices(p,[[60,15,45],[60,25,35],[60,45,15]],5);},{ask:done=>quiz(BAND,[{id:'c-sale',prompt:'Which picture shows the jacket with 25% off?',build:pickEls(S.dsCh,0,'0.25 × 60 = 15 discount, so you pay 60 − 15 = $45.',i=>i===1?'$25 treats 25% as 25 dollars. 25% of $60 is only $15.':'$45 would be 75% off. 25% of $60 is $15.')}],done)}],-['twice','Two discounts, one at a time',m=>{const p=panel(0);dsTitle(p,'$100 of games · 25% off, then 15% more','The second discount is taken from the new price');dsBar(p,160,230,6,100,25,0,70);dsText(p,'$100 · discount $25',160+225,335,m('first'),30,COL.chalk,'middle');dsBar(p,160,370,6,75,11.25,0,70);dsText(p,'$75 · discount $11.25',160+170,475,m('second'),30,COL.chalk,'middle');dsMath(p,'0.25 × 100 = 25 → $75',1180,270,m('first',.3),44,DS,'middle');dsMath(p,'0.15 × 75 = 11.25 → $63.75',1180,410,m('second',.3),44,TOT);dsText(p,'not 40% off · that would be $60',800,610,m('wrong'),38,COL.task,'middle');dsText(p,'15% is of $75, not of $100',800,680,m('wrong',3),34,COL.dim,'middle');dsText(p,'total saved $36.25',800,760,m('wrong',6),38,DS,'middle');}],+['twice','Two discounts, one at a time',m=>{const p=panel(0);dsTitle(p,'$100 of games · 25% off, then 15% more','The second discount is taken from the new price');const t1=dsBar(p,160,230,6,100,25,m('start'),70);put(t1.d,{o:0});show(t1.d,m('first'));dsText(p,'$100 · discount $25',160+225,335,m('first'),30,COL.chalk,'middle');const t2=dsBar(p,160,370,6,75,11.25,m('second'),70);dsText(p,'$75 · discount $11.25',160+170,475,m('second'),30,COL.chalk,'middle');dsMath(p,'0.25 × 100 = 25 → $75',1180,270,m('first',.3),44,DS,'middle');dsMath(p,'0.15 × 75 = 11.25 → $63.75',1180,410,m('second',.3),44,TOT);dsText(p,'not 40% off · that would be $60',800,610,m('wrong'),38,COL.task,'middle');dsText(p,'15% is of $75, not of $100',800,680,m('wrong',3),34,COL.dim,'middle');dsText(p,'total saved $36.25',800,760,m('wrong',6),38,DS,'middle');}],['q2','Two discounts',()=>{const p=panel(0);dsTitle(p,'An $80 jacket · 10% off, then 10% more','One discount at a time');dsBar(p,160,260,8,80,8,0,70);dsText(p,'$80 · 10% off = $8',160+320,365,0,30,COL.chalk,'middle');},{ask:done=>quiz(BAND,[{id:'c-two',prompt:'Find the price after each discount.',build:blanks([{parts:['after the first: $',{box:'72'},' final price: $',{box:'64.80'}],why:'0.90 × 80 = 72, then 0.90 × 72 = 64.80. Not 20% off, which would be $64.'}])}],done)}],-['original','Work back to the original',m=>{const p=panel(0);dsTitle(p,'Sale price $41.99 · 30% off','What was the original price?');const b=dsBar(p,160,255,8,100,30);dsText(p,'original price p = 100%',160+400,390,m('start'),32,COL.chalk,'middle');dsText(p,'30% off',160+560+120,230,m('pct'),30,DS,'middle');dsText(p,'sale $41.99 = 70%',160+280,230,m('pct',1),30,TOT,'middle');dsMath(p,'100% − 30% = 70% = 0.7',800,520,m('pct',1),46,COL.task);dsMath(p,'41.99 = 0.7 × p',800,625,m('eq'),56);dsMath(p,'p = 41.99 ÷ 0.7 ≈ 59.99',800,730,m('divide'),56);dsText(p,'check: 0.7 × 59.99 = 41.993 ≈ 41.99',800,825,m('check'),33,COL.dim,'middle');}],+['original','Work back to the original',m=>{const p=panel(0);dsTitle(p,'Sale price $41.99 · 30% off','What was the original price?');const b=dsBar(p,200,255,12,100,30);put(b.d,{o:0});show(b.d,m('pct'));dsText(p,'original price p = 100%',800,390,m('start'),32,COL.chalk,'middle');dsText(p,'30% off',1220,230,m('pct'),30,DS,'middle');dsText(p,'sale $41.99 = 70%',620,230,m('pct',1),30,TOT,'middle');dsMath(p,'100% − 30% = 70% = 0.7',800,520,m('pct',1),46,COL.task);dsMath(p,'41.99 = 0.7 × p',800,625,m('eq'),56);dsMath(p,'p = 41.99 ÷ 0.7 ≈ 59.99',800,730,m('divide'),56);dsText(p,'check: 0.7 × 59.99 = 41.993 ≈ 41.99',800,825,m('check'),33,COL.dim,'middle');}],['mistake','Percent of the original',m=>{const p=panel(0);dsTitle(p,'A tempting shortcut','Add 30% of the sale price back?');dsMath(p,'41.99 + 0.3 × 41.99 ≈ 54.59',800,330,m('wrong'),54);const x=path(p,'M270 360L1330 300',{stroke:COL.bad,'stroke-width':6},{d:0});draw(x,m('why'),.6);dsText(p,'The 30% came off the original price, not off the sale price.',800,470,m('why'),34,COL.task,'middle');dsText(p,'test: 30% off $54.59 gives $38.21, not $41.99',800,570,m('test'),34,COL.dim,'middle');dsMath(p,'p = 41.99 ÷ 0.7 ≈ 59.99',800,735,m('right'),58,TOT);}],-['percentoff','Find the percent off',m=>{const p=panel(0);dsTitle(p,'Julie paid $35 for a $50 shirt','What was the percent discount?');const b=dsBar(p,160,250,16,50,15);dsText(p,'paid $35',160+280,235,m('paid'),32,TOT,'middle');dsText(p,'saved $15',160+560+120,235,m('done'),30,DS,'middle');dsText(p,'original price $50',160+400,385,m('start'),32,COL.chalk,'middle');dsMath(p,'35 = x × 50 → x = 0.7',800,520,m('eq'),54);dsText(p,'Julie paid 70% of the price',800,605,m('paid'),36,TOT,'middle');dsMath(p,'1 − 0.7 = 0.3 = 30%',800,725,m('sub'),58,DS);dsText(p,'check: 15 ÷ 50 = 0.30',800,820,m('done',1),33,COL.dim,'middle');}],-['markup','Markup: add it',m=>{const p=panel(0);dsTitle(p,'A game costs the store $40 · 20% markup','markup = the increase that makes a profit');const b=dsUp(p,160,250,20,40,8);dsText(p,'store pays $40',160+400,385,m('bar'),32,COL.chalk,'middle');dsText(p,'markup',160+800+80,225,m('bar',1),30,UP,'middle');dsMath(p,'20% = 0.20',800,520,m('conv'),50,COL.task);dsMath(p,'0.20 × 40 = 8',800,625,m('mult'),54,UP);dsMath(p,'40 + 8 = 48',800,730,m('add'),56,TOT);dsText(p,'one step: (1 + rate) × cost = 1.2 × 40',800,820,m('one'),34,COL.dim,'middle');}],-['markorig','Work back to the cost',m=>{const p=panel(0);dsTitle(p,'Cake price $5.08 · 70% markup','What did the bakery pay?');const b=dsUp(p,160,255,5,100,70);dsText(p,'cost = 100%',160+250,390,m('start'),32,COL.chalk,'middle');dsText(p,'markup 70%',160+500+175,230,m('pct'),30,UP,'middle');dsMath(p,'100% + 70% = 170% = 1.7',800,520,m('pct',1),46,COL.task);dsMath(p,'5.08 = 1.7 × c',800,625,m('eq'),56);dsMath(p,'c = 5.08 ÷ 1.7 ≈ 2.99',800,730,m('divide'),56);dsText(p,'check: 1.7 × 2.99 = 5.083 ≈ 5.08',800,825,m('check'),33,COL.dim,'middle');}],-['updown','Down, then up',m=>{const p=panel(0);dsTitle(p,'A $200 bed · 30% off, then 20% markup','Each percent is of the price at that moment');dsBar(p,160,230,3,200,60,0,70);dsText(p,'$200 − $60 = $140',160+210,335,m('down'),30,COL.chalk,'middle');dsUp(p,160,380,3,140,28,0,70);dsText(p,'$140 + $28 = $168',160+210,485,m('up'),30,COL.chalk,'middle');dsMath(p,'0.30 × 200 = 60',1180,270,m('down'),44,DS,'middle');dsMath(p,'0.20 × 140 = 28',1180,425,m('up'),44,UP,'middle');dsText(p,'not 10% off ($180)',800,620,m('note'),40,COL.task,'middle');dsText(p,'The markup started from a smaller price.',800,700,m('note',5),34,COL.dim,'middle');dsText(p,'final price $168',800,790,m('note',8),42,TOT,'middle');}],+['percentoff','Find the percent off',m=>{const p=panel(0);dsTitle(p,'Julie paid $35 for a $50 shirt','What was the percent discount?');const b=dsBar(p,200,250,24,50,15);put(b.d,{o:0});show(b.d,m('done'));dsText(p,'paid $35',620,235,m('paid'),32,TOT,'middle');dsText(p,'saved $15',1220,235,m('done'),30,DS,'middle');dsText(p,'original price $50',800,385,m('start'),32,COL.chalk,'middle');dsMath(p,'35 = x × 50 → x = 0.7',800,520,m('eq'),54);dsText(p,'Julie paid 70% of the price',800,605,m('paid'),36,TOT,'middle');dsMath(p,'1 − 0.7 = 0.3 = 30%',800,725,m('sub'),58,DS);dsText(p,'check: 15 ÷ 50 = 0.30',800,820,m('done',1),33,COL.dim,'middle');}],+['markup','Markup: add it',m=>{const p=panel(0);dsTitle(p,'A game costs the store $40 · 20% markup','markup = the increase that makes a profit');const b=dsUp(p,200,250,25,40,8);put(b.ex,{o:0});show(b.ex,m('bar'));dsText(p,'store pays $40',700,315,m('bar'),34,COL.chalk,'middle');dsText(p,'markup',1300,315,m('bar'),30,COL.chalk,'middle');dsBr(p,200,236,1200,'price $48',m('add'));dsMath(p,'20% = 0.20',800,520,m('conv'),50,COL.task);dsMath(p,'0.20 × 40 = 8',800,625,m('mult'),54,UP);dsMath(p,'40 + 8 = 48',800,730,m('add'),56,TOT);dsText(p,'one step: (1 + rate) × cost = 1.2 × 40',800,820,m('one'),34,COL.dim,'middle');}],+['markorig','Work back to the cost',m=>{const p=panel(0);dsTitle(p,'Cake price $5.08 · 70% markup','What did the bakery pay?');const b=dsUp(p,205,255,7,100,70);put(b.ex,{o:0});show(b.ex,m('pct'));dsText(p,'cost = 100%',555,320,m('start'),34,COL.chalk,'middle');dsText(p,'markup 70%',1150,320,m('pct'),30,COL.chalk,'middle');dsBr(p,205,241,1190,'price $5.08 = 170%',m('pct',3));dsMath(p,'100% + 70% = 170% = 1.7',800,520,m('pct',1),46,COL.task);dsMath(p,'5.08 = 1.7 × c',800,625,m('eq'),56);dsMath(p,'c = 5.08 ÷ 1.7 ≈ 2.99',800,730,m('divide'),56);dsText(p,'check: 1.7 × 2.99 = 5.083 ≈ 5.08',800,825,m('check'),33,COL.dim,'middle');}],+['updown','Down, then up',m=>{const p=panel(0);dsTitle(p,'A $200 bed · 30% off, then 20% markup','Each percent is of the price at that moment');const u1=dsBar(p,160,230,3,200,60,m('start'),70);put(u1.d,{o:0});show(u1.d,m('down'));dsText(p,'$200 − $60 = $140',160+210,335,m('down'),30,COL.chalk,'middle');const u2=dsUp(p,160,380,3,140,28,m('up'),70);dsText(p,'$140 + $28 = $168',160+210,485,m('up'),30,COL.chalk,'middle');dsMath(p,'0.30 × 200 = 60',1180,270,m('down'),44,DS,'middle');dsMath(p,'0.20 × 140 = 28',1180,425,m('up'),44,UP,'middle');dsText(p,'not 10% off ($180)',800,620,m('note'),40,COL.task,'middle');dsText(p,'The markup started from a smaller price.',800,700,m('note',5),34,COL.dim,'middle');dsText(p,'final price $168',800,790,m('note',8),42,TOT,'middle');}],['q3','Up, then down',()=>{const p=panel(0);dsTitle(p,'$100 · marked up 25%, then marked down 25%','Does it come back to $100?');dsUp(p,160,230,6,100,25,0,70);dsText(p,'$100 + 25% = $125',160+375,335,0,30,COL.chalk,'middle');dsBar(p,160,370,6,125,31.25,0,70);dsText(p,'$125 − 25% of $125 = ?',160+375,475,0,30,COL.chalk,'middle');},{ask:done=>quiz(BAND,[{id:'c-updown',prompt:'Where does the price end?',build:choice(['$100','$93.75','$75'],1,'100 × 1.25 = 125, then 125 × 0.75 = 93.75. The 25% off is taken from the larger price.',['The two 25% steps are of different prices: $100 and then $125.','','That subtracts 25% from $100 but forgets the markup first.'])}],done)}],['wrap','Four habits',m=>{const p=panel(0);dsTitle(p,'Discounts and markups · the same percent idea');[['Discount: a percent of the original price, subtracted. Markup: a percent of the cost, added.','w1'],['Sale price = (1 − rate) × price. Marked-up price = (1 + rate) × cost.','w2'],['To work back, divide by the same factor, such as 0.7 or 1.7.','w3'],['Two changes? Do one at a time, each from the current price.','w4']].forEach(([s,key],i)=>{const g=G(p,{x:-16,y:285+i*145,o:0});mk('circle',{cx:130,cy:-10,r:26,fill:COL.task},g);T(g,String(i+1),{x:130,y:0,size:30,anchor:'middle',fill:COL.board});T(g,s,{x:195,size:31});tw(g,{x:0,o:1},m(key),.6);});}],['final1','Chapter practice',()=>panel(0),{ask:done=>quiz(SCREEN,[{id:'p-disc',prompt:'Discounts. Type only the number of dollars.',build:blanks([{parts:['$300 computer, 15% off: discount $',{box:'45'},' price $',{box:'255'}],why:'0.15 × 300 = 45, and 300 − 45 = 255.'},{parts:['$48 pants, 20% off: discount $',{box:'9.60'},' price $',{box:'38.40'}],why:'0.20 × 48 = 9.60, and 48 − 9.60 = 38.40.'},{parts:['Truck A: $14,500, 10% off. Price $',{box:'13050'}],why:'0.90 × 14,500 = 13,050.'},-{parts:['Truck B: $16,000, 14% off. Price $',{box:'13760'}],why:'0.86 × 16,000 = 13,760. Truck A is the better deal.'}-])}],done,'Chapter practice 1 of 3')}],+{parts:['Truck B: $16,000, 14% off. Price $',{box:'13760'}],why:'0.86 × 16,000 = 13,760.'}+])}],done,'Chapter practice · set 1 of 3')}],['final2','Chapter practice',()=>panel(0),{ask:done=>quiz(SCREEN,[{id:'p-orig',prompt:'Work backward, or take two discounts. Type only the number.',build:blanks([{parts:['Bike on sale for 45% off at $299.75. Original price $',{box:'545'}],why:'100% − 45% = 55%, and 299.75 ÷ 0.55 = 545.'},{parts:['$30 shirt, 15% off, then 10% more. Final price $',{box:'22.95'}],why:'0.85 × 30 = 25.50, then 0.90 × 25.50 = 22.95.'},-{parts:['Paid $35 for a $50 shirt. Percent discount ',{box:'30'},' %'],why:'35 ÷ 50 = 0.7 is paid, so 1 − 0.7 = 0.3, which is 30%.'},+{parts:['Paid $51 for a $60 shirt. Percent discount ',{box:'15'},' %'],why:'51 ÷ 60 = 0.85 is paid, so 1 − 0.85 = 0.15, which is 15%.'},{parts:['Sale price $60, original price $80. Percent discount ',{box:'25'},' %'],why:'60 ÷ 80 = 0.75 is paid, so the discount is 0.25, which is 25%.'}-])}],done,'Chapter practice 2 of 3')}],+])}],done,'Chapter practice · set 2 of 3')}],['final3','Chapter practice',()=>panel(0),{ask:done=>quiz(SCREEN,[{id:'p-mark',prompt:'Markups. Type only the number of dollars.',build:blanks([{parts:['$50 shelf, 8% markup: markup $',{box:'4'},' new price $',{box:'54'}],why:'0.08 × 50 = 4, and 50 + 4 = 54.'},{parts:['$350 bike, 15% markup: markup $',{box:'52.50'},' new price $',{box:'402.50'}],why:'0.15 × 350 = 52.50, and 350 + 52.50 = 402.50.'},{parts:['Milk sells for $3.24 after a 35% markup. Cost $',{box:'2.40'}],why:'3.24 ÷ 1.35 = 2.40.'},{parts:['Bed costs $200, marked down 30% then up 20%. Price $',{box:'168'}],why:'0.70 × 200 = 140, then 1.20 × 140 = 168.'}-])}],done,'Chapter practice 3 of 3')}],+])}],done,'Chapter practice · set 3 of 3')}],['finish','Finished',()=>panel(0),{ask:finishCard}]].map(([id,title,run,extra])=>({id,title,run,...extra}));boot();diff --git a/site/math-notebook/ch23/index.html b/site/math-notebook/ch23/index.htmlindex 1e5065c..ec7f14d 100644--- a/site/math-notebook/ch23/index.html+++ b/site/math-notebook/ch23/index.html@@ -11,7 +11,7 @@ const gcTitle=(p,s,sub='',ts=.15)=>{gcText(p,s,100,110,.1,43);if(sub)gcText(p,su// bill strip at u px per dollar with the tip (pink) on its right end; tipAt: when the tip grows from nothing (null = drawn already)function gcBar(p,x,y,u,bill,tip,t=0,h=100,tipAt=null){const g=G(p,{x,y,o:0});const b=mk('rect',{width:bill*u,height:h,fill:COL.chalk,'fill-opacity':.14,stroke:COL.chalk,'stroke-width':3},g);const e=mk('rect',{x:bill*u,width:tip*u,height:h,fill:TIP,'fill-opacity':.7,stroke:TIP,'stroke-width':3},g);if(tipAt!==null){put(e,{a_width:0,o:0});tw(e,{a_width:tip*u,o:1},tipAt,.9,out);}show(g,t);return {g,b,ex:e,w:(bill+tip)*u};}// sales strip cut into $100 blocks; each block holds a green slice for the rate (0..1) at its foot-function gcSales(p,x,y,u,sales,rate,t=0,h=100,sliceAt=null){const g=G(p,{x,y,o:0}),bw=100*u,n=Math.round(sales/100),sl=[];for(let i=0;i<n;i++)mk('rect',{x:i*bw,width:bw,height:h,fill:COL.chalk,'fill-opacity':.14,stroke:COL.dim,'stroke-width':1.5},g);for(let i=0;i<n;i++){const s=mk('rect',{x:i*bw+1.5,y:h-rate*h,width:bw-3,height:rate*h,fill:COM},g);if(sliceAt!==null){put(s,{o:0});show(s,sliceAt+i*(1.6/n),.3);}sl.push(s);}mk('rect',{width:n*bw,height:h,fill:'none',stroke:COL.chalk,'stroke-width':3},g);show(g,t);return {g,sl,w:n*bw};}+function gcSales(p,x,y,u,sales,rate,t=0,h=100,sliceAt=null){const g=G(p,{x,y,o:0}),bw=100*u,n=Math.round(sales/100),sl=[];for(let i=0;i<n;i++)mk('rect',{x:i*bw,width:bw,height:h,fill:COL.chalk,'fill-opacity':.14,stroke:COL.dim,'stroke-width':1.5},g);for(let i=0;i<n;i++){const s=mk('rect',{x:i*bw+1.5,y:h-Math.max(8,rate*h),width:bw-3,height:Math.max(8,rate*h),fill:COM},g);if(sliceAt!==null){put(s,{o:0});show(s,sliceAt+i*(1.6/n),.3);}sl.push(s);}mk('rect',{width:n*bw,height:h,fill:'none',stroke:COL.chalk,'stroke-width':3},g);show(g,t);return {g,sl,w:n*bw};}function gcChoices(p,items,u){return items.map(([bill,tip,total],i)=>{const x=130+i*480,g=G(p);gcBar(g,x,360,u,bill,tip,0,100);gcText(g,String.fromCharCode(65+i),x+bill*u/2,270,0,34,COL.dim,'middle');gcText(g,'bill $'+bill,x,330,0,28);gcText(g,'+ tip $'+tip,x,500,0,29,TIP);gcText(g,'= total $'+total,x,550,0,31,TOT);return {el:g,box:[x-20,235,460,360],label:'Picture '+String.fromCharCode(65+i)+', bill '+bill+', tip '+tip+', total '+total};});}// a paper receipt for the bill, drawn around its top-left cornerfunction gcReceipt(p,x,y){const g=G(p,{x,y});let d='M0 0H220V300';for(let i=0;i<11;i++)d+=`l-10 ${i%2?14:-14}l-10 ${i%2?-14:14}`;d+='Z';path(g,d,{fill:COL.chalk,'fill-opacity':.1,stroke:COL.chalk,'stroke-width':3});T(g,'BILL',{x:110,y:48,size:26,anchor:'middle',fill:COL.dim,weight:600});[90,130,170].forEach((yy,i)=>{path(g,`M28 ${yy}H${120-i*14}`,{stroke:COL.dim,'stroke-width':3});path(g,`M160 ${yy}H192`,{stroke:COL.dim,'stroke-width':3});});path(g,'M28 205H192',{stroke:COL.chalk,'stroke-width':2,'stroke-dasharray':'6 6'});T(g,'$25.00',{x:110,y:250,size:36,anchor:'middle',font:MATH});return g;}@@ -28,17 +28,17 @@ gcText(p,'found just like sales tax (Chapter 21)',800,660,m('tax'),32,COL.dim,'mconst br=path(p,'M160 372V390H1080V372',{stroke:TOT,'stroke-width':4},{d:0});draw(br,m('add'),.8);gcText(p,'total $28.75',620,436,m('add',.4),36,TOT,'middle');gcMath(p,'15% = 0.15',800,540,m('conv'),50,COL.task);gcMath(p,'25 × 0.15 = 3.75',800,640,m('mult'),54,TIP);gcMath(p,'25 + 3.75 = 28.75',800,740,m('add'),54,TOT);gcText(p,'one step: 1.15 × 25 = 28.75',800,830,m('one'),34,COL.dim,'middle');}],['prop','Bigger bill, bigger tip',m=>{const p=panel(0);gcTitle(p,'Same 15% tip · different bills','Each strip: 8 px = $1');-[[20,3,'b20'],[40,6,'b40'],[80,12,'b80']].forEach(([bill,tip,k],i)=>{const y=270+i*150,g=G(p,{o:0});gcBar(g,120,y,8,bill,tip,0,60);T(g,'bill $'+bill,{x:120,y:y-16,size:28});T(g,'tip $'+tip,{x:120+bill*8+8,y:y-16,size:28,fill:TIP});show(g,m(k));if(i)pulse(g,m('double',.2+i*.5),1.03);});+[[20,3,'b20'],[40,6,'b40'],[80,12,'b80']].forEach(([bill,tip,k],i)=>{const y=270+i*150,g=G(p,{x:120,y,o:0});gcBar(g,0,0,8,bill,tip,0,60);T(g,'bill $'+bill,{x:0,y:-16,size:28});T(g,'tip $'+tip,{x:bill*8+8,y:-16,size:28,fill:TIP});show(g,m(k));if(i)pulse(g,m('double',.2+i*.5),1.03);});// tip-vs-bill graph: origin (1040,720), 4.6 px per bill dollar, 26 px per tip dollar-const ox=1040,oy=720,gx=v=>ox+v*4.6,gy=v=>oy-v*26,A=G(p,{o:0});path(A,`M${ox} ${gy(16)}V${oy}H${gx(104)}`,{stroke:COL.dim,'stroke-width':3});[20,40,60,80,100].forEach(v=>{path(A,`M${gx(v)} ${oy}v10`,{stroke:COL.dim,'stroke-width':2});T(A,String(v),{x:gx(v),y:oy+38,size:22,fill:COL.dim,anchor:'middle',font:MATH});});[3,6,9,12,15].forEach(v=>{path(A,`M${ox} ${gy(v)}h-10`,{stroke:COL.dim,'stroke-width':2});T(A,String(v),{x:ox-18,y:gy(v)+8,size:22,fill:COL.dim,anchor:'end',font:MATH});});T(A,'bill ($)',{x:gx(104),y:oy+76,size:24,fill:COL.dim,anchor:'end'});T(A,'tip ($)',{x:ox,y:gy(16)-18,size:24,fill:COL.dim,anchor:'middle'});show(A,m('same'));+const ox=1040,oy=720,gx=v=>ox+v*4.6,gy=v=>oy-v*26,A=G(p,{o:0});path(A,`M${ox} ${gy(16)}V${oy}H${gx(104)}`,{stroke:COL.dim,'stroke-width':3});[20,40,60,80,100].forEach(v=>{path(A,`M${gx(v)} ${oy}v10`,{stroke:COL.dim,'stroke-width':2});T(A,String(v),{x:gx(v),y:oy+38,size:28,fill:COL.dim,anchor:'middle',font:MATH});});[3,6,9,12,15].forEach(v=>{path(A,`M${ox} ${gy(v)}h-10`,{stroke:COL.dim,'stroke-width':2});T(A,String(v),{x:ox-18,y:gy(v)+10,size:28,fill:COL.dim,anchor:'end',font:MATH});});T(A,'bill ($)',{x:gx(104),y:oy+80,size:30,fill:COL.dim,anchor:'end'});T(A,'tip ($)',{x:ox,y:gy(16)-18,size:30,fill:COL.dim,anchor:'middle'});show(A,m('same'));const ln=path(p,`M${ox} ${oy}L${gx(100)} ${gy(15)}`,{stroke:COL.task,'stroke-width':4},{d:0});draw(ln,m('line'),1.2);[[20,3,'b20'],[40,6,'b40'],[80,12,'b80']].forEach(([v,w,k])=>{const d=G(p,{x:gx(v),y:gy(w),s:0,o:0});mk('circle',{r:11,fill:TIP},d);pop(d,m(k,.3));});gcText(p,'double the bill → double the tip',120,760,m('double'),34,COL.task);gcText(p,'tip = 0.15 × bill: the tip is proportional to the bill',800,850,m('prop'),32,COL.chalk,'middle');}],['q1','Which picture?',()=>{const p=panel(0);gcTitle(p,'A $40 bill · 20% tip','Same scale in each picture: 7 px = $1');S.gcCh=gcChoices(p,[[40,'0.80','40.80'],[40,8,48],[40,20,60]],7);},{ask:done=>quiz(BAND,[{id:'c-tip',prompt:'Which picture shows a 20% tip on the $40 bill?',build:pickEls(S.gcCh,1,'0.20 × 40 = 8, so the tip is $8 and the total is 40 + 8 = $48.',i=>i===0?'$0.80 is 2% of $40. For 20%, multiply by 0.20, not 0.02.':'$20 is half the bill, which is 50%. 20% of $40 is $8.')}],done)}],-['commission','A 12% commission',m=>{const p=panel(0);gcTitle(p,'A summer job · 12% commission on sales','Her first week: $3,500 of clothes sold',m('sales'));const s=gcSales(p,160,250,.24,3500,.12,m('sales'),100,m('cut'));gcText(p,'35 blocks of $100',160,232,m('sales',2),27,COL.dim);-gcText(p,'12% of each block',1040,300,m('cut'),32,COM);gcText(p,'= $12 of every $100',1040,346,m('cut',.6),28,COL.dim);-const bar=mk('rect',{x:160,y:395,width:3500*.12*.24,height:100,fill:COM,'fill-opacity':.75,stroke:COM,'stroke-width':3},p);put(bar,{a_width:0,o:0});tw(bar,{a_width:3500*.12*.24,o:1},m('earn'),.9,out);gcText(p,'her commission: $420',290,458,m('earn',.3),34,COM);-gcMath(p,'12% = 0.12',800,600,m('conv'),50,COL.task);gcMath(p,'3,500 × 0.12 = 420',800,700,m('mult'),54,COM);+['commission','A 12% commission',m=>{const p=panel(0);gcTitle(p,'A summer job · 12% commission on sales','Her first week: $3,500 of clothes sold',m('sales'));const s=gcSales(p,160,250,.24,3500,.12,m('sales'),160,m('cut'));gcText(p,'12% commission on her sales',1040,252,m('deal'),34,COM);gcText(p,'35 blocks of $100',160,232,m('sales',2),27,COL.dim);+gcText(p,'12% of each block',1040,310,m('cut'),32,COM);gcText(p,'= $12 of every $100',1040,356,m('cut',.6),28,COL.dim);+const bar=mk('rect',{x:160,y:440,width:3500*.12*.24,height:100,fill:COM,'fill-opacity':.75,stroke:COM,'stroke-width':3},p);put(bar,{a_width:0,o:0});tw(bar,{a_width:3500*.12*.24,o:1},m('earn'),.9,out);gcText(p,'her commission: $420',290,503,m('earn',.3),34,COM);+gcMath(p,'12% = 0.12',800,625,m('conv'),50,COL.task);gcMath(p,'3,500 × 0.12 = 420',800,720,m('mult'),54,COM);gcText(p,'The customer pays $3,500 either way; the store pays her $420 of it.',800,810,m('note'),31,COL.dim,'middle');}],['proportion','Or use a proportion',m=>{const p=panel(0);gcTitle(p,'Same commission · as a proportion','A percent is a rate out of 100');gcMath(p,[F('12','100'),' = ',F('x','3,500')],440,330,m('set'),64,COL.chalk);@@ -47,15 +47,18 @@ const tb=G(p,{o:0});T(tb,'sales ($)',{x:1110,y:290,size:28,fill:COL.dim,anchor:'const x420=gcMath(p,'420',1340,495,m('x'),46,COM);hide(xq,m('x'),.3);const ar=G(p,{o:0});path(ar,'M990 368Q950 425 990 482M977 468L991 484L998 463',{stroke:COL.task,'stroke-width':3});T(ar,'× 35',{x:950,y:436,size:30,fill:COL.task,anchor:'end'});path(ar,'M1470 368Q1510 425 1470 482M1483 468L1469 484L1462 463',{stroke:COL.task,'stroke-width':3});T(ar,'× 35',{x:1510,y:436,size:30,fill:COL.task});show(ar,m('scale'));pulse(x420,m('scale',4),1.25);gcText(p,'12 out of 100 is the same rate as 420 out of 3,500',800,830,m('same'),32,COL.chalk,'middle');}],-['q2','Find the commission',()=>{const p=panel(0);gcTitle(p,'$2,400 of furniture sold · 6% commission','Each block = $100; green = 6% of the block');gcSales(p,160,260,.35,2400,.06,0,100);gcText(p,'sales $2,400',160,420,0,30);},{ask:done=>quiz(BAND,[{id:'c-com',prompt:'How much does the salesperson earn?',build:blanks([{parts:['6% of $2,400 = $',{box:'144'}],why:'0.06 × 2,400 = 144: $6 from each of the 24 hundreds.',hint:'Change 6% to 0.06 (not 0.6), then multiply by 2,400.'}])}],done)}],+['q2','Find the commission',()=>{const p=panel(0);gcTitle(p,'$2,400 of furniture sold · 6% commission','Each block = $100; green = 6% of the block');gcSales(p,160,260,.35,2400,.06,0,160);gcText(p,'sales $2,400',160,470,0,30);},{ask:done=>quiz(BAND,[{id:'c-com',prompt:'How much does the salesperson earn?',build:blanks([{parts:['6% of $2,400 = $',{box:'144'}],why:'0.06 × 2,400 = 144: $6 from each of the 24 hundreds.',hint:'Change 6% to 0.06 (not 0.6), then multiply by 2,400.'}])}],done)}],['compare','Commission or a flat fee?',m=>{const p=panel(0);gcTitle(p,'Amber: 12% commission or a $500 flat fee?','Her sales for the period: $3,950',m('sales'));gcMath(p,'0.12 × 3,950 = 474',800,270,m('calc'),50,COM);-const x0=440,u=1.3,b1=G(p,{o:0}),b2=G(p,{o:0});mk('rect',{x:x0,y:340,width:474*u,height:70,fill:COM,'fill-opacity':.7,stroke:COM,'stroke-width':3},b1);T(b1,'12% commission',{x:x0-24,y:386,size:30,fill:COM,anchor:'end'});T(b1,'$474',{x:x0+500*u+18,y:388,size:32,fill:COM});-mk('rect',{x:x0,y:450,width:500*u,height:70,fill:COL.chalk,'fill-opacity':.18,stroke:COL.chalk,'stroke-width':3},b2);T(b2,'flat fee',{x:x0-24,y:496,size:30,anchor:'end'});T(b2,'$500',{x:x0+500*u+18,y:498,size:32});show(b1,m('bars'));show(b2,m('bars',.4));-const dl=path(p,`M${x0+500*u} 322V540`,{stroke:COL.task,'stroke-width':3,'stroke-dasharray':'8 8'},{o:0});show(dl,m('pick'));pulse(b2,m('pick',.4),1.03);+const x0=440,u=1.3;+const l1=gcText(p,'12% of sales?',x0-24,386,m('offer'),30,COM,'end'),l2=gcText(p,'$500 flat',x0-24,496,m('offer',3.5),30,COL.chalk,'end');+[340,450].forEach((y,i)=>{const r=G(p,{o:0});mk('rect',{x:x0,y,width:500*u,height:70,fill:'none',stroke:COL.dim,'stroke-width':2,'stroke-dasharray':'8 8'},r);show(r,m('offer',i*3.5));});+const b1=G(p,{x:x0,y:340,o:0}),b2=G(p,{x:x0,y:450,o:0});mk('rect',{width:474*u,height:70,fill:COM,'fill-opacity':.7,stroke:COM,'stroke-width':3},b1);T(b1,'$474',{x:474*u-16,y:48,size:34,fill:COL.board,anchor:'end',weight:600});+const r2=mk('rect',{width:500*u,height:70,fill:COL.chalk,'fill-opacity':.18,stroke:COL.chalk,'stroke-width':3},b2);T(b2,'$500',{x:500*u+18,y:48,size:32});show(b2,m('offer',5));show(b1,m('calc',1));+const dl=path(p,`M${x0+500*u} 322V540`,{stroke:COL.task,'stroke-width':3,'stroke-dasharray':'8 8'},{o:0});show(dl,m('pick'));tw(r2,{c_stroke:COL.task},m('pick',.4),.5);gcText(p,'474 < 500 → choose the flat fee',800,625,m('pick'),40,TOT,'middle');gcMath(p,'500 ÷ 0.12 ≈ 4,166.67',800,725,m('even'),44,COL.task);gcText(p,'Commission pays more only when sales top about $4,166.67.',800,800,m('even',2),30,COL.dim,'middle');}],-['q3','Who received more?',()=>{const p=panel(0);gcTitle(p,'A tip and a commission','Same scale: 2 px = $1');gcText(p,'Luke, a waiter · bill $236 · 18% tip',160,250,0,30,TIP);gcBar(p,160,270,2,236,0,0,70);gcText(p,'Mary, an electronics seller · sales $380 · 12% commission',160,420,0,30,COM);const g=G(p,{x:160,y:440});mk('rect',{width:760,height:70,fill:COL.chalk,'fill-opacity':.14,stroke:COL.chalk,'stroke-width':3},g);},{ask:done=>quiz(BAND,[{id:'c-who',prompt:'Who received more money?',build:choice(['Luke','Mary','They received the same'],1,'Luke: 0.18 × 236 = $42.48. Mary: 0.12 × 380 = $45.60. Mary gets more, even with the smaller rate.',['A bigger rate is not enough: 0.18 × 236 = 42.48, but 0.12 × 380 = 45.60.','','Work out both: 0.18 × 236 = 42.48 and 0.12 × 380 = 45.60.'])}],done)}],+['q3','Who received more?',()=>{const p=panel(0);gcTitle(p,'A tip and a commission');gcText(p,'Luke, a waiter',160,330,0,40,TIP);gcText(p,'bill $236 · 18% tip',160,390,0,36,COL.chalk);gcText(p,'Mary, an electronics seller',160,540,0,40,COM);gcText(p,'sales $380 · 12% commission',160,600,0,36,COL.chalk);},{ask:done=>quiz(BAND,[{id:'c-who',prompt:'Who received more money?',build:choice(['Luke','Mary','They received the same'],1,'Luke: 0.18 × 236 = $42.48. Mary: 0.12 × 380 = $45.60. Mary gets more, even with the smaller rate.',['A bigger rate is not enough: 0.18 × 236 = 42.48, but 0.12 × 380 = 45.60.','','Work out both: 0.18 × 236 = 42.48 and 0.12 × 380 = 45.60.'])}],done)}],['wrap','Four habits',m=>{const p=panel(0);gcTitle(p,'Gratuity and commission · the same percent idea');[['Gratuity (tip): a percent of the bill. Commission: a percent of the sales.','w1'],['Change the percent to a decimal, then multiply by the total.','w2'],['A tip is added to the bill. A commission is a share of the sale.','w3'],['Or use a proportion: rate / 100 = amount / total.','w4']].forEach(([s,key],i)=>{const g=G(p,{x:-16,y:285+i*145,o:0});mk('circle',{cx:130,cy:-10,r:26,fill:COL.task},g);T(g,String(i+1),{x:130,y:0,size:30,anchor:'middle',fill:COL.board});T(g,s,{x:195,size:31});tw(g,{x:0,o:1},m(key),.6);});}],['final1','Chapter practice',()=>panel(0),{ask:done=>quiz(SCREEN,[{id:'p-tip',prompt:'Tips and totals. Type only the number of dollars, no $ or commas; round to the cent.',build:blanks([{parts:['Lee family: $45 bill, 18% tip. Tip $',{box:'8.10'}],why:'0.18 × 45 = 8.10.'},@@ -63,13 +66,13 @@ gcMath(p,'500 ÷ 0.12 ≈ 4,166.67',800,725,m('even'),44,COL.task);gcText(p,'Com{parts:['Babysitter: $70, 32% tip. Tip $',{box:'22.40'},' total $',{box:'92.40'}],why:'0.32 × 70 = 22.40, and 70 + 22.40 = 92.40.'},{parts:['Haircut: $25 with a 10% tip. Total $',{box:'27.50'}],why:'1.10 × 25 = 27.50.'},{parts:['Dinner: $32.75 bill, 17% tip. Total $',{box:'38.32'}],why:'1.17 × 32.75 = 38.3175, which rounds to $38.32.'}-])}],done,'Chapter practice 1 of 2')}],+])}],done,'Chapter practice · set 1 of 2')}],['final2','Chapter practice',()=>panel(0),{ask:done=>quiz(SCREEN,[{id:'p-com',prompt:'Commissions. Type only the number of dollars, no $ or commas.',build:blanks([{parts:['35% of $6,000 in sales. Commission $',{box:'2100'}],why:'0.35 × 6,000 = 2,100.'},{parts:['Julio sells scooters: 8% of $5,450. Commission $',{box:'436'}],why:'0.08 × 5,450 = 436.'},{parts:['Mauricio: 8% of $25,000 = $',{box:'2000'},' Judith: 9.5% of $22,000 = $',{box:'2090'}],why:'0.08 × 25,000 = 2,000 and 0.095 × 22,000 = 2,090: Judith earned more.'},{parts:['Agent: 3% of a $250,000 house sale. Commission $',{box:'7500'}],why:'0.03 × 250,000 = 7,500.'}-])}],done,'Chapter practice 2 of 2')}],+])}],done,'Chapter practice · set 2 of 2')}],['finish','Finished',()=>panel(0),{ask:finishCard}]].map(([id,title,run,extra])=>({id,title,run,...extra}));boot();diff --git a/site/math-notebook/lib/engine.js b/site/math-notebook/lib/engine.jsindex a452cd7..1a2efe1 100644--- a/site/math-notebook/lib/engine.js+++ b/site/math-notebook/lib/engine.js@@ -24,7 +24,7 @@ const TRANSLATIONS = {checksInLesson: 'Quick checks and practice are in the interactive lesson.',volumeLabel: 'Adjust volume', volumeTitle: 'Volume (0 = muted)', volumeSlider: 'Volume',helpLabel: 'Keyboard shortcuts (?)', speedLabel: 'Playback speed (< and >)', captionsLabel: 'Captions (C)', fullScreenLabel: 'Full screen', goToStep: 'Go to step {n}: {title}',- quickCheck: 'Quick check', countOf: '{k} of {n}', check: 'Check', showAnswer: 'Show answer', nextQuestion: 'Next question', continue: 'Continue',+ quickCheck: 'Quick check', countOf: 'question {k} of {n}', check: 'Check', showAnswer: 'Show answer', nextQuestion: 'Next question', continue: 'Continue',correct: 'Correct. ', notQuite: 'Not quite. ', answerPrefix: 'Answer: ', keysPrefix: 'Keys: ',hintMove: ' move, ', hintChoose: ' choose', hintChooseOrClickGrid: ' choose, or click the grid', hintMoveAlongLine: ' move along the line, ',hintChooseOrClick: ' choose, or click', hintRow: ' row, ', hintTypeFraction: 'type numbers like 3/4 or −2 1/4, ', hintTypeNumber: 'type the number, ',@@ -61,7 +61,7 @@ const TRANSLATIONS = {checksInLesson: 'Проверочные вопросы и практика — в интерактивном уроке.',volumeLabel: 'Настроить громкость', volumeTitle: 'Громкость (0 — без звука)', volumeSlider: 'Громкость',helpLabel: 'Горячие клавиши (?)', speedLabel: 'Скорость воспроизведения (< и >)', captionsLabel: 'Субтитры (C)', fullScreenLabel: 'Полный экран', goToStep: 'Перейти к шагу {n}: {title}',- quickCheck: 'Проверь себя', countOf: '{k} из {n}', check: 'Проверить', showAnswer: 'Показать ответ', nextQuestion: 'Следующий вопрос', continue: 'Продолжить',+ quickCheck: 'Проверь себя', countOf: 'вопрос {k} из {n}', check: 'Проверить', showAnswer: 'Показать ответ', nextQuestion: 'Следующий вопрос', continue: 'Продолжить',correct: 'Верно. ', notQuite: 'Не совсем. ', answerPrefix: 'Ответ: ', keysPrefix: 'Клавиши: ',hintMove: ' двигаться, ', hintChoose: ' выбрать', hintChooseOrClickGrid: ' выбрать или щёлкнуть по сетке', hintMoveAlongLine: ' двигаться по прямой, ',hintChooseOrClick: ' выбрать или щёлкнуть', hintRow: ' строка, ', hintTypeFraction: 'вводите числа вида 3/4 или −2 1/4, ', hintTypeNumber: 'введите число, ',@@ -96,7 +96,7 @@ const TRANSLATIONS = {checksInLesson: '小测验和练习在互动课程里。',volumeLabel: '调节音量', volumeTitle: '音量(0 为静音)', volumeSlider: '音量',helpLabel: '键盘快捷键(?)', speedLabel: '播放速度(< 和 >)', captionsLabel: '字幕(C)', fullScreenLabel: '全屏', goToStep: '跳到第 {n} 步:{title}',- quickCheck: '小测', countOf: '{k} / {n}', check: '检查', showAnswer: '显示答案', nextQuestion: '下一题', continue: '继续',+ quickCheck: '小测', countOf: '第 {k}/{n} 题', check: '检查', showAnswer: '显示答案', nextQuestion: '下一题', continue: '继续',correct: '正确。', notQuite: '还不对。', answerPrefix: '答案:', keysPrefix: '按键:',hintMove: ' 移动,', hintChoose: ' 选择', hintChooseOrClickGrid: ' 选择,或点击网格', hintMoveAlongLine: ' 沿数轴移动,',hintChooseOrClick: ' 选择,或点击', hintRow: ' 换行,', hintTypeFraction: '可输入 3/4 或 −2 1/4 这样的数,', hintTypeNumber: '输入数字,',@@ -131,7 +131,7 @@ const TRANSLATIONS = {checksInLesson: '確認問題と練習はインタラクティブな授業の中にあります。',volumeLabel: '音量を調整', volumeTitle: '音量(0 でミュート)', volumeSlider: '音量',helpLabel: 'キーボードショートカット(?)', speedLabel: '再生速度(< と >)', captionsLabel: '字幕(C)', fullScreenLabel: '全画面', goToStep: 'ステップ {n}:{title} へ移動',- quickCheck: '確認問題', countOf: '{k} / {n}', check: '答え合わせ', showAnswer: '答えを見る', nextQuestion: '次の問題', continue: '続ける',+ quickCheck: '確認問題', countOf: '問 {k}/{n}', check: '答え合わせ', showAnswer: '答えを見る', nextQuestion: '次の問題', continue: '続ける',correct: '正解。', notQuite: 'おしい。', answerPrefix: '答え:', keysPrefix: 'キー:',hintMove: ' 移動、', hintChoose: ' 選ぶ', hintChooseOrClickGrid: ' 選ぶ、またはマス目をクリック', hintMoveAlongLine: ' 数直線上を移動、',hintChooseOrClick: ' 選ぶ、またはクリック', hintRow: ' 行、', hintTypeFraction: '3/4 や −2 1/4 のように入力、', hintTypeNumber: '数を入力、',@@ -899,7 +899,7 @@ function quiz(pos, qs, done, label = translate('quickCheck')) {if (isShortcut(e, 's') && !bShow.hidden) { bShow.click(); return true; }return false;};- const kick = label + (qs.length > 1 ? ' ' + translate('countOf', { k: k + 1, n: qs.length }) : '');+ const kick = label + (qs.length > 1 ? ' · ' + translate('countOf', { k: k + 1, n: qs.length }) : '');const head = h('div', 'head', [h('p', 'kicker', kick), h('p', 'prompt', [rich(q.prompt, pos.cls.startsWith('screen') ? 38 : 28)])]); // match the prompt's type sizeif (ctl.hint) head.append(h('p', 'keys', [translate('keysPrefix'), ...ctl.hint]));c.replaceChildren(...(guide ? [guide] : []), head, fb, body, acts);diff --git a/site/physics-notebook/lib/engine.js b/site/physics-notebook/lib/engine.jsindex a452cd7..1a2efe1 100644--- a/site/physics-notebook/lib/engine.js+++ b/site/physics-notebook/lib/engine.js@@ -24,7 +24,7 @@ const TRANSLATIONS = {checksInLesson: 'Quick checks and practice are in the interactive lesson.',volumeLabel: 'Adjust volume', volumeTitle: 'Volume (0 = muted)', volumeSlider: 'Volume',helpLabel: 'Keyboard shortcuts (?)', speedLabel: 'Playback speed (< and >)', captionsLabel: 'Captions (C)', fullScreenLabel: 'Full screen', goToStep: 'Go to step {n}: {title}',- quickCheck: 'Quick check', countOf: '{k} of {n}', check: 'Check', showAnswer: 'Show answer', nextQuestion: 'Next question', continue: 'Continue',+ quickCheck: 'Quick check', countOf: 'question {k} of {n}', check: 'Check', showAnswer: 'Show answer', nextQuestion: 'Next question', continue: 'Continue',correct: 'Correct. ', notQuite: 'Not quite. ', answerPrefix: 'Answer: ', keysPrefix: 'Keys: ',hintMove: ' move, ', hintChoose: ' choose', hintChooseOrClickGrid: ' choose, or click the grid', hintMoveAlongLine: ' move along the line, ',hintChooseOrClick: ' choose, or click', hintRow: ' row, ', hintTypeFraction: 'type numbers like 3/4 or −2 1/4, ', hintTypeNumber: 'type the number, ',@@ -61,7 +61,7 @@ const TRANSLATIONS = {checksInLesson: 'Проверочные вопросы и практика — в интерактивном уроке.',volumeLabel: 'Настроить громкость', volumeTitle: 'Громкость (0 — без звука)', volumeSlider: 'Громкость',helpLabel: 'Горячие клавиши (?)', speedLabel: 'Скорость воспроизведения (< и >)', captionsLabel: 'Субтитры (C)', fullScreenLabel: 'Полный экран', goToStep: 'Перейти к шагу {n}: {title}',- quickCheck: 'Проверь себя', countOf: '{k} из {n}', check: 'Проверить', showAnswer: 'Показать ответ', nextQuestion: 'Следующий вопрос', continue: 'Продолжить',+ quickCheck: 'Проверь себя', countOf: 'вопрос {k} из {n}', check: 'Проверить', showAnswer: 'Показать ответ', nextQuestion: 'Следующий вопрос', continue: 'Продолжить',correct: 'Верно. ', notQuite: 'Не совсем. ', answerPrefix: 'Ответ: ', keysPrefix: 'Клавиши: ',hintMove: ' двигаться, ', hintChoose: ' выбрать', hintChooseOrClickGrid: ' выбрать или щёлкнуть по сетке', hintMoveAlongLine: ' двигаться по прямой, ',hintChooseOrClick: ' выбрать или щёлкнуть', hintRow: ' строка, ', hintTypeFraction: 'вводите числа вида 3/4 или −2 1/4, ', hintTypeNumber: 'введите число, ',@@ -96,7 +96,7 @@ const TRANSLATIONS = {checksInLesson: '小测验和练习在互动课程里。',volumeLabel: '调节音量', volumeTitle: '音量(0 为静音)', volumeSlider: '音量',helpLabel: '键盘快捷键(?)', speedLabel: '播放速度(< 和 >)', captionsLabel: '字幕(C)', fullScreenLabel: '全屏', goToStep: '跳到第 {n} 步:{title}',- quickCheck: '小测', countOf: '{k} / {n}', check: '检查', showAnswer: '显示答案', nextQuestion: '下一题', continue: '继续',+ quickCheck: '小测', countOf: '第 {k}/{n} 题', check: '检查', showAnswer: '显示答案', nextQuestion: '下一题', continue: '继续',correct: '正确。', notQuite: '还不对。', answerPrefix: '答案:', keysPrefix: '按键:',hintMove: ' 移动,', hintChoose: ' 选择', hintChooseOrClickGrid: ' 选择,或点击网格', hintMoveAlongLine: ' 沿数轴移动,',hintChooseOrClick: ' 选择,或点击', hintRow: ' 换行,', hintTypeFraction: '可输入 3/4 或 −2 1/4 这样的数,', hintTypeNumber: '输入数字,',@@ -131,7 +131,7 @@ const TRANSLATIONS = {checksInLesson: '確認問題と練習はインタラクティブな授業の中にあります。',volumeLabel: '音量を調整', volumeTitle: '音量(0 でミュート)', volumeSlider: '音量',helpLabel: 'キーボードショートカット(?)', speedLabel: '再生速度(< と >)', captionsLabel: '字幕(C)', fullScreenLabel: '全画面', goToStep: 'ステップ {n}:{title} へ移動',- quickCheck: '確認問題', countOf: '{k} / {n}', check: '答え合わせ', showAnswer: '答えを見る', nextQuestion: '次の問題', continue: '続ける',+ quickCheck: '確認問題', countOf: '問 {k}/{n}', check: '答え合わせ', showAnswer: '答えを見る', nextQuestion: '次の問題', continue: '続ける',correct: '正解。', notQuite: 'おしい。', answerPrefix: '答え:', keysPrefix: 'キー:',hintMove: ' 移動、', hintChoose: ' 選ぶ', hintChooseOrClickGrid: ' 選ぶ、またはマス目をクリック', hintMoveAlongLine: ' 数直線上を移動、',hintChooseOrClick: ' 選ぶ、またはクリック', hintRow: ' 行、', hintTypeFraction: '3/4 や −2 1/4 のように入力、', hintTypeNumber: '数を入力、',@@ -899,7 +899,7 @@ function quiz(pos, qs, done, label = translate('quickCheck')) {if (isShortcut(e, 's') && !bShow.hidden) { bShow.click(); return true; }return false;};- const kick = label + (qs.length > 1 ? ' ' + translate('countOf', { k: k + 1, n: qs.length }) : '');+ const kick = label + (qs.length > 1 ? ' · ' + translate('countOf', { k: k + 1, n: qs.length }) : '');const head = h('div', 'head', [h('p', 'kicker', kick), h('p', 'prompt', [rich(q.prompt, pos.cls.startsWith('screen') ? 38 : 28)])]); // match the prompt's type sizeif (ctl.hint) head.append(h('p', 'keys', [translate('keysPrefix'), ...ctl.hint]));c.replaceChildren(...(guide ? [guide] : []), head, fb, body, acts);diff --git a/site/science/ch09/index.html b/site/science/ch09/index.htmlindex 49c695a..967cbbb 100644--- a/site/science/ch09/index.html+++ b/site/science/ch09/index.html@@ -886,7 +886,7 @@ const BEATS = [[null, 'That is Sam’s speed measured from the road, not from the driver.', 'Nothing adds up to 80 here. Sam rides along with the driver.']) },{ id: 'p-cyclist', prompt: ['A cyclist rides 90 meters in 15 seconds. What is her speed?'],build: blanks([{ parts: ['speed = 90 ÷ 15 = ', { box: '6' }, ' meters per second'], why: '90 ÷ 15 = 6.', hint: 'Divide the distance by the time.' }]) },-], done, 'Chapter practice, set 1 of 2 · question') }], // the engine appends "k of n"+], done, 'Chapter practice, set 1 of 2') }], // the engine appends "k of n"['final2', 'Chapter practice: velocity and acceleration', () => { panel(0); }, { ask: done => quiz(SCREEN, [{ id: 'p-jog', prompt: ['A jogger runs at +3 meters per second, then turns around and jogs at the same pace. What is her new velocity?'],build: blanks([{ parts: ['velocity = ', { box: '-3' }, ' meters per second'], why: 'Same speed, opposite direction: the sign flips.', hint: 'The speed stays 3; the direction is opposite, so the sign changes.' }]) },@@ -898,7 +898,7 @@ const BEATS = [build: blanks([{ parts: ['acceleration = (16 − 4) ÷ 3 = ', { box: '4' }, ' meters per second squared'], why: '16 − 4 = 12, and 12 ÷ 3 = 4.', hint: 'Final velocity minus starting velocity, then divide by the time.' }]) },{ id: 'p-dec', prompt: ['A bike slows down from 8 to 2 meters per second in 3 seconds. What is its acceleration?'],build: blanks([{ parts: ['acceleration = (2 − 8) ÷ 3 = ', { box: '-2' }, ' meters per second squared'], why: '2 − 8 = −6, and −6 ÷ 3 = −2: negative, because it slows down.', hint: 'Final minus starting velocity is negative here. Divide it by the time.' }]) },-], done, 'Chapter practice, set 2 of 2 · question') }],+], done, 'Chapter practice, set 2 of 2') }],['finish', 'Finished', () => { panel(0); }, { ask: finishCard }],].map(([id, title, run, extra]) => ({ id, title, run, ...extra }));diff --git a/site/science/ch10/index.html b/site/science/ch10/index.htmlindex 4786017..fdd7486 100644--- a/site/science/ch10/index.html+++ b/site/science/ch10/index.html@@ -708,7 +708,7 @@ const BEATS = [[null, 'Close: it is meters per second squared, an acceleration.', 'Force is measured in newtons; the kilogram measures mass.']) },{ id: 'p-net3', prompt: ['Forces on a box: 6 newtons right, 4 newtons right, and 3 newtons left. What is the net force?'],build: blanks([{ parts: ['net force = 6 + 4 − 3 = ', { box: '7' }, ' newtons, to the right'], why: 'Same direction adds (6 + 4 = 10); the opposite force subtracts (10 − 3 = 7).', hint: 'Add the forces to the right, then subtract the one to the left.' }]) },-]), done, 'Chapter practice, set 1 of 2 · question') }],+]), done, 'Chapter practice, set 1 of 2') }],['final2', 'Chapter practice: the second and third laws', () => { PRACTICE = panel(0); }, { ask: done => quiz(SCREEN, withPics([{ id: 'p-second', prompt: ['What is ', h('b', '', 'Newton’s second law'), '?'],build: choice([['The acceleration of an object equals the net force on it divided by its mass.'], ['Objects keep their motion unless a net force acts.'], ['Forces act in pairs.']], 0,@@ -720,7 +720,7 @@ const BEATS = ['Forces act in pairs: equal in size, opposite in direction.', [null, 'That is about inertia (first law).', 'That defines momentum.']) },{ id: 'p-mom', prompt: ['A 0.5 kilogram ball moves at 8 meters per second. What is its momentum?'],build: blanks([{ parts: ['momentum = 0.5 × 8 = ', { box: '4' }, ' kilogram meters per second'], why: 'mass × velocity = 0.5 × 8 = 4.', hint: 'momentum = mass × velocity.' }]) },-]), done, 'Chapter practice, set 2 of 2 · question') }],+]), done, 'Chapter practice, set 2 of 2') }],['finish', 'Finished', () => {// under the card, the chapter in four small pictures with their namesconst p = panel(0);diff --git a/site/science/ch11/index.html b/site/science/ch11/index.htmlindex a219076..377c466 100644--- a/site/science/ch11/index.html+++ b/site/science/ch11/index.html@@ -945,7 +945,7 @@ const BEATS = [{ id: 'p-feather', prompt: ['Why does a feather drift back and forth as it falls?'],build: choice([['air resistance pushes up against its fall'], ['gravity doesn’t act on feathers'], ['it has no mass']], 0,'A feather has a big surface for its tiny weight, so air resistance nearly balances gravity.', [null, 'Gravity pulls on everything with mass, feathers too.', 'It has a little mass; that’s why it does fall.']) },-]), done, 'Chapter practice, set 1 of 2 · question') }],+]), done, 'Chapter practice, set 1 of 2') }],['final2', 'Chapter practice: more forces', () => { PRACTICE = panel(0); }, { ask: done => quiz(SCREEN, withPics([{ id: 'p-term', prompt: ['When air resistance equals the force of gravity, a falling object…'],build: choice([['reaches terminal velocity: it falls at a steady speed'], ['stops in midair'], ['speeds up faster']], 0,@@ -959,7 +959,7 @@ const BEATS = [build: choice([['the buoyant force'], ['centripetal force'], ['friction']], 0, 'Buoyancy: the upward push of a fluid.', [null, 'That keeps things moving in circles.', 'Friction opposes motion; it doesn’t hold boats up.']) },{ id: 'p-dog', prompt: ['A dog swimming in a lake pushes aside 10 pounds of water. What is the buoyant force on the dog?'],build: blanks([{ parts: ['buoyant force = ', { box: '10' }, ' pounds'], why: 'It equals the weight of the water pushed aside: 10 pounds.', hint: 'Archimedes’ principle.' }]) },-]), done, 'Chapter practice, set 2 of 2 · question') }],+]), done, 'Chapter practice, set 2 of 2') }],['finish', 'Finished', () => {// under the card, the chapter in four small pictures with their namesconst p = panel(0);diff --git a/site/science/ch12/index.html b/site/science/ch12/index.htmlindex 3747e2d..668faf1 100644--- a/site/science/ch12/index.html+++ b/site/science/ch12/index.html@@ -767,7 +767,7 @@ const BEATS = [build: choice([['second class'], ['first class'], ['third class']], 0,'The load is between the fulcrum (the wheel) and the effort: second class.',[null, 'In a first-class lever the fulcrum is in the middle.', 'In a third-class lever the effort is in the middle.']) },-]), done, 'Chapter practice, set 1 of 2 · question') }],+]), done, 'Chapter practice, set 1 of 2') }],['final2', 'Chapter practice: machines and power', () => { PRACTICE = panel(0); }, { ask: done => quiz(SCREEN, withPics([{ id: 'p-ful', prompt: ['What is the point a lever turns on called?'],build: choice([['the fulcrum'], ['the axle'], ['the load']], 0, 'A lever pivots on its fulcrum.',@@ -785,7 +785,7 @@ const BEATS = [[null, 'That is a lever.', 'That is closer to a screw, an inclined plane wrapped around.']) },{ id: 'p-power', prompt: ['You do 120 J of work in 4 s. What is your power?'],build: blanks([{ parts: ['power = 120 J ÷ 4 s = ', { box: '30' }, ' W'], why: 'Power is work divided by time: 120 ÷ 4 = 30 W.', hint: 'Divide the work by the time.' }]) },-]), done, 'Chapter practice, set 2 of 2 · question') }],+]), done, 'Chapter practice, set 2 of 2') }],['finish', 'Finished', () => {// under the card, the chapter in four small pictures with their namesconst p = panel(0);diff --git a/site/science/ch13/index.html b/site/science/ch13/index.htmlindex cb70176..fa94f1b 100644--- a/site/science/ch13/index.html+++ b/site/science/ch13/index.html@@ -689,7 +689,7 @@ const BEATS = [build: choice([['its mass and its height'], ['its color and its height'], ['its speed and its temperature']], 0,'More mass or more height: more potential energy.',[null, 'Color doesn’t matter; mass does.', 'Speed is about kinetic energy; the book isn’t moving.']) },-]), done, 'Chapter practice, set 1 of 2 · question') }],+]), done, 'Chapter practice, set 1 of 2') }],['final2', 'Chapter practice: energy changes form', () => { PRACTICE = panel(0); }, { ask: done => quiz(SCREEN, withPics([{ id: 'p-change', prompt: ['Energy is constantly ________ from one form to another.'],build: choice([['changing'], ['disappearing'], ['being created']], 0,@@ -707,7 +707,7 @@ const BEATS = [build: choice([['a bowling ball rolling fast'], ['a bowling ball rolling slowly'], ['a tennis ball rolling slowly']], 0,'The most mass and the most speed: the most kinetic energy.',[null, 'The same ball rolling faster has more.', 'Less mass and less speed: the least of the three.']) },-]), done, 'Chapter practice, set 2 of 2 · question') }],+]), done, 'Chapter practice, set 2 of 2') }],['finish', 'Finished', () => {// under the card, the chapter in four small pictures with their namesconst p = panel(0);diff --git a/site/science/ch14/index.html b/site/science/ch14/index.htmlindex 2044bc3..27169ab 100644--- a/site/science/ch14/index.html+++ b/site/science/ch14/index.html@@ -584,7 +584,7 @@ const BEATS = [build: choice([['radiation'], ['conduction'], ['convection']], 0,'Microwaves are electromagnetic waves: radiation.',[null, 'Nothing hot touches the food; the oven sends electromagnetic waves.', 'The air doesn’t carry it; microwaves are electromagnetic waves.']) },-]), done, 'Chapter practice, set 1 of 2 · question') }],+]), done, 'Chapter practice, set 1 of 2') }],['final2', 'Chapter practice: how heat moves', () => { PRACTICE = panel(0); }, { ask: done => quiz(SCREEN, withPics([{ id: 'p-pop', prompt: ['You lick a Popsicle.'],build: grid([@@ -605,7 +605,7 @@ const BEATS = [{ parts: ['When an object heats up, it'], ans: ['e'], why: 'Its molecules speed up and spread apart: it expands.' },{ parts: ['When an object cools down, it'], ans: ['c'], why: 'Its molecules slow down and pull together: it contracts.' },], [['e', 'expands', HEAT, 'e'], ['c', 'contracts', COLD, 'c']], { multi: false, text: true }) },-]), done, 'Chapter practice, set 2 of 2 · question') }],+]), done, 'Chapter practice, set 2 of 2') }],['finish', 'Finished', () => {// under the card, the chapter in four small pictures with their namesconst p = panel(0);diff --git a/site/science/ch15/index.html b/site/science/ch15/index.htmlindex a0e894a..2adf70a 100644--- a/site/science/ch15/index.html+++ b/site/science/ch15/index.html@@ -1156,7 +1156,7 @@ const BEATS = [build: choice([['radio waves'], ['infrared'], ['gamma rays']], 2,'Gamma rays have the most energy of all and can damage living cells.',['Radio waves have the lowest energy.', 'Infrared is warmth from warm things.', null]) },-]), done, 'Chapter practice, set 1 of 2 · question') }],+]), done, 'Chapter practice, set 1 of 2') }],['final2', 'Chapter practice: the spectrum and sound', () => { PRACTICE = panel(0); }, { ask: done => quiz(SCREEN, withPics([{ id: 'p-sun', prompt: ['What kind of wave causes sunburn?'],build: choice([['infrared'], ['visible light'], ['ultraviolet']], 2,@@ -1178,7 +1178,7 @@ const BEATS = [build: choice([['Longer waves mean more of them pass each second.'], ['Louder sounds are higher.'], ['At the same speed, shorter waves mean more of them pass each second.']], 2,'Sound’s speed stays the same, so short waves pass more often: a higher frequency, a higher pitch.',['Longer waves pass less often: fewer each second.', 'Loudness is amplitude; pitch is frequency.', null]) },-]), done, 'Chapter practice, set 2 of 2 · question') }],+]), done, 'Chapter practice, set 2 of 2') }],['finish', 'Finished', () => {// under the card, the chapter in four small pictures with their namesconst p = panel(0);diff --git a/site/science/ch16/index.html b/site/science/ch16/index.htmlindex 663682f..0427db8 100644--- a/site/science/ch16/index.html+++ b/site/science/ch16/index.html@@ -1114,7 +1114,7 @@ const BEATS = [build: choice([['when it has more protons than electrons'], ['when it has no neutrons'], ['when it has more electrons than protons']], 2,'Extra electrons make it negative.',['More protons makes it positive.', 'Neutrons have no charge.', null]) },-]), done, 'Chapter practice, set 1 of 2 · question') }],+]), done, 'Chapter practice, set 1 of 2') }],['final2', 'Chapter practice: circuits and resistance', () => { PRACTICE = panel(0); }, { ask: done => quiz(SCREEN, withPics([{ id: 'p-hair', prompt: ['A negatively charged hairbrush is held near your hair. What charge appears on the hair near it, and what happens?'],build: choice([['Negative, so the hair is pushed away.'], ['Positive is induced, so the hair is pulled toward the brush.'], ['No charge; nothing happens.']], 1,@@ -1136,7 +1136,7 @@ const BEATS = [build: choice([['Yes, all go out.'], ['Only half go out.'], ['No: charges still flow through the other branches.']], 2,'Each bulb has its own branch, so the rest stay closed loops.',['That is a series circuit.', 'Every other branch still works.', null]) },-]), done, 'Chapter practice, set 2 of 2 · question') }],+]), done, 'Chapter practice, set 2 of 2') }],['finish', 'Finished', () => {// under the card, the chapter in four small pictures with their namesconst p = panel(0);diff --git a/site/science/ch17/index.html b/site/science/ch17/index.htmlindex caec369..efdaf03 100644--- a/site/science/ch17/index.html+++ b/site/science/ch17/index.html@@ -956,7 +956,7 @@ const BEATS = [build: choice([['a hydroelectric dam'], ['a wind farm'], ['a photovoltaic solar panel']], 2,'It turns sunlight directly into electricity.',['Water spins its turbine.', 'Wind spins its turbines.', null]) },-]), done, 'Chapter practice, set 1 of 2 · question') }],+]), done, 'Chapter practice, set 1 of 2') }],['final2', 'Chapter practice: how each source works', () => { PRACTICE = panel(0); }, { ask: done => quiz(SCREEN, withPics([{ id: 'p-solar', prompt: ['How are the two kinds of solar collector different?'],build: choice([['thermal ones make electricity directly; photovoltaic ones heat water'], ['thermal ones absorb sunlight to heat water; photovoltaic ones turn sunlight directly into electricity'], ['thermal ones use wind; photovoltaic ones use tides']], 1,@@ -981,7 +981,7 @@ const BEATS = [{ parts: ['natural gas'], ans: ['n'], why: 'That is a fossil fuel.' },{ parts: ['uranium'], ans: ['n'], why: 'Uranium is a mined metal, not a living thing.' },], [['y', 'yes', COL.good, 'y'], ['n', 'no', COL.bad, 'n']], { multi: false, text: true }) },-]), done, 'Chapter practice, set 2 of 2 · question') }],+]), done, 'Chapter practice, set 2 of 2') }],['finish', 'Finished', (m, D) => {// under the card, the chapter in four small pictures with their namesconst p = panel(0);diff --git a/site/science/lib/engine.js b/site/science/lib/engine.jsindex a452cd7..1a2efe1 100644--- a/site/science/lib/engine.js+++ b/site/science/lib/engine.js@@ -24,7 +24,7 @@ const TRANSLATIONS = {checksInLesson: 'Quick checks and practice are in the interactive lesson.',volumeLabel: 'Adjust volume', volumeTitle: 'Volume (0 = muted)', volumeSlider: 'Volume',helpLabel: 'Keyboard shortcuts (?)', speedLabel: 'Playback speed (< and >)', captionsLabel: 'Captions (C)', fullScreenLabel: 'Full screen', goToStep: 'Go to step {n}: {title}',- quickCheck: 'Quick check', countOf: '{k} of {n}', check: 'Check', showAnswer: 'Show answer', nextQuestion: 'Next question', continue: 'Continue',+ quickCheck: 'Quick check', countOf: 'question {k} of {n}', check: 'Check', showAnswer: 'Show answer', nextQuestion: 'Next question', continue: 'Continue',correct: 'Correct. ', notQuite: 'Not quite. ', answerPrefix: 'Answer: ', keysPrefix: 'Keys: ',hintMove: ' move, ', hintChoose: ' choose', hintChooseOrClickGrid: ' choose, or click the grid', hintMoveAlongLine: ' move along the line, ',hintChooseOrClick: ' choose, or click', hintRow: ' row, ', hintTypeFraction: 'type numbers like 3/4 or −2 1/4, ', hintTypeNumber: 'type the number, ',@@ -61,7 +61,7 @@ const TRANSLATIONS = {checksInLesson: 'Проверочные вопросы и практика — в интерактивном уроке.',volumeLabel: 'Настроить громкость', volumeTitle: 'Громкость (0 — без звука)', volumeSlider: 'Громкость',helpLabel: 'Горячие клавиши (?)', speedLabel: 'Скорость воспроизведения (< и >)', captionsLabel: 'Субтитры (C)', fullScreenLabel: 'Полный экран', goToStep: 'Перейти к шагу {n}: {title}',- quickCheck: 'Проверь себя', countOf: '{k} из {n}', check: 'Проверить', showAnswer: 'Показать ответ', nextQuestion: 'Следующий вопрос', continue: 'Продолжить',+ quickCheck: 'Проверь себя', countOf: 'вопрос {k} из {n}', check: 'Проверить', showAnswer: 'Показать ответ', nextQuestion: 'Следующий вопрос', continue: 'Продолжить',correct: 'Верно. ', notQuite: 'Не совсем. ', answerPrefix: 'Ответ: ', keysPrefix: 'Клавиши: ',hintMove: ' двигаться, ', hintChoose: ' выбрать', hintChooseOrClickGrid: ' выбрать или щёлкнуть по сетке', hintMoveAlongLine: ' двигаться по прямой, ',hintChooseOrClick: ' выбрать или щёлкнуть', hintRow: ' строка, ', hintTypeFraction: 'вводите числа вида 3/4 или −2 1/4, ', hintTypeNumber: 'введите число, ',@@ -96,7 +96,7 @@ const TRANSLATIONS = {checksInLesson: '小测验和练习在互动课程里。',volumeLabel: '调节音量', volumeTitle: '音量(0 为静音)', volumeSlider: '音量',helpLabel: '键盘快捷键(?)', speedLabel: '播放速度(< 和 >)', captionsLabel: '字幕(C)', fullScreenLabel: '全屏', goToStep: '跳到第 {n} 步:{title}',- quickCheck: '小测', countOf: '{k} / {n}', check: '检查', showAnswer: '显示答案', nextQuestion: '下一题', continue: '继续',+ quickCheck: '小测', countOf: '第 {k}/{n} 题', check: '检查', showAnswer: '显示答案', nextQuestion: '下一题', continue: '继续',correct: '正确。', notQuite: '还不对。', answerPrefix: '答案:', keysPrefix: '按键:',hintMove: ' 移动,', hintChoose: ' 选择', hintChooseOrClickGrid: ' 选择,或点击网格', hintMoveAlongLine: ' 沿数轴移动,',hintChooseOrClick: ' 选择,或点击', hintRow: ' 换行,', hintTypeFraction: '可输入 3/4 或 −2 1/4 这样的数,', hintTypeNumber: '输入数字,',@@ -131,7 +131,7 @@ const TRANSLATIONS = {checksInLesson: '確認問題と練習はインタラクティブな授業の中にあります。',volumeLabel: '音量を調整', volumeTitle: '音量(0 でミュート)', volumeSlider: '音量',helpLabel: 'キーボードショートカット(?)', speedLabel: '再生速度(< と >)', captionsLabel: '字幕(C)', fullScreenLabel: '全画面', goToStep: 'ステップ {n}:{title} へ移動',- quickCheck: '確認問題', countOf: '{k} / {n}', check: '答え合わせ', showAnswer: '答えを見る', nextQuestion: '次の問題', continue: '続ける',+ quickCheck: '確認問題', countOf: '問 {k}/{n}', check: '答え合わせ', showAnswer: '答えを見る', nextQuestion: '次の問題', continue: '続ける',correct: '正解。', notQuite: 'おしい。', answerPrefix: '答え:', keysPrefix: 'キー:',hintMove: ' 移動、', hintChoose: ' 選ぶ', hintChooseOrClickGrid: ' 選ぶ、またはマス目をクリック', hintMoveAlongLine: ' 数直線上を移動、',hintChooseOrClick: ' 選ぶ、またはクリック', hintRow: ' 行、', hintTypeFraction: '3/4 や −2 1/4 のように入力、', hintTypeNumber: '数を入力、',@@ -899,7 +899,7 @@ function quiz(pos, qs, done, label = translate('quickCheck')) {if (isShortcut(e, 's') && !bShow.hidden) { bShow.click(); return true; }return false;};- const kick = label + (qs.length > 1 ? ' ' + translate('countOf', { k: k + 1, n: qs.length }) : '');+ const kick = label + (qs.length > 1 ? ' · ' + translate('countOf', { k: k + 1, n: qs.length }) : '');const head = h('div', 'head', [h('p', 'kicker', kick), h('p', 'prompt', [rich(q.prompt, pos.cls.startsWith('screen') ? 38 : 28)])]); // match the prompt's type sizeif (ctl.hint) head.append(h('p', 'keys', [translate('keysPrefix'), ...ctl.hint]));c.replaceChildren(...(guide ? [guide] : []), head, fb, body, acts);diff --git a/site/shooting-an-elephant/lib/engine.js b/site/shooting-an-elephant/lib/engine.jsindex a452cd7..1a2efe1 100644--- a/site/shooting-an-elephant/lib/engine.js+++ b/site/shooting-an-elephant/lib/engine.js@@ -24,7 +24,7 @@ const TRANSLATIONS = {checksInLesson: 'Quick checks and practice are in the interactive lesson.',volumeLabel: 'Adjust volume', volumeTitle: 'Volume (0 = muted)', volumeSlider: 'Volume',helpLabel: 'Keyboard shortcuts (?)', speedLabel: 'Playback speed (< and >)', captionsLabel: 'Captions (C)', fullScreenLabel: 'Full screen', goToStep: 'Go to step {n}: {title}',- quickCheck: 'Quick check', countOf: '{k} of {n}', check: 'Check', showAnswer: 'Show answer', nextQuestion: 'Next question', continue: 'Continue',+ quickCheck: 'Quick check', countOf: 'question {k} of {n}', check: 'Check', showAnswer: 'Show answer', nextQuestion: 'Next question', continue: 'Continue',correct: 'Correct. ', notQuite: 'Not quite. ', answerPrefix: 'Answer: ', keysPrefix: 'Keys: ',hintMove: ' move, ', hintChoose: ' choose', hintChooseOrClickGrid: ' choose, or click the grid', hintMoveAlongLine: ' move along the line, ',hintChooseOrClick: ' choose, or click', hintRow: ' row, ', hintTypeFraction: 'type numbers like 3/4 or −2 1/4, ', hintTypeNumber: 'type the number, ',@@ -61,7 +61,7 @@ const TRANSLATIONS = {checksInLesson: 'Проверочные вопросы и практика — в интерактивном уроке.',volumeLabel: 'Настроить громкость', volumeTitle: 'Громкость (0 — без звука)', volumeSlider: 'Громкость',helpLabel: 'Горячие клавиши (?)', speedLabel: 'Скорость воспроизведения (< и >)', captionsLabel: 'Субтитры (C)', fullScreenLabel: 'Полный экран', goToStep: 'Перейти к шагу {n}: {title}',- quickCheck: 'Проверь себя', countOf: '{k} из {n}', check: 'Проверить', showAnswer: 'Показать ответ', nextQuestion: 'Следующий вопрос', continue: 'Продолжить',+ quickCheck: 'Проверь себя', countOf: 'вопрос {k} из {n}', check: 'Проверить', showAnswer: 'Показать ответ', nextQuestion: 'Следующий вопрос', continue: 'Продолжить',correct: 'Верно. ', notQuite: 'Не совсем. ', answerPrefix: 'Ответ: ', keysPrefix: 'Клавиши: ',hintMove: ' двигаться, ', hintChoose: ' выбрать', hintChooseOrClickGrid: ' выбрать или щёлкнуть по сетке', hintMoveAlongLine: ' двигаться по прямой, ',hintChooseOrClick: ' выбрать или щёлкнуть', hintRow: ' строка, ', hintTypeFraction: 'вводите числа вида 3/4 или −2 1/4, ', hintTypeNumber: 'введите число, ',@@ -96,7 +96,7 @@ const TRANSLATIONS = {checksInLesson: '小测验和练习在互动课程里。',volumeLabel: '调节音量', volumeTitle: '音量(0 为静音)', volumeSlider: '音量',helpLabel: '键盘快捷键(?)', speedLabel: '播放速度(< 和 >)', captionsLabel: '字幕(C)', fullScreenLabel: '全屏', goToStep: '跳到第 {n} 步:{title}',- quickCheck: '小测', countOf: '{k} / {n}', check: '检查', showAnswer: '显示答案', nextQuestion: '下一题', continue: '继续',+ quickCheck: '小测', countOf: '第 {k}/{n} 题', check: '检查', showAnswer: '显示答案', nextQuestion: '下一题', continue: '继续',correct: '正确。', notQuite: '还不对。', answerPrefix: '答案:', keysPrefix: '按键:',hintMove: ' 移动,', hintChoose: ' 选择', hintChooseOrClickGrid: ' 选择,或点击网格', hintMoveAlongLine: ' 沿数轴移动,',hintChooseOrClick: ' 选择,或点击', hintRow: ' 换行,', hintTypeFraction: '可输入 3/4 或 −2 1/4 这样的数,', hintTypeNumber: '输入数字,',@@ -131,7 +131,7 @@ const TRANSLATIONS = {checksInLesson: '確認問題と練習はインタラクティブな授業の中にあります。',volumeLabel: '音量を調整', volumeTitle: '音量(0 でミュート)', volumeSlider: '音量',helpLabel: 'キーボードショートカット(?)', speedLabel: '再生速度(< と >)', captionsLabel: '字幕(C)', fullScreenLabel: '全画面', goToStep: 'ステップ {n}:{title} へ移動',- quickCheck: '確認問題', countOf: '{k} / {n}', check: '答え合わせ', showAnswer: '答えを見る', nextQuestion: '次の問題', continue: '続ける',+ quickCheck: '確認問題', countOf: '問 {k}/{n}', check: '答え合わせ', showAnswer: '答えを見る', nextQuestion: '次の問題', continue: '続ける',correct: '正解。', notQuite: 'おしい。', answerPrefix: '答え:', keysPrefix: 'キー:',hintMove: ' 移動、', hintChoose: ' 選ぶ', hintChooseOrClickGrid: ' 選ぶ、またはマス目をクリック', hintMoveAlongLine: ' 数直線上を移動、',hintChooseOrClick: ' 選ぶ、またはクリック', hintRow: ' 行、', hintTypeFraction: '3/4 や −2 1/4 のように入力、', hintTypeNumber: '数を入力、',@@ -899,7 +899,7 @@ function quiz(pos, qs, done, label = translate('quickCheck')) {if (isShortcut(e, 's') && !bShow.hidden) { bShow.click(); return true; }return false;};- const kick = label + (qs.length > 1 ? ' ' + translate('countOf', { k: k + 1, n: qs.length }) : '');+ const kick = label + (qs.length > 1 ? ' · ' + translate('countOf', { k: k + 1, n: qs.length }) : '');const head = h('div', 'head', [h('p', 'kicker', kick), h('p', 'prompt', [rich(q.prompt, pos.cls.startsWith('screen') ? 38 : 28)])]); // match the prompt's type sizeif (ctl.hint) head.append(h('p', 'keys', [translate('keysPrefix'), ...ctl.hint]));c.replaceChildren(...(guide ? [guide] : []), head, fb, body, acts);diff --git a/site/three-little-pigs/lib/engine.js b/site/three-little-pigs/lib/engine.jsindex a452cd7..1a2efe1 100644--- a/site/three-little-pigs/lib/engine.js+++ b/site/three-little-pigs/lib/engine.js@@ -24,7 +24,7 @@ const TRANSLATIONS = {checksInLesson: 'Quick checks and practice are in the interactive lesson.',volumeLabel: 'Adjust volume', volumeTitle: 'Volume (0 = muted)', volumeSlider: 'Volume',helpLabel: 'Keyboard shortcuts (?)', speedLabel: 'Playback speed (< and >)', captionsLabel: 'Captions (C)', fullScreenLabel: 'Full screen', goToStep: 'Go to step {n}: {title}',- quickCheck: 'Quick check', countOf: '{k} of {n}', check: 'Check', showAnswer: 'Show answer', nextQuestion: 'Next question', continue: 'Continue',+ quickCheck: 'Quick check', countOf: 'question {k} of {n}', check: 'Check', showAnswer: 'Show answer', nextQuestion: 'Next question', continue: 'Continue',correct: 'Correct. ', notQuite: 'Not quite. ', answerPrefix: 'Answer: ', keysPrefix: 'Keys: ',hintMove: ' move, ', hintChoose: ' choose', hintChooseOrClickGrid: ' choose, or click the grid', hintMoveAlongLine: ' move along the line, ',hintChooseOrClick: ' choose, or click', hintRow: ' row, ', hintTypeFraction: 'type numbers like 3/4 or −2 1/4, ', hintTypeNumber: 'type the number, ',@@ -61,7 +61,7 @@ const TRANSLATIONS = {checksInLesson: 'Проверочные вопросы и практика — в интерактивном уроке.',volumeLabel: 'Настроить громкость', volumeTitle: 'Громкость (0 — без звука)', volumeSlider: 'Громкость',helpLabel: 'Горячие клавиши (?)', speedLabel: 'Скорость воспроизведения (< и >)', captionsLabel: 'Субтитры (C)', fullScreenLabel: 'Полный экран', goToStep: 'Перейти к шагу {n}: {title}',- quickCheck: 'Проверь себя', countOf: '{k} из {n}', check: 'Проверить', showAnswer: 'Показать ответ', nextQuestion: 'Следующий вопрос', continue: 'Продолжить',+ quickCheck: 'Проверь себя', countOf: 'вопрос {k} из {n}', check: 'Проверить', showAnswer: 'Показать ответ', nextQuestion: 'Следующий вопрос', continue: 'Продолжить',correct: 'Верно. ', notQuite: 'Не совсем. ', answerPrefix: 'Ответ: ', keysPrefix: 'Клавиши: ',hintMove: ' двигаться, ', hintChoose: ' выбрать', hintChooseOrClickGrid: ' выбрать или щёлкнуть по сетке', hintMoveAlongLine: ' двигаться по прямой, ',hintChooseOrClick: ' выбрать или щёлкнуть', hintRow: ' строка, ', hintTypeFraction: 'вводите числа вида 3/4 или −2 1/4, ', hintTypeNumber: 'введите число, ',@@ -96,7 +96,7 @@ const TRANSLATIONS = {checksInLesson: '小测验和练习在互动课程里。',volumeLabel: '调节音量', volumeTitle: '音量(0 为静音)', volumeSlider: '音量',helpLabel: '键盘快捷键(?)', speedLabel: '播放速度(< 和 >)', captionsLabel: '字幕(C)', fullScreenLabel: '全屏', goToStep: '跳到第 {n} 步:{title}',- quickCheck: '小测', countOf: '{k} / {n}', check: '检查', showAnswer: '显示答案', nextQuestion: '下一题', continue: '继续',+ quickCheck: '小测', countOf: '第 {k}/{n} 题', check: '检查', showAnswer: '显示答案', nextQuestion: '下一题', continue: '继续',correct: '正确。', notQuite: '还不对。', answerPrefix: '答案:', keysPrefix: '按键:',hintMove: ' 移动,', hintChoose: ' 选择', hintChooseOrClickGrid: ' 选择,或点击网格', hintMoveAlongLine: ' 沿数轴移动,',hintChooseOrClick: ' 选择,或点击', hintRow: ' 换行,', hintTypeFraction: '可输入 3/4 或 −2 1/4 这样的数,', hintTypeNumber: '输入数字,',@@ -131,7 +131,7 @@ const TRANSLATIONS = {checksInLesson: '確認問題と練習はインタラクティブな授業の中にあります。',volumeLabel: '音量を調整', volumeTitle: '音量(0 でミュート)', volumeSlider: '音量',helpLabel: 'キーボードショートカット(?)', speedLabel: '再生速度(< と >)', captionsLabel: '字幕(C)', fullScreenLabel: '全画面', goToStep: 'ステップ {n}:{title} へ移動',- quickCheck: '確認問題', countOf: '{k} / {n}', check: '答え合わせ', showAnswer: '答えを見る', nextQuestion: '次の問題', continue: '続ける',+ quickCheck: '確認問題', countOf: '問 {k}/{n}', check: '答え合わせ', showAnswer: '答えを見る', nextQuestion: '次の問題', continue: '続ける',correct: '正解。', notQuite: 'おしい。', answerPrefix: '答え:', keysPrefix: 'キー:',hintMove: ' 移動、', hintChoose: ' 選ぶ', hintChooseOrClickGrid: ' 選ぶ、またはマス目をクリック', hintMoveAlongLine: ' 数直線上を移動、',hintChooseOrClick: ' 選ぶ、またはクリック', hintRow: ' 行、', hintTypeFraction: '3/4 や −2 1/4 のように入力、', hintTypeNumber: '数を入力、',@@ -899,7 +899,7 @@ function quiz(pos, qs, done, label = translate('quickCheck')) {if (isShortcut(e, 's') && !bShow.hidden) { bShow.click(); return true; }return false;};- const kick = label + (qs.length > 1 ? ' ' + translate('countOf', { k: k + 1, n: qs.length }) : '');+ const kick = label + (qs.length > 1 ? ' · ' + translate('countOf', { k: k + 1, n: qs.length }) : '');const head = h('div', 'head', [h('p', 'kicker', kick), h('p', 'prompt', [rich(q.prompt, pos.cls.startsWith('screen') ? 38 : 28)])]); // match the prompt's type sizeif (ctl.hint) head.append(h('p', 'keys', [translate('keysPrefix'), ...ctl.hint]));c.replaceChildren(...(guide ? [guide] : []), head, fb, body, acts);