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 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 Movable2 { 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 MyCircle2 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; } draw (ctx){ ctx.strokeStyle="brown"; ctx.beginPath(); //ctx.lineTo(this.x0+20,this.y0+20); var newx0=this.x0-300; var newy0=this.y0-200; var angleP=Math.atan2(newy0,newx0); var d=Math.sqrt(newx0*newx0+newy0*newy0); var newx=300+(d+this.r)*Math.cos(angleP); var newy=200+(d+this.r)*Math.sin(angleP); var newx1=300+(d-this.r)*Math.cos(angleP); var newy1=200+(d-this.r)*Math.sin(angleP); //this.x0=300+75*Math.cos(angleP); //this.y0=200+75*Math.sin(angleP); //ctx.moveTo(newx1,newy1); //ctx.lineTo(newx,newy); //ctx.arc(this.x0, this.y0, this.r,0,2*Math.PI); 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+7); if (angleP<0)angleP+=Math.PI*2; angleP=angleP*180/Math.PI; angleP=360-angleP; angleP=angleP-90; if (angleP<0)angleP=angleP+360; //if (angleP<0) angleP=-angleP; //ctx.fillText(""+(angleP).toFixed(0),this.x0, this.y0+7); //ctx.moveTo(0, 0); //ctx.lineTo(this.x0, this.y0) ctx.stroke(); } } class MyContainer extends MyRect { constructor (x,y,w,h, color){ super (x,y,w, h); this.id=0; this.color=color; this.visible=true; } /* draw (ctx){ ctx.strokeStyle=this.color; ctx.beginPath(); ctx.arc(this.x0, this.y0, this.r,0,2*Math.PI); ctx.stroke(); } */ distance(rect){ var v=this.x1-rect.x1; var d=v*v; v=this.y1-rect.y1; return Math.sqrt(d+v*v); } 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(/[=,]+/); } var x=200*2, y=200-50,w=50; var cc1=new MyContainer(x+w,y,w,w,"red"); var cc2=new MyContainer(x+w,y+w,w,w,"red"); var cc3=new MyContainer(x+w,y+2*w,w,w,"red"); var cc4=new MyContainer(x+w,y+3*w,w,w,"red"); y+=w; var cc5=new MyContainer(x,y,w,w,"red"); var cc6=new MyContainer(x,y+w,w,w,"red"); x+=w*2; var cc7=new MyContainer(x,y,w,w,"red"); var cc8=new MyContainer(x,y+w,w,w,"red"); Movable.list1.push(cc1); Movable.list1.push(cc2); Movable.list1.push(cc3); Movable.list1.push(cc4); Movable.list1.push(cc5); Movable.list1.push(cc6); Movable.list1.push(cc7); Movable.list1.push(cc8); function showHint() { if (hButton.sel===0) return; var str; if (lang==0){ str="Put the numbers that are furthest apart at the center of the grid and then solve the rest."; }else{ str="先将差值最大的两个数放在中间,其余的就很容易了."; } hButton.hText.text=str; hButton.hText.draw(ctx); } 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(800,200,300,"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