00:00:00
Click the start count to record the time you spend to solve the problem.
Click the stop count to pause the timer and resume the time by click the start count.
Click the reset count and the start count to reset the timer.

  • //var n=1; //initial settings var min1=1; var max1=1; var min2=12; var max2=50; var GONews; var grid; //counter var h=0; var m=0; var s=0; var c = 0; var t; var timer_is_on = 0; function timedCount() { s=s+1; if (s==60){ m=m+1; s=0; } if(m==60){ h=h+1; m=0; } document.getElementById("txt").innerHTML = h + ":" + m + ":" + s; if (h<10){ document.getElementById("txt").innerHTML = "0"+h + ":" + m + ":" + s; if (s<10&&m<10)document.getElementById("txt").innerHTML = "0"+h + ":0" + m + ":0" + s; if (s>10&&m<10)document.getElementById("txt").innerHTML = "0"+h + ":0" + m + ":" + s; if (s<10&&m>10)document.getElementById("txt").innerHTML = "0"+h + ":" + m + ":0" + s; }else if(m<10){ document.getElementById("txt").innerHTML = h + ":0" + m + ":" + s; if (s<10)document.getElementById("txt").innerHTML = h + ":0" + m + ":0" + s; } //c = c + 1; t = setTimeout(timedCount, 1000); } function startCount() { if (!timer_is_on) { timer_is_on = 1; timedCount(); } } function stopCount() { clearTimeout(t); timer_is_on = 0; } function resetCount() { clearTimeout(t); timer_is_on = 0; s=0; m=0; h=0; document.getElementById("txt").innerHTML = "00:00:00"; } function showHint() { if (hButton.sel===0) return; var str; if (lang==0){ str="Try to figure out the one's digit of the number in the red circles first."; }else{ str="想想看红色圆圈中的三位数的个位应该是什么."; } hButton.hText.text=str; hButton.hText.draw(ctx); } function setHTML(id,text){ var e=document.getElementById(id); if (e==null) return; e.innerHTML=text; } function gravity (x){ x=Math.floor(x/50)*50; return x+25; } class Movable { static DOWN=1; static UP=2; static mouse=2; static x1=0; static y1=0; static ctx; static list=new Array(); static list1=new Array(); static list2=new Array(); static selected=null; constructor(x,y){ this.x0=x; this.y0=y; this.fixed=false; } inside(x,y){ return true; } draw (ctx1){ ; } move (e){ if (this.fixed==true) return; var dx=e.offsetX-Movable.x1; var dy=e.offsetY-Movable.y1; this.x0+=dx; this.y0+=dy; Movable.x1=e.offsetX; Movable.y1=e.offsetY; this.draw(Movable.ctx); } fixPosition(x,y){ this.x0=x; this.y0=y; this.fixed=true; } static mouseUp() { Movable.mouse=Movable.UP; /*if (Movable.selected!=null){ Movable.selected.x0=gravity(Movable.selected.x0)+25; Movable.selected.y0=gravity(Movable.selected.y0)+25; }*/ } static mouseDown(e) { Movable.mouse=Movable.DOWN; Movable.x1=e.offsetX; Movable.y1=e.offsetY; } static isMouseDown() { if (Movable.mouse==Movable.DOWN) return true; return false; } static isInside (e){ for (var i=0;i=0 && x<=this.w && y>=0 &&y<=this.h) return true; return false; } draw (ctx){ /*ctx.fillStyle="blue"; ctx.fillRect(this.x0, this.y0, this.w, this.h); ;*/ ctx.strokeStyle=this.color; ctx.beginPath(); ctx.rect(this.x0, this.y0, this.w,this.h); ctx.stroke(); } } class MyCircle extends Movable { constructor (xx,y,r,id){ super (xx,y); this.r=r; //this.h=h; this.id=id; } setlocation (x,y){ this.x0=x; this.y0=y; } inside(x,y){ if(this.fixed==true) return false; x-=this.x0; y-=this.y0; var r=this.r; if((x*x+y*y)<(r*r)) return true; return false; } /*move (e){ var x=Math.floor(e.offsetX/50)*50; var y=Math.floor(e.offsetY/50)*50; //var dx=e.offsetX-Movable.x1; //var dy=e.offsetY-Movable.y1; super.move(e); var dx=x-Movable.x1; var dy=y-Movable.y1; this.x0+=dx; this.y0+=dy; Movable.x1=e.offsetX; Movable.y1=e.offsetY; this.draw(Movable.ctx); var newx0=this.x0-300; var newy0=this.y0-200; var angleP=Math.atan2(newy0,newx0); this.x0=300+75*Math.cos(angleP); this.y0=200+75*Math.sin(angleP); }*/ draw (ctx){ ctx.strokeStyle="brown"; ctx.beginPath(); ctx.fillStyle="green"; if (this.fixed==true) ctx.fillStyle="black"; ctx.font="20px Arial"; ctx.textAlign = "center"; ctx.fillText(""+this.id,this.x0, this.y0+0); //if (Math.abs(this.x0-200)<=50 &&Math.abs(this.y0-300)<=50) ctx.fillText(""+this.id,this.x0+300, this.y0+17); //if (Math.abs(this.x0-300)<=50 &&Math.abs(this.y0-300)<=50) ctx.fillText(""+this.id,this.x0+300, this.y0+17); //if (Math.abs(this.x0-400)<=50 &&Math.abs(this.y0-300)<=50) ctx.fillText(""+this.id,this.x0+300, this.y0+17); ctx.stroke(); } } class MyContainer { constructor (x,y,r,type, color){ //constructor (x,y,w, h,color){ this.x0=x; this.y0=y; this.r=r; this.type=type; this.color=color; } inside(x,y){ x-=this.x0; y-=this.y0; var r=this.r; if((x*x+y*y)<(r*r)) return true; return false; } draw (ctx){ ctx.strokeStyle=this.color; ctx.beginPath(); ctx.arc(this.x0, this.y0, this.r,0,2*Math.PI); ctx.stroke(); } isOK(n){ if (this.inside(n.x0,n.y0)==false) return 0; var re=0; switch (this.type) { case 1: if (n.id%2==1) re= 1; break; case 2: if (n.id%2==0) re= 1; break; case 3: if (n.id%3==0) re= 1; break; } } } function doMouseDown(event) { //alert("mouse is down"); //var m=document.getElementById("mouseInfo"); //m.innerHTML="mouse is down"; Movable.mouseDown(event); Movable.isInside(event); } function doMouseUp(event) { if (hButton.inside(event.offsetX, event.offsetY)===true) redraw(ctx); //alert("mouse is up"); //var m=document.getElementById("mouseInfo"); //m.innerHTML="mouse is up"; Movable.mouseUp(); //Movable.positionOK(); var inGrid=0; for (var i=0;i3) { // ?p=min1,max1,min2,max2 var s=paraStr.substring(3).split(/[=,]+/); // alert(paraStr+" s[0]="+s[0]+" s["+(s.length-1)+"]="+s[s.length-1]); if (s.length==2) { //N=parseInt(s[0]); //min1=parseInt(s[0]); //max1=parseInt(s[1]); //min2=parseInt(s[2]); //max2=parseInt(s[3]); } // alert("min1="+min1+" "+max1+" "+min2+" "+max2); } //var n=getRndInteger(min1,max1); //var randomNum=getRndInteger(min2,max2); /*var Container1=new MyContainer(400,200,30,1,"blue"); var Container2=new MyContainer(470,200,30,2,"red"); var Container3=new MyContainer(400,300,30,3,"green"); var Container4=new MyContainer(470,300,30,4,"purple");*/ var containerlist=new Array(); var Container1=new MyContainer (150,300,20,1,"blue"); //ctx.fillText("+",250, 300); var Container2=new MyContainer (200,300,20,2,"blue"); var Container3=new MyContainer (300,300,20,3,"blue"); var Container4=new MyContainer (400,300,20,4,"red"); var Container5=new MyContainer (450,300,20,5,"red"); var Container6=new MyContainer (500,300,20,6,"red"); var Container7=new MyContainer (600,300,20,7,"green"); var Container8=new MyContainer (650,300,20,8,"green"); var Container9=new MyContainer (750,300,20,9,"green"); containerlist.push(Container1); containerlist.push(Container2); containerlist.push(Container3); containerlist.push(Container4); containerlist.push(Container5); containerlist.push(Container6); containerlist.push(Container7); containerlist.push(Container8); containerlist.push(Container9); var hButton = new ToggleButton((canvas.width>>1)-100,canvas.height-30,200,30,"Show Hint", "Hide Hint",ctx,"green"); hButton.visible=true; hButton.hText=new MyTextArea(500,170,400,"this is the hint","20px Arial","blue"); getRandomPara(); redraw(ctx); showOrHide('foot',lang); showOrHide('title1',lang); showOrHide('title2',lang); showOrHide('title3',lang); setHTML('myBtn',word('Hint')); ) processed by MyLexV4 -->
    end of file