- Author:
- kadir pekel
- Twitter:
- @
- GitHub:
- Facebook:
- Google+:
- +
- Reddit:
- /r/
- Pouet:
- Website:
- blog.kadirpekel.com
- Compo:
- classic
- Demo link:
- https://js1k.com/2010-first/demo/335
- Shortlink:
- https://js1k.com/335
- Blog post:
- please update here!
- Bytes:
- 937
- Chars:
- 937
- Submission
a="c=docum3.g~EUm3ById('c'Qs=15;r=25;l=s*r;widV=height=l;b=[W7=7oor;m=['tomatoMorangeMoveMsteZblue'Wdocum3.body.s.marginp=KNLr~urn D!A_(8-sT||8T||-Js#)_8#T)||)_8T)6;up=oncck=K(e&q=true,sc=s,w=[WGe&k=7(e.c3X/+7(e.c3Y/;G!p(k))r~urn;Fh=OkWK @LGD_`=hLDA;@-sQ@QGN-Js#)@#QGN)@Z(kQ9i=(s)#;i>i--LG`A&a=i;whiU(-=s]=AQG]L`W]A}Zse{G!Oi])w.pushN%s}9i in w&z=w[iWwhiU(z<sL9jj<s;j++&u=(j)+z;G(uLOu]=OuWOu]A}}z++}}}wiV(g~Context('2d')L4SA;4Rect(0,0,l,lQH{4S=D;beginPf(Qarc%s)*+(),(7N/s)*+(),,0,PI*2,trueQclosePf(Q4(H{G`A)sc--;q=q_!pN6GqLaUrt('Sc: 'cQrs(;rs=K(LH`m[7(random()*m.UngV)Wup(6;rs(Q";for(b in c="r/2+J0((N=0;tyUM','Mf.Oa6}r)*s+1+slic.~et`D=@ZN&LF#-1_&&faV9for(F8(Oi7fl6)}4fill3entZelW];VthUleT]==D)Q);Ob[N(iL){KfunctionJ1)%s!=Hfor(Fi=0;i<s*s;i++)Gif(Fvar Db[i]A='#000'".split(""))a=a.replace(RegExp(c[b][0],"g"),c[b].slice(1));eval(a)
- Description
- Simple fun game aka Same Game
UPDATES
* improved ui and gameplay
* shorter code with improved algorithm
- Base64 encoded
YT0iYz1kb2N1bTMuZ35FVW0zQnlJZCgnYydRcz0xNTtyPTI1O2w9cypyOwF3aWRWPQFoZWlnaHQ9bDtiPVtXNz0LN29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GxpdCgiHyIpKWE9YS5yZXBsYWNlKFJlZ0V4cChjW2JdWzBdLCJnIiksY1tiXS5zbGljZSgxKSk7ZXZhbChhKQ==
- Original source
c = document.getElementById('c');
s = 15;
r = 25;
l = s * r;
c.width = c.height = l;
b = [];
fl = Math.floor;
m = ['tomato', 'orange', 'olive', 'steelblue'];
document.body.style.margin = 0;
p = function (i) {
return b[i] != '#000'
&& ((b[i - s] == b[i])
|| (b[i + s] == b[i])
|| (((i-1)%s != s-1) && (b[i - 1] == b[i]))
|| (((i+1)%s != 0) && (b[i + 1] == b[i])));
};
up = c.onclick = function (e) {
var q = true,
sc = s * s,
w = [];
if (e) {
var k = fl(e.clientX / r) + fl(e.clientY / r) * s;
if (!p(k)) return;
var h = b[k];
function el(i) {
if (b[i] && b[i] == h) {
b[i] = '#000';
el(i - s);
el(i + s);
if((i-1)%s != s-1) el(i - 1);
if((i+1)%s != 0) el(i + 1);
}
}
el(k);
for (var i = (s * s) - 1; i >= 0; i--) {
if (b[i] == '#000') {
var ii = i;
while (b[ii-=s] == '#000');
if (b[ii]) {
b[i] = b[ii];
b[ii] = '#000';
} else {
if (!b[i+s]) w.push(i % s);
}
}
}
for (var i in w) {
var z = w[i];
while (z < s) {
for (var j = 0; j < s; j++) {
var u = (j * s) + z;
if((u+1)%s != 0) {
b[u] = b[u + 1];
b[u + 1] = '#000';
}
}
z++;
}
}
}
with(c.getContext('2d')) {
fillStyle = '#000';
fillRect(0, 0, l, l);
for (var i = 0; i < s * s; i++) {
fillStyle = b[i];
beginPath();
arc(((i % s) * r) + (r / 2), (fl(i / s) * r) + (r / 2), r / 2, 0, Math.PI * 2, true);
closePath();
fill();
}
}
for (var i = 0; i < s * s; i++) {
if(b[i] == '#000') sc--;
q = q && !p(i);
}
if (q) {
alert('Sc: ' + sc);
rs();
}
};
rs = function () {
for (var i = 0; i < s * s; i++)
b[i] = m[fl(Math.random() * m.length)];
up();
};
rs();