Odd and Even Numbers Games for the Classroom: Keep Every Counter

HTML for this example

Select the code and use your copy shortcut. Changes in this preview are temporary.

<!doctype html>
<html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1"><title>Odd and Even Numbers Games for the Classroom: Keep Every Counter</title><style>*{box-sizing:border-box}body{margin:0;color:var(--ink,#233342);background:var(--bg,#eef2f3);font:17px/1.6 system-ui,sans-serif}main{max-width:980px;margin:auto;padding:clamp(16px,4vw,38px)}h1{font:700 clamp(30px,5vw,49px)/1.12 Georgia,serif;margin:10px 0 20px;max-width:800px}h2{font-size:24px;line-height:1.3;margin:0 0 15px}h3{font-size:19px;margin:12px 0}p{margin:0 0 16px}.eyebrow{font-weight:750;letter-spacing:.08em;text-transform:uppercase;font-size:16px}header{padding:10px 0 25px;border-bottom:3px solid var(--accent,#24586d);margin-bottom:24px}.lede{font-size:20px;max-width:760px}.panel{background:var(--paper,#fff);padding:clamp(18px,3vw,28px);border:1px solid var(--line,#c6d1d8);border-radius:12px;margin:20px 0}.grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:20px}.grid>*{min-width:0}.row{display:flex;gap:12px;flex-wrap:wrap;align-items:center;margin:16px 0}.stack>*{margin:12px 0}button{font:700 17px/1.4 system-ui,sans-serif;cursor:pointer;color:white;background:var(--accent,#24586d);border:2px solid var(--accent,#24586d);border-radius:7px;padding:11px 17px;max-width:100%;overflow-wrap:anywhere}button.secondary{background:transparent;color:var(--ink,#233342)}button[aria-pressed=true]{box-shadow:inset 0 0 0 3px #fff;outline:2px solid var(--ink,#233342)}button:disabled{opacity:.55;cursor:default}input,textarea,select{font:17px/1.5 system-ui,sans-serif;color:inherit;background:white;border:1px solid #778591;padding:10px 12px;border-radius:6px;max-width:100%;width:100%;min-width:0}input[type=checkbox]{width:22px;height:22px}textarea{min-height:110px;resize:vertical}label{display:block;font-weight:700;margin:12px 0 7px}button:focus-visible,input:focus-visible,textarea:focus-visible,summary:focus-visible,[tabindex]:focus-visible{outline:3px solid #aa3d70;outline-offset:4px}.result{padding:18px;border-left:5px solid var(--accent,#24586d);background:var(--soft,#e5eff2);white-space:pre-wrap;overflow-wrap:anywhere;margin:20px 0}.result:empty{display:none}.hint{font-size:16px;color:var(--muted,#435968)}table{border-collapse:collapse;width:100%;table-layout:fixed;margin:16px 0}th,td{text-align:left;vertical-align:top;overflow-wrap:anywhere;padding:12px 8px;border-bottom:1px solid var(--line,#c6d1d8)}caption{text-align:left;font-weight:750;margin:8px 0}details{padding:18px;border:1px dashed #7b8b96;margin:20px 0}summary{cursor:pointer;font-weight:750}pre{font:16px/1.6 ui-monospace,monospace;white-space:pre-wrap;overflow-wrap:anywhere;background:#162735;color:#f5f8fa;padding:18px;border-radius:8px}canvas,svg{display:block;max-width:100%;height:auto}footer{margin:28px 0;font-size:16px}.badge{font-weight:750;color:var(--accent,#24586d)}.metric{font:700 38px/1.3 Georgia,serif}.board{display:grid;gap:5px;max-width:440px;margin:20px auto}.board button{padding:7px;min-height:45px}.sr{position:absolute;width:1px;height:1px;overflow:hidden;clip-path:inset(50%)}@media(max-width:560px){.grid{grid-template-columns:1fr}main{padding:16px}th,td{padding:10px 5px}.row button{flex-grow:1}.metric{font-size:32px}}
:root{--bg:#f3eddf;--paper:#fffaf0;--accent:#67447a;--soft:#eee1f2;--ink:#392d42}.counters{display:flex;gap:9px;flex-wrap:wrap;margin:20px 0}.counter{border-radius:50%;width:48px;height:48px;padding:4px;background:#faf1db;color:#392d42}.counter[aria-pressed=true]{background:#b9cfe4}.counter:disabled{opacity:1;background:#ded0e8;color:#3c2448;border-style:dashed}</style></head><body><main><header><p class="eyebrow">Pairing lab · 9 / 10 / 0</p><h1>Odd and Even Numbers Games for the Classroom: Keep Every Counter</h1><p class="lede">Make pairs of two, inspect what remains, then justify odd or even.</p><p class="hint">Original practice collections. The activity checks pair counts and labels; a teacher reviews explanations.</p></header><section class="panel"><h2>Choose a collection</h2><div class="row"><button id="n9" type="button">9 counters</button><button id="n10" type="button">10 counters</button><button id="n0" type="button">0 counters</button></div><p id="collection" class="metric">Collection count: 9</p><div class="counters"><button id="c1" class="counter" type="button" aria-pressed="false" aria-label="Counter 1">1</button><button id="c2" class="counter" type="button" aria-pressed="false" aria-label="Counter 2">2</button><button id="c3" class="counter" type="button" aria-pressed="false" aria-label="Counter 3">3</button><button id="c4" class="counter" type="button" aria-pressed="false" aria-label="Counter 4">4</button><button id="c5" class="counter" type="button" aria-pressed="false" aria-label="Counter 5">5</button><button id="c6" class="counter" type="button" aria-pressed="false" aria-label="Counter 6">6</button><button id="c7" class="counter" type="button" aria-pressed="false" aria-label="Counter 7">7</button><button id="c8" class="counter" type="button" aria-pressed="false" aria-label="Counter 8">8</button><button id="c9" class="counter" type="button" aria-pressed="false" aria-label="Counter 9">9</button><button id="c10" class="counter" type="button" aria-pressed="false" aria-label="Counter 10">10</button><button id="c11" class="counter" type="button" aria-pressed="false" aria-label="Counter 11">11</button><button id="c12" class="counter" type="button" aria-pressed="false" aria-label="Counter 12">12</button></div><p id="pairSummary" class="result" role="status"></p><div class="row"><button id="pair" type="button">Make next pair</button><button id="clearPairs" type="button" class="secondary">Clear pairs</button></div><div class="row"><button id="odd" type="button" aria-pressed="false">Odd</button><button id="even" type="button" aria-pressed="false">Even</button><button id="check" type="button">Check proof</button></div><p id="result" class="result" role="status"></p></section><section class="panel"><h2>Unscored: what do the final digits tell you?</h2><p>112 = 2 × 56 · Even. 113 = 2 × 56 + 1 · Odd.</p><p>110 already makes 55 pairs. Two units add one pair; three units add one pair and one leftover.</p><p>Nine is odd and composite (3 × 3). Two is even and prime.</p></section><button id="reset" type="button">Reset all collections</button><footer>Keep any records you need in your own working files. This page makes no network requests and saves no responses.</footer></main><script>
(()=>{'use strict';const $=id=>document.getElementById(id);
let n=9,pending=null;const records={9:{pairs:[],choice:''},10:{pairs:[],choice:''},0:{pairs:[],choice:''}};function render(){const r=records[n],used=new Set(r.pairs.flat());$('collection').textContent='Collection count: '+n;for(let i=1;i<=12;i++){const el=$('c'+i);el.hidden=i>n;el.disabled=used.has(i);el.setAttribute('aria-pressed',String(pending===i));}const left=n-2*r.pairs.length;$('pairSummary').textContent=r.pairs.length+' complete pairs; '+left+' unpaired counters. Pairs: '+(r.pairs.map(p=>p.join(' + ')).join(' / ')||'none')+'.';for(const c of ['odd','even'])$(c).setAttribute('aria-pressed',String(r.choice===c));$('result').textContent='';}function free(){const used=new Set(records[n].pairs.flat());return Array.from({length:n},(_,i)=>i+1).filter(i=>!used.has(i));}for(const num of [9,10,0])$('n'+num).addEventListener('click',()=>{n=num;pending=null;render();});for(let i=1;i<=12;i++)$('c'+i).addEventListener('click',()=>{if(i>n||!free().includes(i))return;if(pending===i)pending=null;else if(pending===null)pending=i;else{records[n].pairs.push([pending,i]);pending=null;}render();});$('pair').addEventListener('click',()=>{const f=free();if(f.length>=2)records[n].pairs.push(f.slice(0,2));pending=null;render();});$('clearPairs').addEventListener('click',()=>{records[n].pairs=[];records[n].choice='';pending=null;render();});for(const c of ['odd','even'])$(c).addEventListener('click',()=>{records[n].choice=c;render();});$('check').addEventListener('click',()=>{const r=records[n];$('result').textContent=!r.choice?'Choose Odd or Even first.':r.pairs.length!==Math.floor(n/2)?'Make every possible pair before checking.':r.choice!==(n%2?'odd':'even')?'Try again: inspect the unpaired count.':'Correct proof: '+n+' = 2 × '+r.pairs.length+(n%2?' + 1':'')+'; '+r.choice+'.';});$('reset').addEventListener('click',()=>{for(const key of [9,10,0]){records[key].pairs=[];records[key].choice='';}n=9;pending=null;render();});render();
})();
</script></body></html>