Click anywhere on the screen to start a chain reaction. Pass the level quota, and you advance!
m=Math;R=m.random;P=m.pow;D=c.width=c.height=600;T=D-12;O=256;l=e=E=N=0;setInterval('if(!E&&(e>=N||L&&e<N&&l--))e=L=0,A=[],n=(N=++l*(l+1)/2)+5;a.fillStyle=e<N?"#a41":"#c73";a.fillRect(0,0,D,D);a.strokeText(e+"/"+N,9,9);for(i=n;i--;)with(A[i]||(A[i]={s:L,M:40*R()+20,x:L?L.clientX:R()*T+6,y:L?L.clientY:R()*T+6,v:12*R()-6,z:12*R()-6,C:"rgb("+[R()*O|0,R()*O|0,R()*O|0]+")",r:6,t:30/l|0}))s?t?1<s?t--:++r>M&&(s=2):--r||(A.splice(i,1),n--,E--):(A.some(function(b){return b.s&&P(r+b.r,2)>P(x-b.x,2)+P(y-b.y,2)&&(s=1,E++,e++)}),x+=v*=1-2*(x<r|x+r>D),y+=z*=1-2*(y<r|y+r>D)),a.beginPath(),a.fillStyle=C,a.arc(x,y,r,0,7),a.fill()',50);c.onclick=function(b){L||(L=b,E++,n++)};
bT1NYXRoO1I9bS5yYW5kb207UD1tLnBvdztEPWMud2lkdGg9Yy5oZWlnaHQ9NjAwO1Q9RC0xMjtPPTI1NjtsPWU9RT1OPTA7c2V0SW50ZXJ2YWwoJ2lmKCFFJiYoZT49Tnx8TCYmZTxOJiZsLS0pKWU9TD0wLEE9W10sbj0oTj0rK2wqKGwrMSkvMikrNTthLmZpbGxTdHlsZT1lPE4/IiNhNDEiOiIjYzczIjthLmZpbGxSZWN0KDAsMCxELEQpO2Euc3Ryb2tlVGV4dChlKyIvIitOLDksOSk7Zm9yKGk9bjtpLS07KXdpdGgoQVtpXXx8KEFbaV09e3M6TCxNOjQwKlIoKSsyMCx4Okw/TC5jbGllbnRYOlIoKSpUKzYseTpMP0wuY2xpZW50WTpSKCkqVCs2LHY6MTIqUigpLTYsejoxMipSKCktNixDOiJyZ2IoIitbUigpKk98MCxSKCkqT3wwLFIoKSpPfDBdKyIpIixyOjYsdDozMC9sfDB9KSlzP3Q/MTxzP3QtLTorK3I+TSYmKHM9Mik6LS1yfHwoQS5zcGxpY2UoaSwxKSxuLS0sRS0tKTooQS5zb21lKGZ1bmN0aW9uKGIpe3JldHVybiBiLnMmJlAocitiLnIsMik+UCh4LWIueCwyKStQKHktYi55LDIpJiYocz0xLEUrKyxlKyspfSkseCs9dio9MS0yKih4PHJ8eCtyPkQpLHkrPXoqPTEtMiooeTxyfHkrcj5EKSksYS5iZWdpblBhdGgoKSxhLmZpbGxTdHlsZT1DLGEuYXJjKHgseSxyLDAsNyksYS5maWxsKCknLDUwKTtjLm9uY2xpY2s9ZnVuY3Rpb24oYil7THx8KEw9YixFKyssbisrKX07
//repo: https://github.com/Titani/Chain-Reaction/
//an explanation can be found in game-explained.js
//note the minified size
m = Math, R = m.random, P = m.pow, D = c.width = c.height = 600, T = D - 12, O = 256, l = e = E = N = 0;
setInterval(function() {
if (!E && (e >= N || (L && e < N && l--))) {
e = L = 0;
A = [];
n = (N = ++l * (l + 1) / 2) + 5;
}
a.fillStyle = e < N ? '#a41' : '#c73';
a.fillRect(0, 0, D, D);
a.strokeText(e + '/' + N, 9, 9);
i = n;
while (i--) {
with (A[i] || (A[i] = {
s : L,
M : R() * 40 + 20,
x : L ? L.clientX : R() * T + 6,
y : L ? L.clientY : R() * T + 6,
v : R() * 12 - 6,
z : R() * 12 - 6,
C : 'rgb(' + [R() * O | 0, R() * O | 0, R() * O | 0] + ')',
r : 6,
t : 30 / l | 0
})) {
if (!s) {
A.some(function(o) {
return o.s && P(r + o.r, 2) > P(x - o.x, 2) + P(y - o.y, 2) && (s = 1, E++, e++);
});
x += v *= 1 - 2 * (x < r | x+r > D);
y += z *= 1 - 2 * (y < r | y+r > D);
} else if (!t) {
if (!--r) {
A.splice(i, 1);
n--;
E--;
}
} else if (s > 1) {
t--;
} else {
if (++r > M) {
s = 2;
}
}
a.beginPath();
a.fillStyle = C;
a.arc(x, y, r, 0, 7);
a.fill();
}};
}, 50);
c.onclick = function(e) {
L || (L = e, E++, n++);
};