<commit_before>var f=null,g=this;function j(a,c){var b=a.split("."),d=g;!(b[0]in d)&&d.execScript&&d.execScript("var "+b[0]);for(var e;b.length&&(e=b.shift());)!b.length&&void 0!==c?d[e]=c:d=d[e]?d[e]:d[e]={}}function k(a,c){function b(){}b.prototype=c.prototype;a.k=c.prototype;a.prototype=new b};function l(a){return"undefined"!=typeof a&&a!=f}function m(a,c){for(var b=1;b<arguments.length;++b)if(l(a.match("%s")))a=a.replace(/%s/,arguments[b]);else throw Error("Too many positional arguments to fill format string: "+a);if(l(a.match("%s")))throw Error("Not enough positional arguments to fill in format string: "+a);return a};function n(){}function p(a){this.d=a||f}p.prototype.g=function(a){this.d=a||f};function q(a,c){this.a=[];for(var b=0;b<c;++b){this.a[b]=[];for(var d=0;d<a;++d)this.a[b][d]=new p(f)}}function r(a,c){if(0>c[0]||a.a.length<=c[0]||0>c[1]||a.a[0].length<=c[1])throw Error(m("Invalid coords (%s, %s) for board (%s x %s)",c[0],c[1],a.a.length,a.a[0].length));return a.a[c[0]][c[1]]}q.prototype.h=function(a){a=s(a);r(this,a).g(f)};j("gamebuilder.games.BoardMxN.prototype.erasePieceAtPos",q.prototype.h);
q.prototype.b=function(a){return r(this,a).d};function s(a){if(2>a.length)throw Error("Invalid format of coordinates: "+a);return[a.charCodeAt(0)-97,a.substr(1,a.length)-1]};function t(a){this.e=a}var u=new t("white"),v=new t("black");function w(a){this.e=a}k(w,n);w.prototype.color=function(){return this.e};function x(){this.d=f}x.prototype.g=function(a){this.d=a||f};function y(a,c){q.call(this,a,c);this.a=[];for(var b=0;b<c;++b){this.a[b]=[];for(var d=0;d<a;++d)this.a[b][d]=new x}this.c="Error: call setImagePath() to set the path"}k(y,q);y.prototype.i=function(a){this.c=a};j("gamebuilder.games.go.BoardMxN.prototype.setImagePath",y.prototype.i);
y.prototype.j=function(a,c){var b=new w(a),d=s(c);r(this,d).g(b)};j("gamebuilder.games.go.BoardMxN.prototype.setPieceColorAtPos",y.prototype.j);y.prototype.b=function(a){a=r(this,a).d;return l(a)?a:f};j("gamebuilder.games.go.BoardMxN.prototype.getPieceAtCoords",y.prototype.b);y.prototype.f=function(a){if(l(a)){if(a.color()==v)return m("%s/black.png",this.c);if(a.e==u)return m("%s/white.png",this.c);throw Error("Invalid color of piece: "+a.e);}return m("%s/clear.png",this.c)};
j("gamebuilder.games.go.BoardMxN.prototype.imagePathForPiece",y.prototype.f);function z(a,c){var b=document.createElement("img");b.src=a.f(c);b.style.width=b.style.height="50px";return b}function A(a,c){return[c[1],a.a.length-c[0]-1]}
y.prototype.update=function(a){if(this.a.length!=a.rows.length||this.a[0].length!=a.rows[0].childNodes.length)throw Error(m("Incompatible sizes: board (%s x %s) vs. table (%s x %s)",this.a.length,this.a[0].length,a.rows.length,a.rows[0].childNodes.length));for(var c=0;c<a.rows.length;++c)for(var b=a.rows[c],d=0;d<b.childNodes.length;++d){var e=b.childNodes[d].childNodes[0],h=this.b(A(this,[c,d]));if(e.src!=this.f(h))e.src=this.f(h)}};function B(a,c,b){var d=C;return function(){d(a,c,b)}}
function D(a){y.call(this,a,a)}k(D,y);function E(){D.call(this,9)}k(E,D);var F=v,G=[[v,"blackPiece"],[u,"whitePiece"],[f,"emptyPiece"]];function H(){for(var a=0;a<G.length;++a)document.getElementById(G[a][1]).style.border=F==G[a][0]?"2px solid #224499":"2px solid white"}function C(a,c,b){l(F)?a.j(F,b):a.h(b);a.update(c);H()}function I(a){return function(){F=a;H()}}function J(a){a=String.fromCharCode(a.which).toLowerCase();"b"==a?F=v:"w"==a?F=u:"e"==a&&(F=f);H()}
j("demo.go.displayGoBoard",function(){var a=new E;a.i("../data/images/go");var c=document.createElement("table");c.cellSpacing=0;c.cellPadding=0;c.style.border="0";for(var b=a.a.length-1;0<=b;--b)for(var d=c.insertRow(-1),e=0;e<a.a.length;++e){var h=document.createElement("td"),i="",i=b==a.a[0].length-1?"upper-":0==b?"bottom-":"center-",i=0==e?i+"left":e==a.a.length-1?i+"right":i+"middle",i=i+".png";h.style.backgroundImage=m("url(%s/%s)",a.c,i);h.style.width=h.style.height="50px";h.appendChild(z(a,
a.b([e,b])));d.appendChild(h)}document.getElementById("board").appendChild(c);for(b=0;b<G.length;++b)d=G[b][0],e=f,l(d)&&(e=new w(d)),e=z(a,e),e.onclick=I(d),document.getElementById(G[b][1]).appendChild(e);a.update(c);for(b=0;b<c.rows.length;++b){d=c.rows[b];for(e=0;e<d.childNodes.length;++e){var h=d.childNodes[e].childNodes[0],o=A(a,[b,e]),i=m("%s%s",String.fromCharCode(97+o[0]),o[1]+1),o=a.b(o);if("undefined"==typeof o||o==f)h.onclick=B(a,c,i)}}H();document.onkeypress=J});<commit_msg>Regenerated Go board display/interaction demo code.<commit_after>var g=null,j=this;function l(a,c){var b=a.split("."),d=j;!(b[0]in d)&&d.execScript&&d.execScript("var "+b[0]);for(var e;b.length&&(e=b.shift());)!b.length&&void 0!==c?d[e]=c:d=d[e]?d[e]:d[e]={}}function m(a,c){function b(){}b.prototype=c.prototype;a.m=c.prototype;a.prototype=new b};function n(a){return"undefined"!=typeof a&&a!=g}function o(a,c){for(var b=1;b<arguments.length;++b)if(n(a.match("%s")))a=a.replace(/%s/,arguments[b]);else throw Error("Too many positional arguments to fill format string: "+a);if(n(a.match("%s")))throw Error("Not enough positional arguments to fill in format string: "+a);return a};function p(){}function r(a){this.d=a||g}r.prototype.f=function(a){this.d=a||g};function s(a,c){this.a=[];for(var b=0;b<c;++b){this.a[b]=[];for(var d=0;d<a;++d)this.a[b][d]=new r(g)}}function t(a,c){if(0>c[0]||a.a.length<=c[0]||0>c[1]||a.a[0].length<=c[1])throw Error(o("Invalid coords (%s, %s) for board (%s x %s)",c[0],c[1],a.a.length,a.a[0].length));return a.a[c[0]][c[1]]}s.prototype.i=function(a){a=u(a);t(this,a).f(g)};l("gamebuilder.games.BoardMxN.prototype.erasePieceAtPos",s.prototype.i);
s.prototype.b=function(a){return t(this,a).d};function u(a){if(2>a.length)throw Error("Invalid format of coordinates: "+a);return[a.charCodeAt(0)-97,a.substr(1,a.length)-1]};function v(a){this.h=a}var w=new v("white"),x=new v("black");function y(a){this.h=a}m(y,p);y.prototype.color=function(){return this.h};function z(){this.d=g}z.prototype.f=function(a){this.d=a||g};function A(a,c){s.call(this,a,c);this.a=[];for(var b=0;b<c;++b){this.a[b]=[];for(var d=0;d<a;++d)this.a[b][d]=new z}}m(A,s);A.prototype.k=function(a,c){var b=new y(a),d=u(c);t(this,d).f(b)};l("gamebuilder.games.go.BoardMxN.prototype.setPieceColorAtPos",A.prototype.k);
A.prototype.b=function(a){a=t(this,a).d;return n(a)?a:g};l("gamebuilder.games.go.BoardMxN.prototype.getPieceAtCoords",A.prototype.b);function B(a){A.call(this,a,a)}m(B,A);function C(){B.call(this,9)}m(C,B);function D(a){this.a=a;this.g=document.createElement("table");this.l=!1;this.c="Error: call setImagePath() to set the path"}D.prototype.j=function(a){this.c=a};l("gamebuilder.games.go.ui.BoardUI.prototype.setImagePath",D.prototype.j);D.prototype.e=function(a){if(n(a)){if(a.color()==x)return o("%s/black.png",this.c);if(a.color()==w)return o("%s/white.png",this.c);throw Error("Invalid color of piece: "+a.color());}return o("%s/clear.png",this.c)};
l("gamebuilder.games.go.ui.BoardUI.prototype.imagePathForPiece",D.prototype.e);function E(a,c){var b=document.createElement("img");b.src=a.e(c);b.style.width=b.style.height="50px";return b}
function F(a){var c=a.a,b=a.g;if(a.l)return b;b.cellSpacing=0;b.cellPadding=0;b.style.border="0";for(var d=c.a.length,e=c.a[0].length,f=d-1;0<=f;--f)for(var q=b.insertRow(-1),h=0;h<e;++h){var k=document.createElement("td"),i="",i=f==e-1?"upper-":0==f?"bottom-":"center-",i=0==h?i+"left":h==d-1?i+"right":i+"middle",i=i+".png";k.style.backgroundImage=o("url(%s/%s)",a.c,i);k.style.width=k.style.height="50px";k.appendChild(E(a,c.b([h,f])));q.appendChild(k)}a.l=!0;return b}
function G(a,c){return[c[1],a.a.a.length-c[0]-1]}D.prototype.update=function(){for(var a=this.a,c=this.g,b=0;b<c.rows.length;++b)for(var d=c.rows[b],e=0;e<d.childNodes.length;++e){var f=d.childNodes[e].childNodes[0],q=a.b(G(this,[b,e]));if(f.src!=this.e(q))f.src=this.e(q)}};function H(a,c,b){var d=I;return function(){d(a,c,b)}};var J=x,K=[[x,"blackPiece"],[w,"whitePiece"],[g,"emptyPiece"]];function L(){for(var a=0;a<K.length;++a)document.getElementById(K[a][1]).style.border=J==K[a][0]?"2px solid #224499":"2px solid white"}function I(a,c,b){n(J)?c.k(J,b):c.i(b);a.update();L()}function M(a){return function(){J=a;L()}}function N(a){a=String.fromCharCode(a.which).toLowerCase();"b"==a?J=x:"w"==a?J=w:"e"==a&&(J=g);L()}
l("demo.go.displayGoBoard",function(){var a=new C,a=new D(a);a.j("../data/images/go");document.getElementById("board").appendChild(F(a));for(var c=0;c<K.length;++c){var b=K[c][0],d=g;n(b)&&(d=new y(b));d=E(a,d);d.onclick=M(b);document.getElementById(K[c][1]).appendChild(d)}a.update();c=a.a;b=a.g;for(d=0;d<b.rows.length;++d)for(var e=b.rows[d],f=0;f<e.childNodes.length;++f){var q=e.childNodes[f].childNodes[0],h=G(a,[d,f]),k=o("%s%s",String.fromCharCode(97+h[0]),h[1]+1),h=c.b(h);if("undefined"==typeof h||
h==g)q.onclick=H(a,c,k)}L();document.onkeypress=N});
{'fraction_non_alphanumeric': 0.29962800135272233, 'fraction_numerical': 0.016683575696088377, 'mean_word_length': 10.989189189189188, 'pattern_counts': {'":': 10, '<': 33, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2051060', 'n_tokens_mistral': 4080, 'n_tokens_neox': 4053, 'n_words': 277}