(window.onload = function() {var mouseX;var mouseY;var x=new Array(320,260,200,140, 80,128,176,224,272,320,320,320);var y=new Array(260,260,260,260,260,224,188,152,116, 80,140,200);var a=new Array(12);var b=new Array(12);for (var i=0; i!=13; i++) b[i]=new Array(2,0,0,0,0,0,0,0,0,0,0,0,0);b[0][0]=1;b[4][0]=0; b[4][2]=1;b[9][0]=0; b[9][1]=1;var c=new Array(Math.PI/2.0,Math.acos(3.0/5.0),Math.acos(4.0/5.0),Math.acos(1.0/Math.sqrt(5.0)),Math.acos(2.0/Math.sqrt(5.0)),Math.acos(1.0/Math.sqrt(10.0)),Math.acos(3.0/Math.sqrt(10.0)),Math.acos(2.0/Math.sqrt(13.0)),Math.acos(3.0/Math.sqrt(13.0)),Math.acos(1.0/Math.sqrt(17.0)),Math.acos(4.0/Math.sqrt(17.0)),Math.acos(1.0/Math.sqrt(26.0)),Math.acos(5.0/Math.sqrt(26.0)));var s=new Array(0,-1,-1,-1,-1);var t=-1;var d=-1;var u=-1;var wx=0,wy=0; function draw() { var canvas = document.getElementById('cvs'); if ( ! canvas || ! canvas.getContext ) return false; var ctx = canvas.getContext('2d'); ctx.beginPath(); ctx.clearRect(0,0,400,400); ctx.closePath(); ctx.lineWidth = 3.5; ctx.lineJoin = 'round'; ctx.beginPath(); ctx.moveTo(x[0]+wx,y[0]+wy); for (var i=1; i!=12; i++) { ctx.lineTo(x[i]+wx,y[i]+wy); } ctx.closePath(); ctx.stroke(); for (var i=0; i!=12; i++) { ctx.beginPath(); ctx.arc(x[i]+wx,y[i]+wy,7,0,2*Math.PI,false); ctx.closePath(); ctx.fill(); } if ( t!=-1 ) { ctx.beginPath(); ctx.arc(x[t]+wx,y[t]+wy,10,0,2*Math.PI,false); ctx.closePath(); ctx.fill(); } for (var i=0; i!=s[0]; i++) { ctx.beginPath(); ctx.arc(x[s[i+1]]+wx,y[s[i+1]]+wy,10,0,2*Math.PI,false); ctx.closePath(); ctx.stroke(); } if (s[0]==3) { ctx.beginPath(); ctx.arc(x[s[1]]+wx,y[s[1]]+wy,60*Math.abs(s[3]-s[1]),0,2*Math.PI,false); ctx.closePath(); ctx.stroke(); ctx.beginPath(); ctx.arc(x[s[1]]+wx,y[s[1]]+wy,60*Math.abs(12-s[3]+s[1]),0,2*Math.PI,false); ctx.closePath(); ctx.stroke(); ctx.beginPath(); ctx.arc(x[s[2]]+wx,y[s[2]]+wy,60*Math.abs(s[3]-s[2]),0,2*Math.PI,false); ctx.closePath(); ctx.stroke(); ctx.beginPath(); ctx.arc(x[s[2]]+wx,y[s[2]]+wy,60*Math.abs(12-s[3]+s[2]),0,2*Math.PI,false); ctx.closePath(); ctx.stroke(); } function optimize(i) { for (var j=1; j!=13; j+=2) { if ( Math.max(0,b[i][j])==0 ) { b[i][0]+=b[i][j]; b[i][j+1]-=b[i][j]; b[i][j]=0; } } for (var j=2; j!=14; j+=2) { if ( Math.max(0,b[i][j])==0 ) { b[i][0]+=b[i][j]; b[i][j-1]-=b[i][j]; b[i][j]=0; } } for (var j=3; j!=13; j+=2) { var m=Math.min(b[i][j],b[i][j+1]); b[i][0]+=m; b[i][j]-=m; b[i][j+1]-=m; } if ( Math.min(2,b[i][4])==2 ) { b[i][4]-=2; b[i][1]++; } if ( Math.min(2,b[i][6])==2 ) { b[i][6]-=2; b[i][2]++; } var m=Math.min(b[i][1],b[i][2]); b[i][0]+=m; b[i][1]-=m; b[i][2]-=m; b[i][0]%=4; } function angle() { for (var i=0; i!=12; i++) { a[i]=0; for (var j=0; j!=13; j++) { a[i]+=b[i][j]*c[j]; } } } function near() { var l=100.0; var m; var n=-1; for (var i=0; i!=12; i++) { m=(mouseX-x[i])*(mouseX-x[i])+(mouseY-y[i])*(mouseY-y[i]); if ( Math.min(l,m)==m ) { l=m; n=i; } } return n; } function pythagoras(m,n) { return Math.sqrt((x[m]-x[n])*(x[m]-x[n])+(y[m]-y[n])*(y[m]-y[n])); } function heron(m,n,o) { var p=pythagoras(m,n)/60.0; var q,r,ss; if ((Math.max(m,o,n)==m)*(Math.min(m,o,n)==n)) { q=m-o; r=o-n; } else if ((Math.max(n,o,m)==n)*(Math.min(n,o,m)==m)) { q=n-o; r=o-m; } else if ((Math.max(o,m,n)==o)*(Math.min(o,m,n)==n)) { q=o-m; r=12-o+n; } else if ((Math.max(o,n,m)==o)*(Math.min(o,n,m)==m)) { q=o-n; r=12-o+m; } else if ((Math.max(m,n,o)==m)*(Math.min(m,n,o)==o)) { q=n-o; r=12+o-m; } else if ((Math.max(n,m,o)==n)*(Math.min(n,m,o)==o)) { q=m-o; r=12+o-n; } var ss=(p+q+r)/2.0; return Math.floor(2000000000.0*Math.sqrt(ss*(ss-p)*(ss-q)*(ss-r))+0.5)/2000000000.0; } canvas.onmousedown = mouseDownListner; function mouseDownListner(e) { adjustXY(e); d=near(); } canvas.onmouseup = mouseUpListner; function mouseUpListner(e) { adjustXY(e); u=near(); if ((d!=-1)*(d==u)) { s[s[0]+1]=d; s[0]++; s[0]%=4; } } canvas.onmousemove = mouseMoveListner; function mouseMoveListner(e) { adjustXY(e); t=near(); draw(); ctx.font = '20pt Gothic'; ctx.fillText(mouseX,10,20); ctx.fillText(mouseY,10,40); angle(); ctx.fillText(a[t],10,60); switch (s[0]) { case 2: ctx.fillText(Math.floor(1000000000.0*pythagoras(s[1],s[2])/6.0)/10000000000.0,10,80); break; case 3: ctx.fillText(heron(s[1],s[2],s[3]),10,80); break; } } function adjustXY(e) { var rect = e.target.getBoundingClientRect(); mouseX = e.clientX - rect.left; mouseY = e.clientY - rect.top; } } draw();})();
1手で図形をつくれ
1手で面積200の図形をつくれ
1手で面積300の図形をつくれ
1手で面積400の図形をつくれ
1手で面積500の図形をつくれ
1手で面積800の図形をつくれ
1手で面積900の図形をつくれ
3種類の長方形をつくれ 0/3
1手で面積900の正方形をつくれ
1手で面積800の長方形をつくれ
3手で面積500の長方形をつくれ
3種類の凧形をつくれ 0/3
1手で面積800の凧形をつくれ
1手で面積400の凧形をつくれ
3手で面積500の凧形をつくれ
2種類の平行四辺形をつくれ 0/2
1手で面積300の平行四辺形をつくれ
1手で面積400の平行四辺形をつくれ
2種類の菱形をつくれ 0/2
1手で面積540の菱形をつくれ
1手で面積720の菱形をつくれ
その他 1手で面積120の図形をつくれ
1手で面積440の図形をつくれ
1手で面積520の図形をつくれ
2手で面積360の図形をつくれ
2手で面積480の図形をつくれ
2手で面積640の図形をつくれ
1手で図形をつくれ
1手で面積200の図形をつくれ
1手で面積300の図形をつくれ
1手で面積400の図形をつくれ
1手で面積500の図形をつくれ
1手で面積800の図形をつくれ
1手で面積900の図形をつくれ
3種類の長方形をつくれ 0/3
1手で面積900の正方形をつくれ
1手で面積800の長方形をつくれ
3手で面積500の長方形をつくれ
3種類の凧形をつくれ 0/3
1手で面積800の凧形をつくれ
1手で面積400の凧形をつくれ
3手で面積500の凧形をつくれ
2種類の平行四辺形をつくれ 0/2
1手で面積300の平行四辺形をつくれ
1手で面積400の平行四辺形をつくれ
2種類の菱形をつくれ 0/2
1手で面積540の菱形をつくれ
1手で面積720の菱形をつくれ
その他 1手で面積120の図形をつくれ
1手で面積440の図形をつくれ
1手で面積520の図形をつくれ
2手で面積360の図形をつくれ
2手で面積480の図形をつくれ
2手で面積640の図形をつくれ