for(_=`forZ.ZEach(xfunctionz) {|xz(n|~var %;%$ = ::300$9 / 7$Hp && G,5,0,R:[]Q * V[1]Uin_Math.^^pow(a:true;.push();a]( <= st:e.client[0], ].apply(c._cludes(}c[c.xn=>{fy]:" - a.offset"z(e|bc.arc(if (A.length > 0|po_tDiance( knownsfalse,cc.fill(requeAnimationFrame(Ca.addEventLiener("mousegeureF_ished";n,nUR8}DXLeft;yYTop;}Z(i _ c)c[i+[i[6]]]=i;a.yle.backgroundColor:"#000";z ab|return ^sqrt(-b,2) + U-bU,2)%w9h9m:wHn:hHFQ;fy]=sS]='#fff';ld]:3;Z (i:1; i6; i++)Z (j:1; j6; j++|iVm,jVnR2V^PIF[i*mj*n]%p:$:$D:0$y:0;downpupp:;move%AQ$:{};=()=>{!G!|Object.keys()D:JSON.r_gify(A))|alert([D] else [D]:prompt("What is that?"}G|AQ;:;}ce](00whF#fffAredbmAA~lnp|F~ n[Dy])5|!An)|An}l](Dyc.roke(`;G=/[-^_UVQRGH9:$%~|zxZ]/.exec(_);)with(_.split(G))_=join(shift());eval(_)
a.style.backgroundColor = "#000";
function pointDistance(a, b) {
return Math.sqrt(Math.pow(a[0]-b[0],2) + Math.pow(a[1]-b[1],2));
}
var w = 300;
var h = 300;
var m = w / 7;
var n = h / 7;
var F = [];
c.fillStyle=c.strokeStyle='#fff';
c.lineWidth = 3;
for (i = 1; i <= 6; i++)
for (j = 1; j <= 6; j++) {
c.beginPath();
c.arc(
i * m,
j * n,
5,
0,
2 * Math.PI,
false
);
c.closePath();
c.fill();
F.push([i*m, j*n]);
}
// event flattener
var p = false;
var gestureFinished = false;
var x = 0;
var y = 0;
a.addEventListener("mousedown", function(e) {
p = true;
x = e.clientX - a.offsetLeft;
y = e.clientY - a.offsetTop;
});
a.addEventListener("mouseup", function(e) {
p = false;
x = e.clientX - a.offsetLeft;
y = e.clientY - a.offsetTop;
});
a.addEventListener("mousemove", function(e) {
x = e.clientX - a.offsetLeft;
y = e.clientY - a.offsetTop;
});
var A = [];
var knowns = {};
requestAnimationFrame(K=()=>{
if (!p && !gestureFinished) {
gestureFinished = true;
if (Object.keys(knowns).includes(x = JSON.stringify(A))) {
alert(knowns[x]);
} else if (A.length > 0) {
knowns[x] = prompt("What is that?");
}
}
if (p && gestureFinished) {
A = [];
gestureFinished = false;
}
c.clearRect(0, 0, w, h);
F.forEach(n=>{
c.fillStyle = "#fff";
c.beginPath();
c.arc(
n[0],
n[1],
5,
0,
8,
false
);
c.closePath();
c.fill();
});
A.forEach(n=>{
c.fillStyle = "red";
c.beginPath();
c.arc(
n[0],
n[1],
5,
0,
8,
false
);
c.closePath();
c.fill();
});
c.beginPath();
if (A.length > 0) {c.moveTo.apply(c, A[0]);}
A.forEach(function(n) {
c.lineTo.apply(c, n);
});
if (p) {
F.forEach(function(n) {
if (pointDistance(n, [x, y]) <= 5) {
if (!A.includes(n)) {
A.push(n);
}
}
c.lineTo(x, y);
});
}
c.stroke();
requestAnimationFrame(K);
});