From 969c4898a01755f5af1b7741c48d938167ee6c5e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kaj=20Bj=C3=B6rklund?= Date: Mon, 11 Nov 2013 22:19:58 +0200 Subject: [PATCH] Remove logging --- chess.min.js | 59 +++++++++++++++++++++++++--------------------------- src/ai.js | 1 - src/ui.js | 8 ------- 3 files changed, 28 insertions(+), 40 deletions(-) diff --git a/chess.min.js b/chess.min.js index 905bb1a..e3be797 100644 --- a/chess.min.js +++ b/chess.min.js @@ -1,32 +1,29 @@ -(function(){'use strict';var h=0,k=5,p=0,ba="pawn knight bishop rook queen king".split(" ");function ca(a,b){return"abcdefgh"[b]+"12345678"[a]}function da(a){return"abcdefgh".indexOf(a[0])+8*"12345678".indexOf(a[1])}function q(a){return ca(a>>>3,a&7)};function ea(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 r(a){return fa(a.a)+fa(a.b)}function ia(a){return a.a?ha(a.a):32+ha(a.b)}function s(a){var b=ia(a);a.a?a.a=ga(a.a):a.b=ga(a.b);return b}function t(a){return!a.a&&!a.b}function v(a,b){b>>>=0;return 32>b?!(a.a&1<>>=0;32>b?a.a=(a.a|1<>>0:a.b=(a.b|1<>>0;return a}function ka(a,b){b>>>=0;32>b?a.a=(a.a&~(1<>>0:a.b=(a.b&~(1<>>0}function y(a,b){a.a=(a.a&b.a)>>>0;a.b=(a.b&b.b)>>>0;return a}function A(a,b){a.a=(a.a&~b.a)>>>0;a.b=(a.b&~b.b)>>>0;return a}function B(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 na(a){a.a=~a.a>>>0;a.b=~a.b>>>0;return a} -function C(a,b){b>>>=0;31>>0,a.a=0):0>>32-b)>>>0,a.a=a.a<>>0);return a}function D(a,b){b>>>=0;31>>b-32,a.b=0):0>>b|a.b<<32-b)>>>0,a.b>>>=b);return a}function E(a,b){63b?a.a=a.b=0:0b&&D(a,-b);return a}function oa(a,b){return a.a===b.a&&a.b===b.b}function F(a){return H(a.a,a.b)}function H(a,b){return new ea(a,b)}function I(a){return w(H(0,0),a)} -function pa(){var a=qa;return E(y(H(270549120,16909320),E(H(4294967295,4294967295),8*a)),a)}function ra(){var a=sa;return E(y(H(134480385,2151686160),E(H(4294967295,4294967295),8*-a)),a)}function ta(){var a=w(H(0,0),ua),b=A(D(F(a),1),J[7]),c=A(A(D(F(a),2),J[7]),J[6]),d=A(C(F(a),1),J[0]),a=A(A(C(F(a),2),J[0]),J[1]),c=B(c,a),b=B(b,d);return B(B(B(C(F(c),8),D(c,8)),C(F(b),16)),D(b,16))} -function va(){var a=w(H(0,0),wa),b=B(A(D(F(a),1),J[7]),A(C(F(a),1),J[0])),c=D(B(F(a),b),8),a=C(B(F(a),b),8);return B(B(b,c),a)}for(var xa=H(4294967295,4294967295),ya=H(1437226410,1437226410),za=H(2857740885,2857740885),Aa=[],Ba=0;8>Ba;++Ba)Aa.push(C(H(16843009,16843009),Ba));for(var J=Aa,K=[],Ca=0;8>Ca;++Ca)K.push(C(H(255,0),8*Ca));for(var Da=[],qa=-7;8>qa;++qa)Da.push(pa());for(var Ea=[],sa=-7;8>sa;++sa)Ea.push(ra());for(var Fa=[],ua=0;64>ua;++ua)Fa.push(ta());for(var Ga=[],wa=0;64>wa;++wa)Ga.push(va());function Ha(a,b){this.b=a>>>0;this.a=b>>>0}for(var Ia=[],Ja=0;1586>Ja;++Ja)Ia.push(1+4294967295*Math.random()>>>0);function L(a,b){a.b=(a.b^Ia[b])>>>0;a.a=(a.a^Ia[b+1])>>>0}function N(a,b){0<=b&&L(a,1570+(b&7))};function Ka(a,b,c,d,e){this.a=b&63|(a&63)<<6|(c&15)<<12|(d&7)<<16|((e|0)&7)<<19}var La=0,Ma=4,Na=8,Oa=9,Pa=10,Qa=11,Ra=12,Sa=13,Ta=14,Ua=15;function O(a){return a.a>>>6&63}function P(a){return a.a>>>12&15}function Q(a){return a.a>>>16&7}function Va(a){return 2===P(a)||3===P(a)}function Wa(a){return P(a)&8?1+(P(a)&3):h}function Xa(a){return 5!==P(a)?a.a&63:(a.a&63)+(O(a)<(a.a&63)?-8:8)} -function Ya(a){return Va(a)?"0-0"+(3===P(a)?"-0":""):" NBRQK".charAt(Q(a))+q(O(a))+(P(a)&4?"x":"-")+q(a.a&63)+(5===P(a)?"e.p.":"")+(P(a)&8?" NBRQK".charAt(Wa(a)):"")};function ab(){this.b=new Ha(0,0);this.a=[B(F(K[1]),K[6]),B(B(B(I(1),I(6)),I(57)),I(62)),B(B(B(I(2),I(5)),I(58)),I(61)),B(B(B(I(0),I(7)),I(56)),I(63)),B(I(3),I(59)),B(I(4),I(60)),B(F(K[0]),K[1]),B(F(K[6]),K[7])];this.f=[];this.c=p;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 Ha(0,0);this.c&&L(this.b,0);for(a=p;1>=a;++a)for(b=h;b<=k;++b)for(var c=this.b,d=b,e=a,f=R(this,b,a), -f=F(f);!t(f);){var g=s(f);L(c,2+d+6*e+12*g)}L(this.b,1538+this.e);N(this.b,this.d);this.j=[]}var S=k+1,bb=S+1,T=[7,63,0,56],cb=[na(C(H(16843009,16843009),7)),xa,na(C(H(16843009,16843009),0))];function U(a,b,c){c=db(a,!!c);return b?c:c.filter(ab.prototype.k,a)}function R(a,b,c){return y(F(a.a[b]),a.a[S+c])}function V(a){return B(F(a.a[S]),a.a[bb])}function W(a){return eb(a,a.c^1,ia(R(a,k,a.c)))}function fb(a,b){var c=a===p,d=E(A(F(b),J[0]),c?7:-9),c=E(A(F(b),J[7]),c?9:-7);return B(d,c)} -function X(a,b,c,d){var e=H(0,0);c=8*c+d;d=cb[1+d];for(E(a,c);!t(y(a,d));E(A(a,b),c))B(e,a);return e}function gb(a,b){return B(B(B(X(F(a),b,1,1),X(F(a),b,1,-1)),X(F(a),b,-1,1)),X(F(a),b,-1,-1))}function hb(a,b){return B(B(B(X(F(a),b,0,1),X(F(a),b,0,-1)),X(F(a),b,1,0)),X(F(a),b,-1,0))} -function eb(a,b,c){var d=R(a,h,b);if(ja(fb(b,d),c))return!0;d=R(a,1,b);if(!t(y(F(Fa[c]),d)))return!0;d=R(a,k,b);if(!t(y(F(Ga[c]),d)))return!0;var d=V(a),e=R(a,4,b),f=B(F(R(a,2,b)),e);if(ja(gb(f,d),c))return!0;a=B(F(R(a,3,b)),e);return ja(hb(a,d),c)?!0:!1}function Y(a,b,c){L(a.b,1538+a.e);a.e&=~(1<r(a.a[S+p])+r(a.a[S+1]))return!0;if(!t(a.a[1]))return!1;a=a.a[2];return oa(y(F(a),ya),a)||oa(y(F(a),za),a)?!0:!1} -function db(a,b){function c(a,b,c){for(;!t(a);){var d=s(a);f.push(new Ka(d-b,d,c,h,z.f[d]))}}function d(a,b,d){c(F(a),b,d?Ua:Qa);c(F(a),b,d?Ta:Pa);c(F(a),b,d?Sa:Oa);c(F(a),b,d?Ra:Na)}function e(a,b,c){for(;!t(b);){var d=s(b);v(yb,d)&&f.push(new Ka(a,d,v(m,d)?La:Ma,c,z.f[d]))}}var f=[],g=a.c,m=a.a[S+(g^1)],l=V(a),z=a,n=1-2*g,G=8*n,x=R(a,h,g),u=K[g?0:7];if(!b){var M=A(A(E(y(F(x),K[g?6:1]),2*G),l),E(F(l),G));c(M,2*G,1);M=A(E(F(x),G),l);c(A(F(M),u),G,La);d(y(F(M),u),G,!1)}var Za=J[g?7:0],M=G-n,aa=y(E(A(F(x), -Za),M),m);c(A(F(aa),u),M,Ma);d(y(F(aa),u),M,!0);var aa=J[g?0:7],G=G+n,$a=y(E(A(F(x),aa),G),m);c(A(F($a),u),G,Ma);d(y(F($a),u),G,!0);0<=a.d&&(u=E(A(y(I(a.d+n),x),Za),M),c(u,M,5),n=E(A(y(I(a.d-n),x),aa),G),c(n,G,5));for(var yb=a.a[S+g],n=b?m:xa,x=F(R(a,1,g));!t(x);)u=s(x),e(u,y(F(Fa[u]),n),1);for(x=F(R(a,4,g));!t(x);)u=s(x),e(u,y(B(gb(I(u),l),hb(I(u),l)),n),4);for(x=F(R(a,2,g));!t(x);)u=s(x),e(u,y(gb(I(u),l),n),2);for(x=F(R(a,3,g));!t(x);)u=s(x),e(u,y(hb(I(u),l),n),3);l=ia(R(a,k,g));e(l,y(F(Ga[l]), -n),k);b||(ib(a,g,!0)&&f.push(new Ka(l,l+2,2,k,null)),ib(a,g,!1)&&f.push(new Ka(l,l-2,3,k,null)));return f}function lb(a,b,c,d,e){var f=B(I(d),I(e));la(a.a[b],f);la(a.a[S+c],f);a.f[d]=null;a.f[e]=b;L(a.b,2+b+6*c+12*d);L(a.b,2+b+6*c+12*e)}function mb(a,b,c,d,e){ka(a.a[b],e);w(a.a[c],e);a.f[e]=c;L(a.b,2+b+6*d+12*e);L(a.b,2+c+6*d+12*e)} -function nb(a,b){if(P(b)&4){var c=b.a>>>19&7,d=a.c^1,e=Xa(b);ka(a.a[c],e);ka(a.a[S+d],e);a.f[e]=null;L(a.b,2+c+6*d+12*e)}Va(b)&&(c=a.c,d=2===P(b),e=T[c+(d?0:2)],lb(a,3,c,e,e+(d?-2:3)));lb(a,Q(b),a.c,O(b),b.a&63);P(b)&8&&mb(a,h,Wa(b),a.c,b.a&63)}function ob(a,b){P(b)&8&&mb(a,Wa(b),h,a.c,b.a&63);lb(a,Q(b),a.c,b.a&63,O(b));if(Va(b)){var c=a.c,d=2===P(b),e=T[c+(d?0:2)];lb(a,3,c,e+(d?-2:3),e)}P(b)&4&&(c=b.a>>>19&7,d=a.c^1,e=Xa(b),w(a.a[c],e),w(a.a[S+d],e),a.f[e]=c,L(a.b,2+c+6*d+12*e))} -ab.prototype.k=function(a){nb(this,a);var b=W(this);ob(this,a);return!b};function Z(a,b){a.j.push(new Ha(a.b.b,a.b.a));nb(a,b);if(W(a))return ob(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);N(a.b,a.d);a.d=1===P(b)?b.a&63:-1;N(a.b,a.d);var c=a.c;Q(b)===k?(Y(a,c,!0),Y(a,c,!1)):3===Q(b)&&(O(b)===T[c+0]?Y(a,c,!0):O(b)===T[c+2]&&Y(a,c,!1));c^=1;3===(b.a>>>19&7)&&(Xa(b)===T[c+0]?Y(a,c,!0):Xa(b)===T[c+2]&&Y(a,c,!1));P(b)&4||Q(b)===h?a.h=0:++a.h;a.c=c;L(a.b,0);return!0} -function pb(a){if(a.g.length){var b=a.g.pop();a.c^=1;L(a.b,0);ob(a,b);a.i.pop();L(a.b,1538+a.e);a.e=a.i.pop();L(a.b,1538+a.e);N(a.b,a.d);a.d=a.i.pop();N(a.b,a.d);a.j.pop()}};var qb=[100,300,300,500,900,2E4],rb=[[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 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<>>=0;32>b?a.a=(a.a|1<>>0:a.b=(a.b|1<>>0;return a}function ka(a,b){b>>>=0;32>b?a.a=(a.a&~(1<>>0:a.b=(a.b&~(1<>>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>>0,a.a=0):0>>32-b)>>>0,a.a=a.a<>>0);return a}function B(a,b){b>>>=0;31>>b-32,a.b=0):0>>b|a.b<<32-b)>>>0,a.b>>>=b);return a}function C(a,b){63b?a.a=a.b=0:0b&&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<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, 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]],sb=qb[h]/2;function tb(a,b){for(var c=0,d=h;d>>19&7))/(1+Q(a)):0,c=6*c+Q(a),c=16*c+P(a),c=64*c+(a.a&63);return c=64*c+O(a)}a.sort(function(a,c){return b(c)-b(a)});return a}function c(a,d,g){if(100<=a.h||jb(a)||kb(a))return 0;var f=tb(a,p)-tb(a,1)+(ub(a,p)-ub(a,1));++e;var m=a.c===p;if(m){if(f>=g)return g;d=f>d?f:d}else{if(f<=d)return d;g=f=g)return g;d=n>d?n:d}else{if(n<=d)return d; -g=ng)return c(a,e,f);for(var m=b(U(a,!0,!1)),l=a.c===p,n=!1,z=0;ze?ma:e:f=mag&&(g=n,f=l[z]):n"),b=""+"abcdefgh".split("").map(function(a){return''+a+""}).join("")+"";a.append(b);for(var c=0;8>c;++c){var d=7-c,e=$("");a.append(e);var f=''+(8-c)+"";e.append(f);for(var g=0;8>g;++g){var m=$(""),l=(d+g)%2?"light":"dark";m.attr("id",ca(d,g));m.attr("title","Algebraic: "+ca(d,g)+"\nRank: "+d+"\nFile: "+g+"\nIndex: "+(g+8*d)+"\nColor: "+l);m.addClass(l);e.append(m)}e.append(f)}a.append(b);$("#chessboard").append(a)} -function Ab(){$("#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 Bb(){$("#chessboard table tr td div.ui-draggable").draggable("destroy");$("#chessboard table tr td.ui-droppable").droppable("destroy")} -function Cb(a){var b=U(a.a);$("#moves").html('undo
auto
'+b.map(function(a,b){return''+Ya(a)+"
"}).join(""));$("#chessboard table tr td, #chessboard table tr td div").removeClass("can-move");b.forEach(function(a){a=$("#"+q(O(a)));a.add(a.children()).addClass("can-move")});var c=!1;$("#chessboard table tr td div.can-move").mouseenter(function(){if(!c){var d= -$(this),e=d.parent(),f=da(""+e.attr("id")),e=e.add(d);e.toggleClass("from",b.some(function(a){return O(a)===f}));e.hasClass("from")&&(b.forEach(function(a){if(O(a)===f){var b=$("#"+q(a.a&63)),b=b.add(b.children());b.addClass("to");b.addClass(P(a)===La?"positional":"");b.addClass(P(a)&4?"capture":"");b.addClass(1===P(a)?"double-push":"");b.addClass(5===P(a)?"en-passant":"");b.addClass(P(a)&8?"promotion":"");b.addClass(Va(a)?"castle":"");b.addClass(2===P(a)?"king-castle":"");b.addClass(3===P(a)?"queen-castle": -"")}}),Bb(),$("#chessboard table tr td.to").droppable({drop:function(){var c=da(""+$(this).attr("id")),d=b.filter(function(a){return O(a)===f&&(a.a&63)===c});0d;++d)for(var e=$("#"+q(d)),f=h;f<=k;++f)if(!v(a.a.a[f],d)){var g=a.a.c===p?!v(b, -d):!v(c,d),m=$("
");m.attr("title",e.attr("title")+"\nPiece: "+ba[f]+"\nColor: "+(v(b,d)?"black":"white"));m.text("\u2659\u265f\u2658\u265e\u2657\u265d\u2656\u265c\u2655\u265b\u2654\u265a".charAt(2*f+(v(b,d)?1:p)));var l=m.add(e);l.addClass(ba[f]);l.toggleClass("white",!v(b,d));l.toggleClass("black",!v(c,d));l.toggleClass("turn",g);e.append(m);break}b=a.a.g.length?a.a.g[a.a.g.length-1]:null;null!==b&&($("#"+q(O(b))).addClass("last-move"),$("#"+q(b.a&63)).addClass("last-move"));b=U(a.a).length? -100<=a.a.h?3:jb(a.a)?4:kb(a.a)?5:0:W(a.a)?1:2;0===b&&1===a.a.c?Eb(a):(Cb(a),$("#dim").css({display:"none"}),1===b?$("#moves").append("#
"+(a.a.c?"1-0":"0-1")):0!==b&&$("#moves").append("½-½"))};window.makeChessGame=function(){zb();Db(new xb)};})(); +-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>>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)return g;c=m>c?m:c}else{if(m<=c)return c; +g=me)return d(a,g,f);for(var p=b(T(a,!0,!1)),l=a.c===n,m=!1,I=0;Ig?ga:g:f=gag&&(g=m,f=l[I]):m"),b=""+"abcdefgh".split("").map(function(a){return''+a+""}).join("")+"";a.append(b);for(var d=0;8>d;++d){var c=7-d,e=$("");a.append(e);var f=''+(8-d)+"";e.append(f);for(var g=0;8>g;++g){var p=$(""),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('undo
auto
'+b.map(function(a,b){return''+(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)):""))+"
"}).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});0c;++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=$("
");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("#
"+(a.a.c?"1-0":"0-1")):0!==b&&$("#moves").append("½-½"))};window.makeChessGame=function(){vb();zb(new tb)};})(); diff --git a/src/ai.js b/src/ai.js index bb51a33..3d3f580 100644 --- a/src/ai.js +++ b/src/ai.js @@ -395,6 +395,5 @@ Chess.AI.prototype.search = function(chessPosition) { } } - window.console.log("Evaluations: " + evaluations + ", result move: " + bestMove.getString() + ", alpha: " + alpha + ", beta: " + beta); return bestMove; }; diff --git a/src/ui.js b/src/ui.js index 1b53852..9c41e78 100644 --- a/src/ui.js +++ b/src/ui.js @@ -284,14 +284,6 @@ Chess.UI.prototype.doComputerMove = function() { * Updates the chessboard according to the current chess position */ Chess.UI.prototype.updateChessPosition = function() { - window.console.log("Moves: " + this.chessPosition.getMadeMoveCount() + - ", white material: " + Chess.AI.getMaterialValue(this.chessPosition, Chess.PieceColor.WHITE) + - ", black material: " + Chess.AI.getMaterialValue(this.chessPosition, Chess.PieceColor.BLACK) + - ", white mobility: " + Chess.AI.getMobilityValue(this.chessPosition, Chess.PieceColor.WHITE) + - ", black mobility: " + Chess.AI.getMobilityValue(this.chessPosition, Chess.PieceColor.BLACK) + - ", white location: " + Chess.AI.getPieceSquareValue(this.chessPosition, Chess.PieceColor.WHITE) + - ", black location: " + Chess.AI.getPieceSquareValue(this.chessPosition, Chess.PieceColor.BLACK)); - Chess.UI.clearMoving(); Chess.UI.clearDragging(); this.updatePieces();