News for hackers. Stuff that matters.
Re:This is a fully working chess program with graphics. In 1... by wensing on Monday September 06, 2010 @10:04AM (#1666675)
In case you don't take the time to have your mind blown, here's the source (1014 characters):

for(B=i=y=u=b=i=5-5,x=10,I=[],l=[];l[B]="ECDFBDCEAAAAAAAAIIIIIIIIMKLNJLKM@G@TSb~?A6J57IKJT576,+-48HLSUmgukgg OJNMLK IDHGFE".charCodeAt(B)-64,B++<120;I[B-1]=B%x?B/x%x<2|B%x<2?7:B/x&4?0:l[i++]:7);function X(c,h,e,s){e^=8;for(var o,S,C,A,R,T,G,n,N=-1e8,O=20;++O<99;)if((o=I[T=O])&&(G=o^e)<7){A=G--&2?8:4;C=o-9?l[61+G]:49;do if(!(R=I[T+=l[C]])&&!!G|A<3||(R+1^e)>9&&G|A>2){if(!(R-2&7))return 78-h<<x;n=G|(e?T>29:T<91)?o:6^e;S=(R&&l[R&7|32]-h-G)+(G?0:n-o?55:(A<2)+1);if(c>h||1<c&c==h&&S>2){I[T]=n;I[O]=0;S-=X(c,h+1,e,S-N);if(!(h||c-1|B-O|T-b|S<-1e4))return W(B=0),e&&setTimeout("X(2,0,8),X(1,0,8)",50);I[O]=o;I[T]=R}if(S>N||!h&S==N&&Math.random()<.5)if(N=S,c>1)if(h?s-S<0:(B=O,b=T,0))return S}while(!R&G>2||(T=O,(G||A>2|(e?O>78:O<41)&!R)&&++C--A))}return N}function W(){i="<table>";for(u=18;u<98;i+=++u%x-9?"<th width=60 height=60 onclick='I[b="+u+"]>8?W(B=b):X(1,0,0)'style='font-size:50px'bgcolor=#"+(u-B?u.9&1||9:"d")+"0f0e0>&#"+(I[u]?9808+l[67+I[u]]:160)+";":u++&&"<tr>");document.body.innerHTML=i+"</table>"}W();

Beautified:

   for (B = i = y = u = b = i = 5 - 5, x = 10, I = [], l = []; l[B] = "ECDFBDCEAAAAAAAAIIIIIIIIMKLNJLKM@G@TSb~?A6J57IKJT576,+-48HLSUmgukgg OJNMLK IDHGFE".charCodeAt(B) - 64, B++ < 120; I[B - 1] = B % x ? B / x % x < 2 | B % x < 2 ? 7 : B / x & 4 ? 0 : l[i++] : 7);
   
   function X(c, h, e, s) {
       e ^= 8;
       for (var o, S, C, A, R, T, G, n, N = -1e8, O = 20; ++O < 99;) if ((o = I[T = O]) && (G = o ^ e) < 7) {
           A = G-- & 2 ? 8 : 4;
           C = o - 9 ? l[61 + G] : 49;
           do
           if (!(R = I[T += l[C]]) && !! G | A < 3 || (R + 1 ^ e) > 9 && G | A > 2) {
               if (!(R - 2 & 7)) return 78 - h << x;
               n = G | (e ? T > 29 : T < 91) ? o : 6 ^ e;
               S = (R && l[R & 7 | 32] - h - G) + (G ? 0 : n - o ? 55 : (A < 2) + 1);
               if (c > h || 1 < c & c == h && S > 2) {
                   I[T] = n;
                   I[O] = 0;
                   S -= X(c, h + 1, e, S - N);
                   if (!(h || c - 1 | B - O | T - b | S < -1e4)) return W(B = 0), e && setTimeout("X(2,0,8),X(1,0,8)", 50);
                   I[O] = o;
                   I[T] = R
               }
               if (S > N || !h & S == N && Math.random() < .5) if (N = S, c > 1) if (h ? s - S < 0 : (B = O, b = T, 0)) return S
           }
           while (!R & G > 2 || (T = O, (G || A > 2 | (e ? O > 78 : O < 41) & !R) && ++C--A))
       }
       return N
   }
   function W() {
       i = "<table>";
       for (u = 18; u < 98; i += ++u % x - 9 ? "<th width=60 height=60 onclick='I[b=" + u + "]>8?W(B=b):X(1,0,0)'style='font-size:50px'bgcolor=#" + (u - B ? u.9 & 1 || 9 : "d") + "0f0e0>&#" + (I[u] ? 9808 + l[67 + I[u]] : 160) + ";" : u++ && "<tr>");
       document.body.innerHTML = i + "</table>"
   }
   W();
Re:This is a fully working chess program with graphics. In 1... by baby on Monday September 06, 2010 @10:15AM (#1666706)
if someone's wondering how he displays chess symbols that's how :

http://en.wikipedia.org/wiki/Chess_symbols_in_Unicode

ps : also it's better to beautifier the code to (try to) understand it :

http://jsbeautifier.org/

Re:This is a fully working chess program with graphics. In 1... by Torn on Monday September 06, 2010 @10:40AM (#1666752)
I'm getting empty character boxes instead of chess symbols, even if I force UTF-8 in Chrome or IE. Any ideas?
Re:This is a fully working chess program with graphics. In 1... by bd on Monday September 06, 2010 @11:18AM (#1666814)
Maybe some font problem? How do you see chess symbols in Wikipedia page?

It's possible to have missing or corrupted Unicode font (once my Arial got broken and I had to get it somewhere from the web).

Re:This is a fully working chess program with graphics. In 1... by baby on Tuesday September 07, 2010 @07:33AM (#1668602)
"once my Arial got broken".

funny sentence :D

Re:This is a fully working chess program with graphics. In 1... by gowiththeflow on Monday September 06, 2010 @01:51PM (#1667073)
Have you patched your uxtheme.dll and are using a custom .msstyle? I'm guessing the default font of your theme may have an impact.
Re:This is a fully working chess program with graphics. In 1... by superk on Monday September 06, 2010 @01:20PM (#1667021)
Extra points for the function call:

X(c, h, e, s)

Re:This is a fully working chess program with graphics. In 1... by euccastro on Monday September 06, 2010 @12:35PM (#1666938)
for(B=i=y=u=b=i=5-5, [...]

Is there a point in saying 5-5 instead of 0, other than wasting two characters for the fun of it?

Re:This is a fully working chess program with graphics. In 1... by palish on Monday September 06, 2010 @12:51PM (#1666974)
Probably because he wanted to keep 1-letter variable names, and 1024 is more interesting than 1022.
Re:This is a fully working chess program with graphics. In 1... by euccastro on Monday September 06, 2010 @01:44PM (#1667065)
It's 1014, though.
Re:This is a fully working chess program with graphics. In 1... by palish on Monday September 06, 2010 @03:05PM (#1667210)
Okay, then it was to pad the js file to 1024 bytes, because 1024 bytes is more interesting than 1014 bytes.
Re:This is a fully working chess program with graphics. In 1... by DougBTX on Monday September 06, 2010 @02:38PM (#1667149)
Also setting i twice, I'm not sure why.
Re:This is a fully working chess program with graphics. In 1... by bd on Monday September 06, 2010 @03:32PM (#1667252)
It seems the author likes to use variable names to encode messages:

- "Biyubi" looks like his nickname (on his chess site [1] contact mail is "[email protected]")

- there is also "o, S, C, A, R, T, G" which are his first name and surname initials

- and already mentioned "X(c, h, e, s)"

[1] http://nanochess.110mb.com/author.html

Re:This is a fully working chess program with graphics. In 1... by euccastro on Monday September 06, 2010 @03:25PM (#1667236)
Good catch, although that would be easier to discount as an oversight.

[Edit: sibling post explains it.]

Re:This is a fully working chess program with graphics. In 1... by jpwagner on Monday September 06, 2010 @01:22PM (#1667027)
would you mind re-pasting the beautified code from the locally saved source? there are characters missing in the pasted blob (notice the italics.)
Re:This is a fully working chess program with graphics. In 1... by sandipagr on Monday September 06, 2010 @02:01PM (#1667089)
If only I could understand what is going on in the code...the variable names make my head explode :(
Re:This is a fully working chess program with graphics. In 1... by pfreet on Monday September 06, 2010 @01:44PM (#1667064)
Not a very good one :-) I just got to checkmate in 6 moves!