A simple 2 player version of the game "Connect Four" (also known as "Captain's Mistress", "Four Up", "Plot Four", "Find Four", "Fourplay", "Four in a Row" and "Four in a Line").
_='(var i=0,s=tnr;(n=t-Pen@}$t+8>oe oWo-n})9||r=e+Urrt@r}3<r-e-P/1>Z--}$t+Ur/7<G++Wr-n+P/7<Z++}$t-Ur/1>G--Wr-n}9?(d=1,A]+" wj.\\n):},o=["._{ff0.Red{f00,{00ftd{*40heV:4021fff{paddqg:7Dspacqg:48Q8Q0 0{heV:55*120 0 8Q8`^ftbody,{*340text-align:cOer;margq:20Qauto 0 ~ {`rV}"].map(sty^Sheets[0].qsertRu^(e,2)}Kb"Next : ";bzierrrbuttj")Kr"X"A"};ttr"KFrtd"Kr.id=noJif(!dJn=6;P;if(ne=""Js(0,n,e,]Kbreak}}}oKtr)}et))})(d())getE^mOById(["Red","_"][ie,t,n,rJ=createE^mO(").className=X?")&&JFno""}).appendChild(d=0;;n=Un;n o@background:#Dradius:for(.qnerHTML=return }9||n=e-r=e+$t+""+++J}","functij(documO.")Kbpx;&&n--Jtab^1;;r.jclick=z=(i+1)%2]div$o=*width:/&&!(9(t,n)@=];Acjfirm(Dborder-F$8>o;oGo)r roJ){K);OentP0<nQpx U7>VightW}4<XRestartZo)n o^le_Yellow`float:jonqin}}(';for(Y in $='qj`_^ZXWVUQPOKJGFDA@9/*$ ')with(_.split($[Y]))_=join(pop());eval(_)
Xz0nKAN2YXIgaT0wLHM9AwF0Em4FcjsoAw5uPXQtHFAZZRJuQBp9JHQrHDg+bxllCW8TV28tbn0pOXx8Aw5yPWUrVXIZchJ0QHITfRAzPHItZREtHFAvMT5aLS19JHQrVXIvNzxHKytXci1uESscUC83PForK30kdC1Vci8xPkctLVdyLW59OT8oZD0xLEECXSsiIHdqLlxcbgYpOh59LG89A1siLl97C2ZmMBQuUmVkewtmMDAUHywbewswMGYUdGR7KjQwGGhlVjo0MAwyMRgLZmZmFBt7cGFkZHFnOjdEc3BhY3FnOjQMOFE4UTAgMBQfe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
// http://www.iteral.com/jscrush/
(function(g, h, n, k) {
var
r = 0,
D = function(g, h, n, k) {
document.getElementById(h + "" + n).className = k;
(function(g, h, n, k) {
for (n = h - 1; 0 < n && document.getElementById(g + "" + n).className == ["Red", "Yellow"][r]; n--) {
}
for (e = h + 1; 8 > e && document.getElementById(g + "" + e).className == ["Red", "Yellow"][r]; e++) {
}
return 4 < e - n
})(h, n) || function(g, h, n, k) {
for (k = g + 1; 7 > k && document.getElementById(k + "" + h).className == ["Red", "Yellow"][r]; k++) {
}
return 3 < k - g
}(h, n) || function(g, h, n, k) {
n = g - 1;
k = g + 1;
for (e = h - 1; 0 < n && !(1 > e) && document.getElementById(n + "" + e).className == ["Red", "Yellow"][r]; n--)
e--;
for (e = h + 1; 7 > k && !(7 < e) && document.getElementById(k + "" + e).className == ["Red", "Yellow"][r]; k++)
e++;
return 4 < k - n
}(h, n) || function(g, h, n, k) {
n = g - 1;
k = g + 1;
for (e = h + 1; 0 < n && !(7 < e) && document.getElementById(n + "" + e).className == ["Red", "Yellow"][r]; n--)
e++;
for (e = h - 1; 7 > k && !(1 > e) && document.getElementById(k + "" + e).className == ["Red", "Yellow"][r]; k++)
e--;
return 4 < k - n;
}(h, n) ? (d = 1, confirm(["Red", "Yellow"][r] + " won.\nRestart?") && function() {
d = 0;
z.innerHTML = ["Red", "Yellow"][r = (r + 1) % 2];
for (n = 1; 7 > n; n++)
for (e = 1; 8 > e; e++)
document.getElementById(n + "" + e).className = ""
}()) : z.innerHTML = ["Red", "Yellow"][r = (r + 1) % 2]
},
e = function(g, h, n, k) {
[
".Yellow{background:#ff0}",
".Red{background:#f00}",
"div,table{background:#00f}",
"td{width:40px;height:40px;border-radius:21px;background:#fff}",
"table{padding:7px;border-spacing:4px;border-radius:8px 8px 0 0}",
"div{height:55px;width:12px;border-radius:0 0 8px 8px;float:left}",
"body,table{width:340px;text-align:center;margin:20px auto 0}",
"div ~ div{float:right}"
].map(function(g, h, n, k) {
document.styleSheets[0].insertRule(g, 2)
});
b.innerHTML = "Next : ";
b.appendChild(z = document.createElement("i"));
b.appendChild(g = document.createElement("table"));
b.appendChild(k = document.createElement("div"));
b.appendChild(k = document.createElement("div"));
b.appendChild(k = document.createElement("button"));
k.innerHTML = "Restart";
k.onclick =
function(g, h, n, k) {
confirm("Restart?") && function() {
d = 0;
z.innerHTML = ["Red", "Yellow"][r = (r + 1) % 2];
for (n = 1; 7 > n; n++)
for (e = 1; 8 > e; e++)
document.getElementById(n + "" + e).className = ""
}();
};
d = 0;
z.innerHTML = ["Red", "Yellow"][r = (r + 1) % 2];
for (n = 1; 7 > n; n++) {
h = document.createElement("tr");
for (e = 1; 8 > e; e++) {
k = document.createElement("td");
k.id = n + "" + e;
k.onclick = function(g, h, n, k) {
return function() {
if (!d) {
for (n = 6; 0 < n; n--) {
if (document.getElementById(n + "" + g).className == "") {
D(0, n, g, ["Red", "Yellow"][r]);
break
}
}
}
}
}(e);
h.appendChild(k)
}
g.appendChild(h)
}
}()
})(d());