13,15c13 < var minus3=-3; < var snum = Math.floor(Math.random() * eval(minus3 + ideas.length)) + 0; < minus3=0; --- > var snum = Math.floor(Math.random() * ideas.length) + 0; 18,20d15 < var extrabits = ""; < var pbits="What is this area? Append space to lock in that guess. Can use derivable value via use of operators + - * / and Math.PI ( for a rectangle guess you could go something like 112 * 6 )"; < 29,104d23 < // Thanks to https://stackoverflow.com/questions/11796554/automatically-crop-html5-canvas-to-contents < function autoCropCanvas() { // canvas, ctx) { < var canvas=elem; < var ctx=context; < var bounds = { < left: 0, < right: eval(0 + canvas.width), < top: 0, < bottom: eval(0 + canvas.height) < }; < var rows = []; < var cols = []; < var imageData = ctx.getImageData(0, 0, canvas.width, canvas.height); < for (var x = 0; x < canvas.width; x++) { < cols[x] = cols[x] || false; < for (var y = 0; y < canvas.height; y++) { < rows[y] = rows[y] || false; < const p = y * (canvas.width * 4) + x * 4; < const [r, g, b, a] = [imageData.data[p], imageData.data[p + 1], imageData.data[p + 2], imageData.data[p + 3]]; < var isEmptyPixel = Math.max(r, g, b, a) === 0; < if (!isEmptyPixel) { < cols[x] = true; < rows[y] = true; < } < } < } < for (var i = 0; i < rows.length; i++) { < if (rows[i]) { < bounds.top = i ? i - 1 : i; < break; < } < } < for (var i = rows.length; i--; ) { < if (rows[i]) { < bounds.bottom = i < canvas.height ? i + 1 : i; < break; < } < } < for (var i = 0; i < cols.length; i++) { < if (cols[i]) { < bounds.left = i ? i - 1 : i; < break; < } < } < for (var i = cols.length; i--; ) { < if (cols[i]) { < bounds.right = i < canvas.width ? i + 1 : i; < break; < } < } < //alert(bounds.left); < if (1 == 2) { < var newWidth = bounds.right - bounds.left; < var newHeight = bounds.bottom - bounds.top; < var cut = ctx.getImageData(bounds.left, bounds.top, newWidth, newHeight); < canvas.width = newWidth; < canvas.height = newHeight; < ctx.putImageData(cut, 0, 0); < } else { < canvas.style.marginLeft='-' + bounds.left + 'px'; < //canvas.style.marginTop='-' + bounds.top + 'px'; < } < } < < function athen() { < document.getElementById('submit').click(); < } < < function ansviaprompt(ebits) { < var huhw=prompt(ebits, ''); < if (huhw == null) { huhw=''; } < if (huhw != '') { < document.getElementById('answer').value=eval('' + huhw.trim()); < if (huhw.trim() != huhw) { setTimeout(athen, 2000); } < } < } 133,134c52 < var xdiff = 999.0, areais = 0.0; < extrabits = ""; --- > var xdiff = 999.0, areais = 0.0, extrabits = ""; 191d108 < document.getElementById('answer').value=''; 194d110 < document.getElementById('answer').value=''; 199c115 < snum = Math.floor(Math.random() * eval(minus3 + ideas.length)) + 0; --- > snum = Math.floor(Math.random() * ideas.length) + 0; 220,221d135 < } else { < context.clearRect(0,0,elem.width,elem.height); 242d155 < autoCropCanvas(); 267d179 < autoCropCanvas(); 290d201 < autoCropCanvas(); 314d224 < autoCropCanvas(); 328d237 < autoCropCanvas(); 336d244 < if (rnum < 50) { rnum+=Math.floor(Math.random() * 300) + 50; } 361d268 < autoCropCanvas(); 378d284 < autoCropCanvas(); 387d292 < if (rnum < 50) { rnum+=Math.floor(Math.random() * 300) + 50; } 409d313 < autoCropCanvas(); 424d327 < autoCropCanvas(); 429d331 < if (rnum < 20) { rnum+=Math.floor(Math.random() * 200) + 40; } 434d335 < if (rnum < 10) { rnum+=Math.floor(Math.random() * 100) + 20; } 457d357 < autoCropCanvas(); 484d383 < autoCropCanvas(); 489d387 < if (rnum < 20) { rnum+=Math.floor(Math.random() * 200) + 40; } 511d408 < autoCropCanvas(); 526d422 < autoCropCanvas(); 531d426 < //if (rnum < 20) { rnum+=Math.floor(Math.random() * 200) + 40; } 538d432 < //if (rnum < 20) { rnum+=Math.floor(Math.random() * 200) + 40; } 545d438 < //if (rnum < 20) { rnum+=Math.floor(Math.random() * 200) + 40; } 568,571c461,464 < <

Areas

< < --- > >

Areas

> >
631c524 < of is --- > of is