Eliminate the blue pieces by clicking anywhere on the board. 8 : 50 isn't the time - it means you have 8 moves to clear all 50 pieces.
var d=document,e=d.body,f="childNodes",g="className";e.removeChild(e.children[0]);function j(a,b){var c=d.createElement(b);a.appendChild(c);return c}j(e,"style").innerHTML="table{border-spacing:0}div{width:8px;height:8px;border:1px solid #444}div:hover{background:#888}.b div{background:#800}.o div{background:#00C}";var k=j(e,"table"),l=j(e,"h2"),m=50,n=50,p=8,q=0;function r(a,b){for(var c=0;c<a;++c)b(c)}function s(){l.innerHTML=(p==0&&n>0?"LOSE.":p)+" : "+(n==0?"WIN!":n)}function t(a,b){w(a,b,-1,0);w(a,b,1,0);w(a,b,0,-1);w(a,b,0,1)}function w(a,b,c,u){++q;(function v(h,i){if(h<0||h>=m||i<0||i>=m){if(--q==0){--p;s()}}else{var o=k[f][i][f][h];if(o[g]=="o"){o[g]="";--n;s();--q;t(h,i,c,u)}else{o[g]="b";setTimeout(function(){o[g]="";c!=0?v(h+c,i):v(h,i+u)},25)}}})(a,b)}r(m,function(a){var b=j(k,"tr");r(m,function(c){j(j(b,"td"),"div").onclick=function(){p>0&&n>0&&q==0&&t(c,a)}})});r(n,function(){for(;;){var a=k[f][Math.floor(Math.random()*m)][f][Math.floor(Math.random()*m)];if(a[g]!="o"){a[g]="o";break}}});s()
dmFyIGQ9ZG9jdW1lbnQsZT1kLmJvZHksZj0iY2hpbGROb2RlcyIsZz0iY2xhc3NOYW1lIjtlLnJlbW92ZUNoaWxkKGUuY2hpbGRyZW5bMF0pO2Z1bmN0aW9uIGooYSxiKXt2YXIgYz1kLmNyZWF0ZUVsZW1lbnQoYik7YS5hcHBlbmRDaGlsZChjKTtyZXR1cm4gY31qKGUsInN0eWxlIikuaW5uZXJIVE1MPSJ0YWJsZXtib3JkZXItc3BhY2luZzowfWRpdnt3aWR0aDo4cHg7aGVpZ2h0OjhweDtib3JkZXI6MXB4IHNvbGlkICM0NDR9ZGl2OmhvdmVye2JhY2tncm91bmQ6Izg4OH0uYiBkaXZ7YmFja2dyb3VuZDojODAwfS5vIGRpdntiYWNrZ3JvdW5kOiMwMEN9Ijt2YXIgaz1qKGUsInRhYmxlIiksbD1qKGUsImgyIiksbT01MCxuPTUwLHA9OCxxPTA7ZnVuY3Rpb24gcihhLGIpe2Zvcih2YXIgYz0wO2M8YTsrK2MpYihjKX1mdW5jdGlvbiBzKCl7bC5pbm5lckhUTUw9KHA9PTAmJm4+MD8iTE9TRS4iOnApKyIgOiAiKyhuPT0wPyJXSU4hIjpuKX1mdW5jdGlvbiB0KGEsYil7dyhhLGIsLTEsMCk7dyhhLGIsMSwwKTt3KGEsYiwwLC0xKTt3KGEsYiwwLDEpfWZ1bmN0aW9uIHcoYSxiLGMsdSl7KytxOyhmdW5jdGlvbiB2KGgsaSl7aWYoaDwwfHxoPj1tfHxpPDB8fGk+PW0pe2lmKC0tcT09MCl7LS1wO3MoKX19ZWxzZXt2YXIgbz1rW2ZdW2ldW2ZdW2hdO2lmKG9bZ109PSJvIil7b1tnXT0iIjstLW47cygpOy0tcTt0KGgsaSxjLHUpfWVsc2V7b1tnXT0iYiI7c2V0VGltZW91dChmdW5jdGlvbigpe29bZ109IiI7YyE9MD92KGgrYyxpKTp2KGgsaSt1KX0sMjUpfX19KShhLGIpfXIobSxmdW5jdGlvbihhKXt2YXIgYj1qKGssInRyIik7cihtLGZ1bmN0aW9uKGMpe2ooaihiLCJ0ZCIpLCJkaXYiKS5vbmNsaWNrPWZ1bmN0aW9uKCl7cD4wJiZuPjAmJnE9PTAmJnQoYyxhKX19KX0pO3IobixmdW5jdGlvbigpe2Zvcig7Oyl7dmFyIGE9a1tmXVtNYXRoLmZsb29yKE1hdGgucmFuZG9tKCkqbSldW2ZdW01hdGguZmxvb3IoTWF0aC5yYW5kb20oKSptKV07aWYoYVtnXSE9Im8iKXthW2ddPSJvIjticmVha319fSk7cygp
var doc = document, body = doc.body, childNodes = 'childNodes', className = 'className';
body.removeChild(body.children[0]);
function appendTo(parent, tagName) {
var child = doc.createElement(tagName);
parent.appendChild(child);
return child;
}
appendTo(body, 'style').innerHTML = 'table{border-spacing:0}div{width:8px;height:8px;border:1px solid #444}div:hover{background:#888}.b div{background:#800}.o div{background:#00C}';
var board = appendTo(body, 'table');
var counter = appendTo(body, 'h2');
var size = 50, pieces = 50, moves = 8, bullets = 0;
function random() {
return Math.floor(Math.random() * size);
}
function range(n, iterator) {
for (var i = 0; i < n; ++i) iterator(i);
}
function updateStatus() {
counter.innerHTML = (moves == 0 && pieces > 0 ? 'LOSE.' : moves) + ' : ' + (pieces == 0 ? 'WIN!' : pieces);
}
function fireBullets(x, y, dx, dy) {
fireBullet(x, y, -1, 0);
fireBullet(x, y, 1, 0);
fireBullet(x, y, 0, -1);
fireBullet(x, y, 0, 1);
}
function fireBullet(x, y, dx, dy) {
++bullets;
(function moveBullet(x, y) {
if (x < 0 || x >= size || y < 0 || y >= size) {
if (--bullets == 0) {
--moves; updateStatus();
}
} else {
var cell = board[childNodes][y][childNodes][x];
if (cell[className] == 'o') {
cell[className] = '';
--pieces; updateStatus();
--bullets;
fireBullets(x, y, dx, dy);
} else {
cell[className] = 'b';
setTimeout(function () {
cell[className] = '';
if (dx != 0) moveBullet(x + dx, y);
else moveBullet(x, y + dy);
}, 25);
}
}
}(x, y));
}
range(size, function (y) {
var row = appendTo(board, 'tr');
range(size, function (x) {
appendTo(appendTo(row, 'td'), 'div').onclick = function () {
if (moves > 0 && pieces > 0 && bullets == 0) fireBullets(x, y);
};
});
});
range(pieces, function () {
for (;;) {
var cell = board[childNodes][random()][childNodes][random()];
if (cell[className] != 'o') {
cell[className] = 'o';
break;
}
}
});
updateStatus();