new files

This commit is contained in:
Ingy döt Net 2013-04-10 12:38:42 -07:00
parent 3af7344581
commit 86c034bb8b
1364 changed files with 21352 additions and 0 deletions

View file

@ -0,0 +1,29 @@
function checkBalance(i) {
while (i.length % 2 == 0) {
j = i.replace('{}','');
if (j == i)
break;
i = j;
}
return (i?false:true);
}
var g = 10;
while (g--) {
var N = 10 - Math.floor(g/2), n=N, o='';
while (n || N) {
if (N == 0 || n == 0) {
o+=Array(++N).join('}') + Array(++n).join('{');
break;
}
if (Math.round(Math.random()) == 1) {
o+='}';
N--;
}
else {
o+='{';
n--;
}
}
alert(o+": "+checkBalance(o));
}