An AI skill that turns books into animated, narrated, interactive web experiences
JavaScript ai-agentsai-educationanimationclaudeclaude-codeclaude-skillsedtecheducationinteractive-textbookscormtext-to-video
<!doctype html>
<html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1"><title>Subtracting Positive and Negative Numbers — Elementary Mathematics</title><link rel="stylesheet" href="../lib/engine.css"><link rel="expect" href="#bar" blocking="render"><style>.screen .blanks .math{font-size:38px}.side .keys{font-size:20px}</style></head><body>
<script src="../lib/engine.js"></script><script src="../lib/math.js"></script><script src="audio/en/timings.js"></script><script>
'use strict';
const CHAPTER={number:12,title:'Subtracting Positive and Negative Numbers',minutes:13,language:'en', next: '../ch13/' };
const saColor=v=>v>0?POS:v<0?NEG:COL.chalk;
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,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,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,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,'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++){
const x=680+i*100,pp=saTile(g,1,'zero-'+i+'-positive',x,315,m('pairs')+i*.12),nn=saTile(g,-1,'zero-'+i+'-negative',x,450,m('pairs')+i*.12);
positive.push(pp);negative.push(nn);const ring=G(g,{x,y:382.5,o:0});
mk('rect',{x:-39,y:-107,width:78,height:214,rx:17,fill:'none',stroke:COL.chalk,'stroke-width':2,'stroke-dasharray':'6 5'},ring);show(ring,m('pairs')+.4+i*.12);hide(ring,m('remove')-.8,.4);pairs.push([pp,nn]);
}
const removed=(b>0?positive:negative).slice(0,Math.abs(b));
const survivors=[...positive,...negative].filter(e=>!removed.includes(e));
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,'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 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',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',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.'},
{parts:['19 − (−8) = ',{box:'27'}],why:'19 + 8 = 27.'},
{parts:['−4 − 10 = ',{box:'-14'}],why:'−4 + (−10) = −14.'},
{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 · 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 · 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.'}])},
{id:'p-altitude',prompt:'A drone is +44 meters and a diver is −17 meters relative to sea level. Find their VERTICAL SEPARATION: upper minus lower.',build:saBlanks([{parts:[{box:'61'},' meters'],why:'44 − (−17) = 44 + 17 = 61 meters.'}])},
{id:'p-tiles',prompt:'Start with 2 positive tiles and subtract −3. Add the MINIMUM zero pairs, then remove 3 negative tiles.',build:saBlanks([
{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 · set 3 of 3')}],
['finish','Finished',()=>panel(0),{ask:finishCard}]
].map(([id,title,run,extra])=>({id,title,run,...extra}));
boot();
</script></body></html>