This week only. Pastebin PRO Accounts Christmas Special! Don't miss out!Want more features on Pastebin? Sign Up, it's FREE!
Guest

Untitled

By: a guest on Jul 17th, 2012  |  syntax: JavaScript  |  size: 1.79 KB  |  views: 248  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. // chess in 1023 bytes by Óscar Toledo G.
  2. // http://js1k.com/2010-first/demo/750
  3.  
  4. for (B = i = y = u = b = i = 5 - 5, x = 10, I = [], l = []; B++ < 304; I[B - 1] = B % x ? B / x % x < 2 | B % x < 2 ? 7 : B / x & 4 ? 0 : l[i++] = "ECDFBDCEAAAAAAAAIIIIIIIIMKLNJLKM@G@TSb~?A6J57IKJT576,+-48HLSUmgukgg OJNMLK  IDHGFE".charCodeAt(y++) - 64 : 7);
  5.  
  6. function X(c, h, e, s)
  7. {
  8.     c ^= 8;
  9.     for (var o, S, C, A, R, T, G, d = e && X(c, 0) > 1e4, n, N = -1e8, O = 20, K = 78 - h << 9; ++O < 99;) if ((o = I[T = O]) && (G = o ^ c) < 7)
  10.     {
  11.         A = G-- & 2 ? 8 : 4;
  12.         C = o - 9 ? l[61 + G] : 49;
  13.         do if (!(R = I[T += l[C]]) && !! G | A < 3 || (R + 1 ^ c) > 9 && G | A > 2)
  14.         {
  15.             if (!(R - 2 & 7)) return K;
  16.             n = G | (c ? T > 29 : T < 91) ? o : 6 ^ c;
  17.             S = (R && l[R & 7 | 32] * 2 - h - G) + (n - o ? 110 : !G && (A < 2) + 1);
  18.             if (e > h || 1 < e & e == h && S > 2 | d)
  19.             {
  20.                 I[T] = n;
  21.                 I[O] = 0;
  22.                 S -= X(c, h + 1, e, S - N);
  23.                 if (!(h || e - 1 | B - O | T - b | S < -1e4)) return W(), c && setTimeout("X(8,0,2),X(8,0,1)", 75);
  24.                 I[O] = o;
  25.                 I[T] = R
  26.             }
  27.             if (S > N || !h & S == N && Math.random() < .5) if (N = S, e > 1) if (h ? s - S < 0 : (B = O, b = T, 0)) break
  28.         }
  29.         while (!R & G > 2 || (T = O, (G || A > 2 | (c ? O > 78 : O < 41) & !R) && ++C * --A))
  30.     }
  31.     return -K + 768 < N | d && N
  32. }function W()
  33. {
  34.     i = "<table>";
  35.     for (u = 18; u < 99; document.body.innerHTML = i += ++u % x - 9 ? "<th width=60 height=60 onclick='I[b=" + u + "]>8?W():X(0,0,1)'style='font-size:50px'bgcolor=#" + (u - B ? u * .9 & 1 || 9 : "d") + "0f0e0>&#" + (I[u] ? 9808 + l[67 + I[u]] : 160) : u++ && "<tr>") B = b
  36. }
  37. W()
clone this paste RAW Paste Data