Browse Source

Build

master
Kaj Bjorklund 10 years ago
parent
commit
fb9376ff14
  1. 12
      chess.html
  2. 59
      chess.min.js

12
chess.html

@ -4,7 +4,7 @@
<meta http-equiv="x-ua-compatible" content="IE=edge">
<meta charset="utf-8">
<title>Chess</title>
<link rel="stylesheet" href="//code.jquery.com/ui/1.10.0/themes/base/jquery-ui.css">
<link rel="stylesheet" href="https://code.jquery.com/ui/1.10.0/themes/base/jquery-ui.css">
<link rel="stylesheet" href="chess.css">
<link rel="shortcut icon" href="chess.ico">
</head>
@ -24,14 +24,14 @@
</div>
<div id="footer"></div>
<div id="dim"></div>
<script src="//code.jquery.com/jquery-1.9.0.min.js"></script>
<script src="//code.jquery.com/ui/1.10.0/jquery-ui.min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/jqueryui-touch-punch/0.2.2/jquery.ui.touch-punch.min.js"></script>
<!--[if lt IE 9]><script src="//cdnjs.cloudflare.com/ajax/libs/augment.js/1.0.0/augment.min.js"></script><![endif]-->
<script src="https://code.jquery.com/jquery-1.9.0.min.js"></script>
<script src="https://code.jquery.com/ui/1.10.0/jquery-ui.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jqueryui-touch-punch/0.2.2/jquery.ui.touch-punch.min.js"></script>
<!--[if lt IE 9]><script src="https://cdnjs.cloudflare.com/ajax/libs/augment.js/1.0.0/augment.min.js"></script><![endif]-->
<script src="chess.min.js"></script>
<script>
$(makeChessGame);
</script>
<a href="https://github.com/kbjorklu/chess"><img style="position: absolute; top: 0; right: 0; border: 0;" src="//s3.amazonaws.com/github/ribbons/forkme_right_gray_6d6d6d.png" alt="Fork me on GitHub"></a>
<a href="https://github.com/kbjorklu/chess"><img style="position: absolute; top: 0; right: 0; border: 0;" src="https://s3.amazonaws.com/github/ribbons/forkme_right_gray_6d6d6d.png" alt="Fork me on GitHub"></a>
</body>
</html>

59
chess.min.js

@ -1,29 +1,32 @@
(function(){'use strict';var h=0,k=5,n=0,aa="pawn knight bishop rook queen king".split(" ");function ba(a,b){return"abcdefgh"[b]+"12345678"[a]}function ca(a){return"abcdefgh".indexOf(a[0])+8*"12345678".indexOf(a[1])}function q(a){return ba(a>>>3,a&7)};function da(a,b){this.a=a>>>0;this.b=b>>>0}function ea(a){a>>>=0;a-=a>>>1&1431655765;a=(a&858993459)+(a>>>2&858993459);return 16843009*(a+(a>>>4)&252645135)>>>24}function fa(a){a>>>=0;return(a&a-1)>>>0}function ha(a){a>>>=0;return ea((a&-a)-1)}function ia(a){return ea(a.a)+ea(a.b)}function ja(a){return a.a?ha(a.a):32+ha(a.b)}function r(a){var b=ja(a);a.a?a.a=fa(a.a):a.b=fa(a.b);return b}function s(a){return!a.a&&!a.b}function v(a,b){b>>>=0;return 32>b?!(a.a&1<<b):!(a.b&1<<b-32)}
function w(a,b){b>>>=0;32>b?a.a=(a.a|1<<b)>>>0:a.b=(a.b|1<<b-32)>>>0;return a}function ka(a,b){b>>>=0;32>b?a.a=(a.a&~(1<<b))>>>0:a.b=(a.b&~(1<<b-32))>>>0}function x(a,b){a.a=(a.a&b.a)>>>0;a.b=(a.b&b.b)>>>0;return a}function y(a,b){a.a=(a.a&~b.a)>>>0;a.b=(a.b&~b.b)>>>0;return a}function z(a,b){a.a=(a.a|b.a)>>>0;a.b=(a.b|b.b)>>>0;return a}function la(a,b){a.a=(a.a^b.a)>>>0;a.b=(a.b^b.b)>>>0}function ma(a){a.a=~a.a>>>0;a.b=~a.b>>>0;return a}
function A(a,b){b>>>=0;31<b?(a.b=a.a<<b-32>>>0,a.a=0):0<b&&(a.b=(a.b<<b|a.a>>>32-b)>>>0,a.a=a.a<<b>>>0);return a}function B(a,b){b>>>=0;31<b?(a.a=a.b>>>b-32,a.b=0):0<b&&(a.a=(a.a>>>b|a.b<<32-b)>>>0,a.b>>>=b);return a}function C(a,b){63<b||-63>b?a.a=a.b=0:0<b?A(a,b):0>b&&B(a,-b);return a}function na(a,b){return a.a===b.a&&a.b===b.b}function D(a){return F(a.a,a.b)}function F(a,b){return new da(a,b)}function G(a){return w(F(0,0),a)}
function oa(){var a=pa;return C(x(F(270549120,16909320),C(F(4294967295,4294967295),8*a)),a)}function qa(){var a=ra;return C(x(F(134480385,2151686160),C(F(4294967295,4294967295),8*-a)),a)}function sa(){var a=w(F(0,0),ta),b=y(B(D(a),1),H[7]),d=y(y(B(D(a),2),H[7]),H[6]),c=y(A(D(a),1),H[0]),a=y(y(A(D(a),2),H[0]),H[1]),d=z(d,a),b=z(b,c);return z(z(z(A(D(d),8),B(d,8)),A(D(b),16)),B(b,16))}
function ua(){var a=w(F(0,0),va),b=z(y(B(D(a),1),H[7]),y(A(D(a),1),H[0])),d=B(z(D(a),b),8),a=A(z(D(a),b),8);return z(z(b,d),a)}for(var wa=F(4294967295,4294967295),xa=F(1437226410,1437226410),ya=F(2857740885,2857740885),za=[],Aa=0;8>Aa;++Aa)za.push(A(F(16843009,16843009),Aa));for(var H=za,J=[],Ba=0;8>Ba;++Ba)J.push(A(F(255,0),8*Ba));for(var Ca=[],pa=-7;8>pa;++pa)Ca.push(oa());for(var Da=[],ra=-7;8>ra;++ra)Da.push(qa());for(var Ea=[],ta=0;64>ta;++ta)Ea.push(sa());for(var Fa=[],va=0;64>va;++va)Fa.push(ua());function Ga(a,b){this.b=a>>>0;this.a=b>>>0}for(var Ha=[],Ia=0;1586>Ia;++Ia)Ha.push(1+4294967295*Math.random()>>>0);function L(a,b){a.b=(a.b^Ha[b])>>>0;a.a=(a.a^Ha[b+1])>>>0}function M(a,b){0<=b&&L(a,1570+(b&7))};function Ja(a,b,d,c,e){this.a=b&63|(a&63)<<6|(d&15)<<12|(c&7)<<16|((e|0)&7)<<19}var Ka=0,La=4,Ma=8,Na=9,Oa=10,Pa=11,Qa=12,Ra=13,Sa=14,Ta=15;function N(a){return a.a>>>6&63}function O(a){return a.a>>>12&15}function P(a){return a.a>>>16&7}function Wa(a){return 2===O(a)||3===O(a)}function Xa(a){return O(a)&8?1+(O(a)&3):h}function Ya(a){return 5!==O(a)?a.a&63:(a.a&63)+(N(a)<(a.a&63)?-8:8)};function Za(){this.b=new Ga(0,0);this.a=[z(D(J[1]),J[6]),z(z(z(G(1),G(6)),G(57)),G(62)),z(z(z(G(2),G(5)),G(58)),G(61)),z(z(z(G(0),G(7)),G(56)),G(63)),z(G(3),G(59)),z(G(4),G(60)),z(D(J[0]),J[1]),z(D(J[6]),J[7])];this.f=[];this.c=n;this.e=15;this.d=-1;this.h=0;this.g=[];this.i=[];for(var a=this.f.length=0;64>a;++a){var b;a:{for(b=h;b<=k;++b)if(!v(this.a[b],a))break a;b=null}this.f.push(b)}this.b=new Ga(0,0);this.c&&L(this.b,0);for(a=n;1>=a;++a)for(b=h;b<=k;++b)for(var d=this.b,c=b,e=a,f=Q(this,b,a),
f=D(f);!s(f);){var g=r(f);L(d,2+c+6*e+12*g)}L(this.b,1538+this.e);M(this.b,this.d);this.j=[]}var R=k+1,$a=R+1,S=[7,63,0,56],ab=[ma(A(F(16843009,16843009),7)),wa,ma(A(F(16843009,16843009),0))];function T(a,b,d){d=bb(a,!!d);return b?d:d.filter(Za.prototype.k,a)}function Q(a,b,d){return x(D(a.a[b]),a.a[R+d])}function cb(a){return z(D(a.a[R]),a.a[$a])}function U(a){return db(a,a.c^1,ja(Q(a,k,a.c)))}function V(a,b,d,c){var e=F(0,0);d=8*d+c;c=ab[1+c];for(C(a,d);!s(x(a,c));C(y(a,b),d))z(e,a);return e}
function eb(a,b){return z(z(z(V(D(a),b,1,1),V(D(a),b,1,-1)),V(D(a),b,-1,1)),V(D(a),b,-1,-1))}function fb(a,b){return z(z(z(V(D(a),b,0,1),V(D(a),b,0,-1)),V(D(a),b,1,0)),V(D(a),b,-1,0))}
function db(a,b,d){var c,e=Q(a,h,b),f=b===n;c=C(y(D(e),H[0]),f?7:-9);e=C(y(D(e),H[7]),f?9:-7);c=z(c,e);if(!v(c,d))return!0;c=Q(a,1,b);if(!s(x(D(Ea[d]),c)))return!0;c=Q(a,k,b);if(!s(x(D(Fa[d]),c)))return!0;c=cb(a);e=Q(a,4,b);f=z(D(Q(a,2,b)),e);f=eb(f,c);if(!v(f,d))return!0;a=z(D(Q(a,3,b)),e);a=fb(a,c);return v(a,d)?!1:!0}function W(a,b,d){L(a.b,1538+a.e);a.e&=~(1<<b+(d?0:2));L(a.b,1538+a.e)}
function gb(a,b,d){if(0===(a.e&1<<b+(d?0:2)))return!1;var c=d?1:-1,e=b===n?4:60,f=cb(a);(c=!v(f,e+c)||!v(f,e+2*c)||!d&&!v(f,e+3*c))||(c=b^1,d=d?1:-1,b=b===n?4:60,c=!(!db(a,c,b)&&!db(a,c,b+d)&&!db(a,c,b+2*d)));return c?!1:!0}function hb(a){var b=a.b;return 3<=a.j.reduce(function(a,c){return a+(c.b===b.b&&c.a===b.a?1:0)},0)}
function ib(a){if(!s(a.a[h])||!s(a.a[3])||!s(a.a[4]))return!1;if(4>ia(a.a[R+n])+ia(a.a[R+1]))return!0;if(!s(a.a[1]))return!1;a=a.a[2];return na(x(D(a),xa),a)||na(x(D(a),ya),a)?!0:!1}
function bb(a,b){function d(a,b,d){for(;!s(a);){var c=r(a);f.push(new Ja(c-b,c,d,h,I.f[c]))}}function c(a,b,c){d(D(a),b,c?Ta:Pa);d(D(a),b,c?Sa:Oa);d(D(a),b,c?Ra:Na);d(D(a),b,c?Qa:Ma)}function e(a,b,c){for(;!s(b);){var d=r(b);v(ub,d)&&f.push(new Ja(a,d,v(p,d)?Ka:La,c,I.f[d]))}}var f=[],g=a.c,p=a.a[R+(g^1)],l=cb(a),I=a,m=1-2*g,E=8*m,u=Q(a,h,g),t=J[g?0:7];if(!b){var K=y(y(C(x(D(u),J[g?6:1]),2*E),l),C(D(l),E));d(K,2*E,1);K=y(C(D(u),E),l);d(y(D(K),t),E,Ka);c(x(D(K),t),E,!1)}var Ua=H[g?7:0],K=E-m,Y=x(C(y(D(u),
Ua),K),p);d(y(D(Y),t),K,La);c(x(D(Y),t),K,!0);var Y=H[g?0:7],E=E+m,Va=x(C(y(D(u),Y),E),p);d(y(D(Va),t),E,La);c(x(D(Va),t),E,!0);0<=a.d&&(t=C(y(x(G(a.d+m),u),Ua),K),d(t,K,5),m=C(y(x(G(a.d-m),u),Y),E),d(m,E,5));for(var ub=a.a[R+g],m=b?p:wa,u=D(Q(a,1,g));!s(u);)t=r(u),e(t,x(D(Ea[t]),m),1);for(u=D(Q(a,4,g));!s(u);)t=r(u),e(t,x(z(eb(G(t),l),fb(G(t),l)),m),4);for(u=D(Q(a,2,g));!s(u);)t=r(u),e(t,x(eb(G(t),l),m),2);for(u=D(Q(a,3,g));!s(u);)t=r(u),e(t,x(fb(G(t),l),m),3);l=ja(Q(a,k,g));e(l,x(D(Fa[l]),m),k);
b||(gb(a,g,!0)&&f.push(new Ja(l,l+2,2,k,null)),gb(a,g,!1)&&f.push(new Ja(l,l-2,3,k,null)));return f}function jb(a,b,d,c,e){var f=z(G(c),G(e));la(a.a[b],f);la(a.a[R+d],f);a.f[c]=null;a.f[e]=b;L(a.b,2+b+6*d+12*c);L(a.b,2+b+6*d+12*e)}function kb(a,b,d,c,e){ka(a.a[b],e);w(a.a[d],e);a.f[e]=d;L(a.b,2+b+6*c+12*e);L(a.b,2+d+6*c+12*e)}
function lb(a,b){if(O(b)&4){var d=b.a>>>19&7,c=a.c^1,e=Ya(b);ka(a.a[d],e);ka(a.a[R+c],e);a.f[e]=null;L(a.b,2+d+6*c+12*e)}Wa(b)&&(d=a.c,c=2===O(b),e=S[d+(c?0:2)],jb(a,3,d,e,e+(c?-2:3)));jb(a,P(b),a.c,N(b),b.a&63);O(b)&8&&kb(a,h,Xa(b),a.c,b.a&63)}function mb(a,b){O(b)&8&&kb(a,Xa(b),h,a.c,b.a&63);jb(a,P(b),a.c,b.a&63,N(b));if(Wa(b)){var d=a.c,c=2===O(b),e=S[d+(c?0:2)];jb(a,3,d,e+(c?-2:3),e)}O(b)&4&&(d=b.a>>>19&7,c=a.c^1,e=Ya(b),w(a.a[d],e),w(a.a[R+c],e),a.f[e]=d,L(a.b,2+d+6*c+12*e))}
Za.prototype.k=function(a){lb(this,a);var b=U(this);mb(this,a);return!b};function X(a,b){a.j.push(new Ga(a.b.b,a.b.a));lb(a,b);if(U(a))return mb(a,b),a.j.pop(),!1;a.g.push(b);a.i.push(a.d);a.i.push(a.e);a.i.push(a.h);M(a.b,a.d);a.d=1===O(b)?b.a&63:-1;M(a.b,a.d);var d=a.c;P(b)===k?(W(a,d,!0),W(a,d,!1)):3===P(b)&&(N(b)===S[d+0]?W(a,d,!0):N(b)===S[d+2]&&W(a,d,!1));d^=1;3===(b.a>>>19&7)&&(Ya(b)===S[d+0]?W(a,d,!0):Ya(b)===S[d+2]&&W(a,d,!1));O(b)&4||P(b)===h?a.h=0:++a.h;a.c=d;L(a.b,0);return!0}
function Z(a){if(a.g.length){var b=a.g.pop();a.c^=1;L(a.b,0);mb(a,b);a.i.pop();L(a.b,1538+a.e);a.e=a.i.pop();L(a.b,1538+a.e);M(a.b,a.d);a.d=a.i.pop();M(a.b,a.d);a.j.pop()}};var nb=[100,300,300,500,900,2E4],ob=[[0,0,0,0,0,0,0,0,50,50,50,50,50,50,50,50,10,10,20,30,30,20,10,10,5,5,10,25,25,10,5,5,0,0,0,20,20,0,0,0,5,-5,-10,0,0,-10,-5,5,5,10,10,-20,-20,10,10,5,0,0,0,0,0,0,0,0],[-50,-40,-30,-30,-30,-30,-40,-50,-40,-20,0,0,0,0,-20,-40,-30,0,10,15,15,10,0,-30,-30,5,15,20,20,15,5,-30,-30,0,15,20,20,15,0,-30,-30,5,10,15,15,10,5,-30,-40,-20,0,5,5,0,-20,-40,-50,-40,-30,-30,-30,-30,-40,-50],[-20,-10,-10,-10,-10,-10,-10,-20,-10,0,0,0,0,0,0,-10,-10,0,5,10,10,5,0,-10,-10,5,5,10,10,
(function(){'use strict';var aa="pawn knight bishop rook queen king".split(" ");function ba(a,b){return"abcdefgh"[b]+"12345678"[a]}function ca(a){return"abcdefgh".indexOf(a[0])+8*"12345678".indexOf(a[1])}function h(a){return ba(a>>>3,a&7)};function da(a,b){this.a=a>>>0;this.b=b>>>0}function fa(a){a>>>=0;a-=a>>>1&1431655765;a=(a&858993459)+(a>>>2&858993459);return 16843009*(a+(a>>>4)&252645135)>>>24}function ga(a){a>>>=0;return(a&a-1)>>>0}function ha(a){a>>>=0;return fa((a&-a)-1)}function k(a){return fa(a.a)+fa(a.b)}function ia(a){return a.a?ha(a.a):32+ha(a.b)}function p(a){var b=ia(a);a.a?a.a=ga(a.a):a.b=ga(a.b);return b}function q(a){return!a.a&&!a.b}function r(a,b){b>>>=0;return 32>b?!(a.a&1<<b):!(a.b&1<<b-32)}
function s(a,b){b>>>=0;32>b?a.a=(a.a|1<<b)>>>0:a.b=(a.b|1<<b-32)>>>0;return a}function ja(a,b){b>>>=0;32>b?a.a=(a.a&~(1<<b))>>>0:a.b=(a.b&~(1<<b-32))>>>0}function v(a,b){a.a=(a.a&b.a)>>>0;a.b=(a.b&b.b)>>>0;return a}function x(a,b){a.a=(a.a&~b.a)>>>0;a.b=(a.b&~b.b)>>>0;return a}function y(a,b){a.a=(a.a|b.a)>>>0;a.b=(a.b|b.b)>>>0;return a}function ka(a,b){a.a=(a.a^b.a)>>>0;a.b=(a.b^b.b)>>>0}function la(a){a.a=~a.a>>>0;a.b=~a.b>>>0;return a}
function z(a,b){b>>>=0;31<b?(a.b=a.a<<b-32>>>0,a.a=0):0<b&&(a.b=(a.b<<b|a.a>>>32-b)>>>0,a.a=a.a<<b>>>0);return a}function A(a,b){b>>>=0;31<b?(a.a=a.b>>>b-32,a.b=0):0<b&&(a.a=(a.a>>>b|a.b<<32-b)>>>0,a.b>>>=b);return a}function B(a,b){63<b||-63>b?a.a=a.b=0:0<b?z(a,b):0>b&&A(a,-b);return a}function ma(a,b){return a.a===b.a&&a.b===b.b}function C(a){return E(a.a,a.b)}function E(a,b){return new da(a,b)}function F(a){return s(E(0,0),a)}
function na(){var a=oa;return B(v(E(270549120,16909320),B(E(4294967295,4294967295),8*a)),a)}function pa(){var a=qa;return B(v(E(134480385,2151686160),B(E(4294967295,4294967295),8*-a)),a)}function ra(){var a=s(E(0,0),sa),b=x(A(C(a),1),G[7]),d=x(x(A(C(a),2),G[7]),G[6]),c=x(z(C(a),1),G[0]),a=x(x(z(C(a),2),G[0]),G[1]),d=y(d,a),b=y(b,c);return y(y(y(z(C(d),8),A(d,8)),z(C(b),16)),A(b,16))}
function ta(){var a=s(E(0,0),ua),b=y(x(A(C(a),1),G[7]),x(z(C(a),1),G[0])),d=A(y(C(a),b),8),a=z(y(C(a),b),8);return y(y(b,d),a)}for(var va=E(4294967295,4294967295),wa=E(1437226410,1437226410),xa=E(2857740885,2857740885),ya=[],za=0;8>za;++za)ya.push(z(E(16843009,16843009),za));for(var G=ya,I=[],Aa=0;8>Aa;++Aa)I.push(z(E(255,0),8*Aa));for(var Ba=[],oa=-7;8>oa;++oa)Ba.push(na());for(var Ca=[],qa=-7;8>qa;++qa)Ca.push(pa());for(var Da=[],sa=0;64>sa;++sa)Da.push(ra());for(var Ea=[],ua=0;64>ua;++ua)Ea.push(ta());function Fa(a,b){this.b=a>>>0;this.a=b>>>0}for(var Ga=[],Ha=0;1586>Ha;++Ha)Ga.push(1+4294967295*Math.random()>>>0);function J(a,b){a.b=(a.b^Ga[b])>>>0;a.a=(a.a^Ga[b+1])>>>0}function K(a,b){0<=b&&J(a,1570+(b&7))};function L(a,b,d,c,e){this.a=b&63|(a&63)<<6|(d&15)<<12|(c&7)<<16|((e|0)&7)<<19}function M(a){return a.a>>>6&63}function N(a){return a.a>>>12&15}function O(a){return a.a>>>16&7}function Ia(a){return 2===N(a)||3===N(a)}function Ja(a){return N(a)&8?1+(N(a)&3):0}function Ka(a){return 5!==N(a)?a.a&63:(a.a&63)+(M(a)<(a.a&63)?-8:8)}
L.prototype.h=function(){return Ia(this)?"0-0"+(3===N(this)?"-0":""):" NBRQK".charAt(O(this))+h(M(this))+(N(this)&4?"x":"-")+h(this.a&63)+(5===N(this)?"e.p.":"")+(N(this)&8?" NBRQK".charAt(Ja(this)):"")};function P(){this.b=new Fa(0,0);this.a=[y(C(I[1]),I[6]),y(y(y(F(1),F(6)),F(57)),F(62)),y(y(y(F(2),F(5)),F(58)),F(61)),y(y(y(F(0),F(7)),F(56)),F(63)),y(F(3),F(59)),y(F(4),F(60)),y(C(I[0]),I[1]),y(C(I[6]),I[7])];this.f=[];this.c=0;this.e=15;this.d=-1;this.j=0;this.g=[];this.i=[];for(var a=this.f.length=0;64>a;++a){var b;a:{for(b=0;5>=b;++b)if(!r(this.a[b],a))break a;b=null}this.f.push(b)}this.b=new Fa(0,0);this.c&&J(this.b,0);for(a=0;1>=a;++a)for(b=0;5>=b;++b)for(var d=this.b,c=b,e=a,f=Q(this,b,a),
f=C(f);!q(f);){var g=p(f);J(d,2+c+6*e+12*g)}J(this.b,1538+this.e);K(this.b,this.d);this.k=[]}var R=[7,63,0,56],La=[la(z(E(16843009,16843009),7)),va,la(z(E(16843009,16843009),0))];function S(a,b,d){d=Ma(a,!!d);return b?d:d.filter(P.prototype.l,a)}function Q(a,b,d){return v(C(a.a[b]),a.a[6+d])}function Na(a){return y(C(a.a[6]),a.a[7])}function T(a){return Oa(a,a.c^1,ia(Q(a,5,a.c)))}function U(a,b,d,c){var e=E(0,0);d=8*d+c;c=La[1+c];for(B(a,d);!q(v(a,c));B(x(a,b),d))y(e,a);return e}
function Pa(a,b){return y(y(y(U(C(a),b,1,1),U(C(a),b,1,-1)),U(C(a),b,-1,1)),U(C(a),b,-1,-1))}function Sa(a,b){return y(y(y(U(C(a),b,0,1),U(C(a),b,0,-1)),U(C(a),b,1,0)),U(C(a),b,-1,0))}
function Oa(a,b,d){var c,e=Q(a,0,b),f=0===b;c=B(x(C(e),G[0]),f?7:-9);e=B(x(C(e),G[7]),f?9:-7);c=y(c,e);if(!r(c,d))return!0;c=Q(a,1,b);if(!q(v(C(Da[d]),c)))return!0;c=Q(a,5,b);if(!q(v(C(Ea[d]),c)))return!0;c=Na(a);e=Q(a,4,b);f=y(C(Q(a,2,b)),e);f=Pa(f,c);if(!r(f,d))return!0;a=y(C(Q(a,3,b)),e);a=Sa(a,c);return r(a,d)?!1:!0}function V(a,b,d){J(a.b,1538+a.e);a.e&=~(1<<b+(d?0:2));J(a.b,1538+a.e)}
function Ta(a,b,d){if(0===(a.e&1<<b+(d?0:2)))return!1;var c=d?1:-1,e=0===b?4:60,f=Na(a);(c=!r(f,e+c)||!r(f,e+2*c)||!d&&!r(f,e+3*c))||(c=b^1,d=d?1:-1,b=0===b?4:60,c=!(!Oa(a,c,b)&&!Oa(a,c,b+d)&&!Oa(a,c,b+2*d)));return c?!1:!0}function Ua(a){var b=a.b;return 3<=a.k.reduce(function(a,c){return a+(c.b===b.b&&c.a===b.a?1:0)},0)}function Va(a){if(!q(a.a[0])||!q(a.a[3])||!q(a.a[4]))return!1;if(4>k(a.a[6])+k(a.a[7]))return!0;if(!q(a.a[1]))return!1;a=a.a[2];return ma(v(C(a),wa),a)||ma(v(C(a),xa),a)?!0:!1}
function Wa(a){return 100<=a.j||Ua(a)||Va(a)}
function Ma(a,b){function d(a,b,d){for(;!q(a);){var c=p(a);f.push(new L(c-b,c,d,0,D.f[c]))}}function c(a,b,c){d(C(a),b,c?15:11);d(C(a),b,c?14:10);d(C(a),b,c?13:9);d(C(a),b,c?12:8)}function e(a,b,d){for(;!q(b);){var c=p(b);r(ib,c)&&f.push(new L(a,c,r(n,c)?0:4,d,D.f[c]))}}var f=[],g=a.c,n=a.a[6+(g^1)],l=Na(a),D=a,m=1-2*g,w=8*m,u=Q(a,0,g),t=I[g?0:7];if(!b){var H=x(x(B(v(C(u),I[g?6:1]),2*w),l),B(C(l),w));d(H,2*w,1);H=x(B(C(u),w),l);d(x(C(H),t),w,0);c(v(C(H),t),w,!1)}var Qa=G[g?7:0],H=w-m,W=v(B(x(C(u),
Qa),H),n);d(x(C(W),t),H,4);c(v(C(W),t),H,!0);var W=G[g?0:7],w=w+m,Ra=v(B(x(C(u),W),w),n);d(x(C(Ra),t),w,4);c(v(C(Ra),t),w,!0);0<=a.d&&(t=B(x(v(F(a.d+m),u),Qa),H),d(t,H,5),m=B(x(v(F(a.d-m),u),W),w),d(m,w,5));for(var ib=a.a[6+g],m=b?n:va,u=C(Q(a,1,g));!q(u);)t=p(u),e(t,v(C(Da[t]),m),1);for(u=C(Q(a,4,g));!q(u);)t=p(u),e(t,v(y(Pa(F(t),l),Sa(F(t),l)),m),4);for(u=C(Q(a,2,g));!q(u);)t=p(u),e(t,v(Pa(F(t),l),m),2);for(u=C(Q(a,3,g));!q(u);)t=p(u),e(t,v(Sa(F(t),l),m),3);l=ia(Q(a,5,g));e(l,v(C(Ea[l]),m),5);b||
(Ta(a,g,!0)&&f.push(new L(l,l+2,2,5,null)),Ta(a,g,!1)&&f.push(new L(l,l-2,3,5,null)));return f}function Xa(a,b,d,c,e){var f=y(F(c),F(e));ka(a.a[b],f);ka(a.a[6+d],f);a.f[c]=null;a.f[e]=b;J(a.b,2+b+6*d+12*c);J(a.b,2+b+6*d+12*e)}function Ya(a,b,d,c,e){ja(a.a[b],e);s(a.a[d],e);a.f[e]=d;J(a.b,2+b+6*c+12*e);J(a.b,2+d+6*c+12*e)}
function Za(a,b){if(N(b)&4){var d=b.a>>>19&7,c=a.c^1,e=Ka(b);ja(a.a[d],e);ja(a.a[6+c],e);a.f[e]=null;J(a.b,2+d+6*c+12*e)}Ia(b)&&(d=a.c,c=2===N(b),e=R[d+(c?0:2)],Xa(a,3,d,e,e+(c?-2:3)));Xa(a,O(b),a.c,M(b),b.a&63);N(b)&8&&Ya(a,0,Ja(b),a.c,b.a&63)}function $a(a,b){N(b)&8&&Ya(a,Ja(b),0,a.c,b.a&63);Xa(a,O(b),a.c,b.a&63,M(b));if(Ia(b)){var d=a.c,c=2===N(b),e=R[d+(c?0:2)];Xa(a,3,d,e+(c?-2:3),e)}N(b)&4&&(d=b.a>>>19&7,c=a.c^1,e=Ka(b),s(a.a[d],e),s(a.a[6+c],e),a.f[e]=d,J(a.b,2+d+6*c+12*e))}
P.prototype.l=function(a){Za(this,a);var b=T(this);$a(this,a);return!b};function X(a,b){var d=a.b;a.k.push(new Fa(d.b,d.a));Za(a,b);if(T(a))return $a(a,b),a.k.pop(),!1;a.g.push(b);a.i.push(a.d);a.i.push(a.e);a.i.push(a.j);K(a.b,a.d);a.d=1===N(b)?b.a&63:-1;K(a.b,a.d);d=a.c;5===O(b)?(V(a,d,!0),V(a,d,!1)):3===O(b)&&(M(b)===R[d+0]?V(a,d,!0):M(b)===R[d+2]&&V(a,d,!1));d^=1;3===(b.a>>>19&7)&&(Ka(b)===R[d+0]?V(a,d,!0):Ka(b)===R[d+2]&&V(a,d,!1));N(b)&4||0===O(b)?a.j=0:++a.j;a.c=d;J(a.b,0);return!0}
function Y(a){if(a.g.length){var b=a.g.pop();a.c^=1;J(a.b,0);$a(a,b);a.i.pop();J(a.b,1538+a.e);a.e=a.i.pop();J(a.b,1538+a.e);K(a.b,a.d);a.d=a.i.pop();K(a.b,a.d);a.k.pop()}}P.prototype.h=function(){return this.g.map(function(a){return a.h().trim()}).join(" ")};function ab(a){a=a.replace(/[\r\n\t]/gm," ");for(a=a.replace(/[\u002D\u05BE\u1806\u2010\u2011\u2012\u2013\u2014\u2015\u207B\u208B\u2212\u2E3A\u2E3B\uFE58\uFE63\uFF0D]/g,"-");;){var b=a.replace(/\([^()]*\)/g,"");if(b===a)break;a=b}a=a.replace(/[^ a-z0-9.=:\u00BD-]/gi," ");return a=a.replace(/ +/g," ")}
function bb(a,b){var d=S(a),c=b.match(/0-0(?:-0)?|O-O(?:-O)?/i);if(c){var e=3===c[0].length?2:3;return d.filter(function(a){return N(a)===e})}if(c=b.match(/([NBRQK])?([a-h])?([1-8])?-?([x:])?([a-h])([1-8])?(?:[=(]([NBRQ]))?/)){var f=c[1],g=c[2],n=c[3],l=c[4],D=c[5],m=c[6],w=c[7];return d.filter(function(a){return void 0!==f&&" NBRQK"[O(a)]!==f||void 0===f&&0!==O(a)||void 0!==g&&"abcdefgh"[M(a)&7]!==g||void 0!==n&&"12345678"[M(a)>>>3]!==n||void 0!==l&&!(N(a)&4)||void 0!==D&&"abcdefgh"[a.a&7]!==D||
void 0!==m&&"12345678"[(a.a&63)>>>3]!==m||void 0!==w&&" NBRQK"[Ja(a)]!==w?!1:!0})}return null}function cb(a){var b=new P;ab(a).split(" ").every(function(a){if(a.match(/\d+\./))return!0;if(a.match(/1-0|0-1|\u00BD-\u00BD/))return!1;var c=bb(b,a);if(!c||1!==c.length)throw Error("Parse error in '"+a+"'");X(b,c[0]);return!0});return b};var db=[100,300,300,500,900,2E4],eb=[[0,0,0,0,0,0,0,0,50,50,50,50,50,50,50,50,10,10,20,30,30,20,10,10,5,5,10,25,25,10,5,5,0,0,0,20,20,0,0,0,5,-5,-10,0,0,-10,-5,5,5,10,10,-20,-20,10,10,5,0,0,0,0,0,0,0,0],[-50,-40,-30,-30,-30,-30,-40,-50,-40,-20,0,0,0,0,-20,-40,-30,0,10,15,15,10,0,-30,-30,5,15,20,20,15,5,-30,-30,0,15,20,20,15,0,-30,-30,5,10,15,15,10,5,-30,-40,-20,0,5,5,0,-20,-40,-50,-40,-30,-30,-30,-30,-40,-50],[-20,-10,-10,-10,-10,-10,-10,-20,-10,0,0,0,0,0,0,-10,-10,0,5,10,10,5,0,-10,-10,5,5,10,10,
5,5,-10,-10,0,10,10,10,10,0,-10,-10,10,10,10,10,10,10,-10,-10,5,0,0,0,0,5,-10,-20,-10,-10,-10,-10,-10,-10,-20],[0,0,0,0,0,0,0,0,5,10,10,10,10,10,10,5,-5,0,0,0,0,0,0,-5,-5,0,0,0,0,0,0,-5,-5,0,0,0,0,0,0,-5,-5,0,0,0,0,0,0,-5,-5,0,0,0,0,0,0,-5,0,0,0,5,5,0,0,0],[-20,-10,-10,-5,-5,-10,-10,-20,-10,0,0,0,0,0,0,-10,-10,0,5,5,5,5,0,-10,-5,0,5,5,5,5,0,-5,0,0,5,5,5,5,0,-5,-10,5,5,5,5,5,0,-10,-10,0,5,0,0,0,0,-10,-20,-10,-10,-5,-5,-10,-10,-20],[-30,-40,-40,-50,-50,-40,-40,-30,-30,-40,-40,-50,-50,-40,-40,-30,-30,
-40,-40,-50,-50,-40,-40,-30,-30,-40,-40,-50,-50,-40,-40,-30,-20,-30,-30,-40,-40,-30,-30,-20,-10,-20,-20,-20,-20,-20,-20,-10,20,20,0,0,0,0,20,20,20,30,10,0,0,10,30,20]],pb=nb[h]/2;function qb(a,b){for(var d=0,c=h;c<k;++c)d+=ia(Q(a,c,b))*nb[c];1<ia(Q(a,2,b))&&(d+=pb);return d}function rb(a,b){for(var d=0,c=h;c<=k;++c)for(var e=D(Q(a,c,b));!s(e);)var f=r(e),d=d+ob[c][b?f:56^f];return d}
function sb(a){function b(a){function b(a){var c=O(a)&4?(1+(a.a>>>19&7))/(1+P(a)):0,c=6*c+P(a),c=16*c+O(a),c=64*c+(a.a&63);return c=64*c+N(a)}a.sort(function(a,c){return b(c)-b(a)});return a}function d(a,c,g){if(100<=a.h||hb(a)||ib(a))return 0;var f=qb(a,n)-qb(a,1)+(rb(a,n)-rb(a,1));++e;var p=a.c===n;if(p){if(f>=g)return g;c=f>c?f:c}else{if(f<=c)return c;g=f<g?f:g}for(var f=b(T(a,!0,!U(a))),l=0;l<f.length;++l)if(X(a,f[l])){var m=d(a,c,g);Z(a);if(p){if(m>=g)return g;c=m>c?m:c}else{if(m<=c)return c;
g=m<g?m:g}}return p?c:g}function c(a,e,g,f){if(1>e)return d(a,g,f);for(var p=b(T(a,!0,!1)),l=a.c===n,m=!1,I=0;I<p.length;++I)if(X(a,p[I])){var m=!0,ga=c(a,e-1,g,f);Z(a);l?g=ga>g?ga:g:f=ga<f?ga:f;if(f<=g)break}if(!m){if(!U(a))return 0;a=nb[k];return l?-a:a}return 100<=a.h||hb(a)||ib(a)?0:l?g:f}for(var e=0,f=null,g=-Infinity,p=Infinity,l=b(T(a,!0)),I=0;I<l.length;++I)if(X(a,l[I])){var m=c(a,3,g,p);Z(a);a.c===n?m>g&&(g=m,f=l[I]):m<p&&(p=m,f=l[I])}return f};function tb(){this.a=new Za}
function vb(){var a=$("<table>"),b="<tr><th></th>"+"abcdefgh".split("").map(function(a){return'<th class="file">'+a+"</th>"}).join("")+"<th></th></tr>";a.append(b);for(var d=0;8>d;++d){var c=7-d,e=$("<tr>");a.append(e);var f='<th class="rank">'+(8-d)+"</th>";e.append(f);for(var g=0;8>g;++g){var p=$("<td>"),l=(c+g)%2?"light":"dark";p.attr("id",ba(c,g));p.attr("title","Algebraic: "+ba(c,g)+"\nRank: "+c+"\nFile: "+g+"\nIndex: "+(g+8*c)+"\nColor: "+l);p.addClass(l);e.append(p)}e.append(f)}a.append(b);$("#chessboard").append(a)}
function wb(){$("#chessboard table tr td, #chessboard table tr td div").removeClass("from to positional capture double-push en-passant promotion castle king-castle queen-castle")}function xb(){$("#chessboard table tr td div.ui-draggable").draggable("destroy");$("#chessboard table tr td.ui-droppable").droppable("destroy")}
function yb(a){var b=T(a.a);$("#moves").html('<a href="#" id="undo" class="'+(a.a.g.length?"can":"cannot")+'">undo</a><br/><a href="#" id="auto" class="'+(0<b.length?"can":"cannot")+'">auto</a><br/>'+b.map(function(a,b){return'<a href="#" id="'+b+'">'+(Wa(a)?"0-0"+(3===O(a)?"-0":""):" NBRQK".charAt(P(a))+q(N(a))+(O(a)&4?"x":"-")+q(a.a&63)+(5===O(a)?"e.p.":"")+(O(a)&8?" NBRQK".charAt(Xa(a)):""))+"</a><br/>"}).join(""));$("#chessboard table tr td, #chessboard table tr td div").removeClass("can-move");
b.forEach(function(a){a=$("#"+q(N(a)));a.add(a.children()).addClass("can-move")});var d=!1;$("#chessboard table tr td div.can-move").mouseenter(function(){if(!d){var c=$(this),e=c.parent(),f=ca(""+e.attr("id")),e=e.add(c);e.toggleClass("from",b.some(function(a){return N(a)===f}));e.hasClass("from")&&(b.forEach(function(a){if(N(a)===f){var b=$("#"+q(a.a&63)),b=b.add(b.children());b.addClass("to");b.addClass(O(a)===Ka?"positional":"");b.addClass(O(a)&4?"capture":"");b.addClass(1===O(a)?"double-push":
"");b.addClass(5===O(a)?"en-passant":"");b.addClass(O(a)&8?"promotion":"");b.addClass(Wa(a)?"castle":"");b.addClass(2===O(a)?"king-castle":"");b.addClass(3===O(a)?"queen-castle":"")}}),xb(),$("#chessboard table tr td.to").droppable({drop:function(){var c=ca(""+$(this).attr("id")),d=b.filter(function(a){return N(a)===f&&(a.a&63)===c});0<d.length?(X(a.a,d[0]),zb(a)):(wb(),xb())}}),c.draggable({start:function(){d=!0},stop:function(){d=!1},containment:"#chessboard table",zIndex:10,revert:"invalid"}))}}).mouseleave(function(){d||
wb()});$("#moves a").click(function(){var c=$(this).attr("id");"undo"===c?(Z(a.a),Z(a.a),zb(a)):"auto"===c?Ab(a):(X(a.a,b[parseInt(c,10)]),zb(a))})}
function Ab(a){$("#moves").html("");var b=$("#dim");b.fadeIn(function(){var d=sb(a.a);if(!d)throw Error("Move not found");X(a.a,d);var c=$("#"+q(N(d))),d=$("#"+q(d.a&63)),e=d.offset().left-c.offset().left,f=d.offset().top-c.offset().top,g=c.children("div");g.css({position:"relative",top:"0px",left:"0px"});b.fadeOut(function(){g.animate({top:f+"px",left:e+"px"},function(){zb(a)})})})}
function zb(a){wb();xb();$("#chessboard table tr td div").remove();$("#chessboard table tr td").removeClass("white black turn last-move "+aa.join(" "));for(var b=a.a.a[R+n],d=a.a.a[R+1],c=0;64>c;++c)for(var e=$("#"+q(c)),f=h;f<=k;++f)if(!v(a.a.a[f],c)){var g=a.a.c===n?!v(b,c):!v(d,c),p=$("<div>");p.attr("title",e.attr("title")+"\nPiece: "+aa[f]+"\nColor: "+(v(b,c)?"black":"white"));p.text("\u2659\u265f\u2658\u265e\u2657\u265d\u2656\u265c\u2655\u265b\u2654\u265a".charAt(2*f+(v(b,c)?1:n)));var l=p.add(e);
l.addClass(aa[f]);l.toggleClass("white",!v(b,c));l.toggleClass("black",!v(d,c));l.toggleClass("turn",g);e.append(p);break}b=a.a.g.length?a.a.g[a.a.g.length-1]:null;null!==b&&($("#"+q(N(b))).addClass("last-move"),$("#"+q(b.a&63)).addClass("last-move"));b=T(a.a).length?100<=a.a.h?3:hb(a.a)?4:ib(a.a)?5:0:U(a.a)?1:2;0===b&&1===a.a.c?Ab(a):(yb(a),$("#dim").css({display:"none"}),1===b?$("#moves").append("&#35;<br/>"+(a.a.c?"1-0":"0-1")):0!==b&&$("#moves").append("&frac12;-&frac12;"))};window.makeChessGame=function(){vb();zb(new tb)};})();
-40,-40,-50,-50,-40,-40,-30,-30,-40,-40,-50,-50,-40,-40,-30,-20,-30,-30,-40,-40,-30,-30,-20,-10,-20,-20,-20,-20,-20,-20,-10,20,20,0,0,0,0,20,20,20,30,10,0,0,10,30,20]],fb=db[0]/2;function gb(a,b){for(var d=0,c=0;5>c;++c)d+=k(Q(a,c,b))*db[c];1<k(Q(a,2,b))&&(d+=fb);return d}function hb(a,b){for(var d=0,c=0;5>=c;++c)for(var e=C(Q(a,c,b));!q(e);)var f=p(e),d=d+eb[c][b?f:56^f];return d}
function jb(a){function b(a){function b(a){var c=N(a)&4?(1+(a.a>>>19&7))/(1+O(a)):0,c=6*c+O(a),c=16*c+N(a),c=64*c+(a.a&63);return c=64*c+M(a)}a.sort(function(a,c){return b(c)-b(a)});return a}function d(a,c,g){if(Wa(a))return 0;var f,n;n=gb(a,0)-gb(a,1);f=hb(a,0)-hb(a,1);f=n+f;++e;if(n=0===a.c){if(f>=g)return g;c=f>c?f:c}else{if(f<=c)return c;g=f<g?f:g}f=b(S(a,!0,!T(a)));for(var l=0;l<f.length;++l)if(X(a,f[l])){var m=d(a,c,g);Y(a);if(n){if(m>=g)return g;c=m>c?m:c}else{if(m<=c)return c;g=m<g?m:g}}return n?
c:g}function c(a,e,g,f){if(1>e)return d(a,g,f);for(var n=b(S(a,!0,!1)),l=0===a.c,m=!1,D=0;D<n.length;++D)if(X(a,n[D])){var m=!0,ea=c(a,e-1,g,f);Y(a);l?g=ea>g?ea:g:f=ea<f?ea:f;if(f<=g)break}if(!m){if(!T(a))return 0;a=db[5];return l?-a:a}return Wa(a)?0:l?g:f}for(var e=0,f=null,g=-Infinity,n=Infinity,l=b(S(a,!0)),D=0;D<l.length;++D)if(X(a,l[D])){var m=c(a,3,g,n);Y(a);0===a.c?m>g&&(g=m,f=l[D]):m<n&&(n=m,f=l[D])}return f};function kb(){this.a=new P}
function lb(){var a=$("<table>"),b="<tr><th></th>"+"abcdefgh".split("").map(function(a){return'<th class="file">'+a+"</th>"}).join("")+"<th></th></tr>";a.append(b);for(var d=0;8>d;++d){var c=7-d,e=$("<tr>");a.append(e);var f='<th class="rank">'+(8-d)+"</th>";e.append(f);for(var g=0;8>g;++g){var n=$("<td>"),l=(c+g)%2?"light":"dark";n.attr("id",ba(c,g));n.attr("title","Algebraic: "+ba(c,g)+"\nRank: "+c+"\nFile: "+g+"\nIndex: "+(g+8*c)+"\nColor: "+l);n.addClass(l);e.append(n)}e.append(f)}a.append(b);$("#chessboard").append(a)}
function mb(){$("#chessboard table tr td, #chessboard table tr td div").removeClass("from to positional capture double-push en-passant promotion castle king-castle queen-castle")}function nb(){$("#chessboard table tr td div.ui-draggable").draggable("destroy");$("#chessboard table tr td.ui-droppable").droppable("destroy")}function ob(a,b){X(a.a,b);var d="#"+a.a.h().trim();1===a.a.c?window.history.pushState(null,b.h(),d):window.history.replaceState(null,b.h(),d)}
function pb(a){var b=S(a.a);$("#moves").html('<a href="#" id="undo" class="'+(a.a.g.length?"can":"cannot")+'">undo</a><br/><a href="#" id="auto" class="'+(0<b.length?"can":"cannot")+'">auto</a><br/>'+b.map(function(a,b){return'<a href="#" id="'+b+'">'+a.h()+"</a><br/>"}).join(""));$("#chessboard table tr td, #chessboard table tr td div").removeClass("can-move");b.forEach(function(a){a=$("#"+h(M(a)));a.add(a.children()).addClass("can-move")});var d=!1;$("#chessboard table tr td div.can-move").mouseenter(function(){if(!d){var c=
$(this),e=c.parent(),f=ca(""+e.attr("id")),e=e.add(c);e.toggleClass("from",b.some(function(a){return M(a)===f}));e.hasClass("from")&&(b.forEach(function(a){if(M(a)===f){var b=$("#"+h(a.a&63)),b=b.add(b.children());b.addClass("to");b.addClass(0===N(a)?"positional":"");b.addClass(N(a)&4?"capture":"");b.addClass(1===N(a)?"double-push":"");b.addClass(5===N(a)?"en-passant":"");b.addClass(N(a)&8?"promotion":"");b.addClass(Ia(a)?"castle":"");b.addClass(2===N(a)?"king-castle":"");b.addClass(3===N(a)?"queen-castle":
"")}}),nb(),$("#chessboard table tr td.to").droppable({drop:function(){var c=ca(""+$(this).attr("id")),d=b.filter(function(a){return M(a)===f&&(a.a&63)===c});0<d.length?(ob(a,d[0]),Z(a)):(mb(),nb())}}),c.draggable({start:function(){d=!0},stop:function(){d=!1},containment:"#chessboard table",zIndex:10,revert:"invalid"}))}}).mouseleave(function(){d||mb()});$("#moves a").click(function(){var c=$(this).attr("id");"undo"===c?(Y(a.a),Y(a.a),Z(a)):"auto"===c?qb(a):(ob(a,b[parseInt(c,10)]),Z(a))})}
function qb(a){$("#moves").html("");var b=$("#dim");b.fadeIn(function(){var d=jb(a.a);if(!d)throw Error("Move not found");ob(a,d);var c=$("#"+h(M(d))),d=$("#"+h(d.a&63)),e=d.offset().left-c.offset().left,f=d.offset().top-c.offset().top,g=c.children("div");g.css({position:"relative",top:"0px",left:"0px"});b.fadeOut(function(){g.animate({top:f+"px",left:e+"px"},function(){Z(a)})})})}
function Z(a){mb();nb();$("#chessboard table tr td div").remove();$("#chessboard table tr td").removeClass("white black turn last-move "+aa.join(" "));for(var b=a.a.a[6],d=a.a.a[7],c=0;64>c;++c)for(var e=$("#"+h(c)),f=0;5>=f;++f)if(!r(a.a.a[f],c)){var g=0===a.a.c?!r(b,c):!r(d,c),n=$("<div>");n.attr("title",e.attr("title")+"\nPiece: "+aa[f]+"\nColor: "+(r(b,c)?"black":"white"));n.text("\u2659\u265f\u2658\u265e\u2657\u265d\u2656\u265c\u2655\u265b\u2654\u265a".charAt(2*f+(r(b,c)?1:0)));var l=n.add(e);
l.addClass(aa[f]);l.toggleClass("white",!r(b,c));l.toggleClass("black",!r(d,c));l.toggleClass("turn",g);e.append(n);break}b=a.a;b=b.g.length?b.g[b.g.length-1]:null;null!==b&&($("#"+h(M(b))).addClass("last-move"),$("#"+h(b.a&63)).addClass("last-move"));b=a.a;b=S(b).length?100<=b.j?3:Ua(b)?4:Va(b)?5:0:T(b)?1:2;0===b&&1===a.a.c?qb(a):(pb(a),$("#dim").css({display:"none"}),1===b?$("#moves").append("&#35;<br/>"+(a.a.c?"1-0":"0-1")):0!==b&&$("#moves").append("&frac12;-&frac12;"))}
kb.prototype.b=function(){var a=window.location.href.split("#");this.a=1<a.length?cb(a[1]):new P;Z(this)};window.makeChessGame=function(){lb();var a=new kb;a.b();Z(a);window.onpopstate=a.b.bind(a)};})();

Loading…
Cancel
Save