Skill: limits
Limit Rush
90 seconds, 3 lives: evaluate limits by every method before the clock runs out.
1 Limit Rush
90 seconds, 3 lives: evaluate limits by every method before the clock runs out.
2 Keep going
Review the lesson, drill more problems, or print a worksheet.
/* ===== game glue: sprint loop (DOM) ===== */ (function(){ 'use strict'; var G=window.__FIBO_API__; var rand=f32((Date.now()%2000000000)+13); var score=0, streak=0, lives=3, timeLeft=90, timer=null, locked=false, current=null, answered=0; function el(id){ return document.getElementById(id); } function hud(){ el('gScore').textContent=score; el('gStreak').textContent=streak; el('gLives').textContent=lives; el('gTime').textContent=timeLeft; } function fb(kind,html){ var f=el('gFb'); f.className='fb show '+kind; f.innerHTML=html; } function clearFb(){ var f=el('gFb'); f.className='fb'; f.innerHTML=''; } function newQ(){ current=G.makeQuestion(rand); answered++; locked=false; el('gTag').textContent='Question '+answered; el('gPrompt').innerHTML=current.promptHTML; var box=el('gOpts'); box.innerHTML=''; clearFb(); current.options.forEach(function(opt,i){ var b=document.createElement('button'); b.type='button'; b.className='opt'; b.innerHTML=opt; b.addEventListener('click',function(){ pick(i,b); }); box.appendChild(b); }); } function pick(i,btn){ if(locked){ return; } locked=true; var btns=el('gOpts').children; if(i===current.correct){ btn.classList.add('right'); streak++; var pts=100+(streak>=3?25:0); score+=pts; fb('ok','Correct! +'+pts+' points. '+current.explainHTML); } else { btn.classList.add('wrong'); btns[current.correct].classList.add('right'); streak=0; lives--; fb('no','Not quite. '+current.explainHTML); } hud(); if(lives<=0){ endGame('Out of lives'); return; } setTimeout(newQ,1400); } function endGame(reason){ if(timer){ clearInterval(timer); timer=null; } el('gOverTitle').textContent=reason; el('gOverText').textContent='You answered '+answered+' questions.'; el('gOverScore').textContent='Final score: '+score; el('gOver').classList.add('show'); } function reset(){ score=0; streak=0; lives=3; timeLeft=90; answered=0; el('gOver').classList.remove('show'); hud(); newQ(); if(timer){ clearInterval(timer); } timer=setInterval(function(){ timeLeft--; if(timeLeft<=0){ timeLeft=0; hud(); endGame('Time is up'); return; } hud(); },1000); } el('gRestart').addEventListener('click',reset); hud(); newQ(); timer=setInterval(function(){ timeLeft--; if(timeLeft<=0){ timeLeft=0; hud(); endGame('Time is up'); return; } hud(); },1000); })();