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"; } // Hint tag //document.getElementById("myBtn").onclick = function() {myFunction()}; /* myFunction toggles between adding and removing the show class, which is used to hide and show the dropdown content */ function myFunction() { document.getElementById("myDropdown").classList.toggle("show"); } function reset() { //document.getElementById("myreset").reset(); getRandomPara(); redraw(ctx); return; //============ Movable.list=new Array(); var k=1; for (i=1;i<7;i++){ /*if (i==1) id1="Carpenter"; if (i==2) id1="Potter"; if (i==3) id1="Baker"; if (i==4) id1="Carpenter"; if (i==5) id1="Potter"; if (i==6) id1="Baker";*/ if (i<4)Movable.add(new MyCircle((i)*50+400,375-i*50,20,i)); if (i>3&& i<6)Movable.add(new MyCircle((i-2)*50+400,375+50*(i-4),20,i)); if (i==6) Movable.add(new MyCircle((i-3)*50+400,375-50*(i-5),20,i)); } //=========================== } 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(); } } var c_i=0; class MyCircle extends Movable { constructor (xx,y,r,id){ super (xx,y); this.r=r; //this.h=h; //this.id=id; 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="red"; //ctx.fillStyle="white"; ctx.beginPath(); //ctx.fillStyle="white"; if (this.fixed==true) ctx.fillStyle="black"; ctx.font="10px Arial"; ctx.textAlign = "center"; ctx.arc(this.x0, this.y0, this.r,0,2*Math.PI); //ctx.fillStyle="white"; ctx.fillStyle="white"; ctx.fill(); //ctx.fillText(""+this.x0+" "+this.y0,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(); ctx.fillStyle="black"; //ctx.fillText(""+this.id,this.x0, this.y0); } } 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) { //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); } getRandomPara(); redraw(ctx); showOrHide('foot',lang); showOrHide('title1',lang); showOrHide('title2',lang); showOrHide('title3',lang); setHTML('myBtn',word('Hint')); setHTML('myreset',word('Reset')); ) processed by MyLexV4 -->
    end of file