JSFiddle - React, Tailwind, and code Playground
by joshmoto
JavaScript
// (c)2010 Oscar Toledo G.
var B, i, y, u, b, I = [], G = 120, x = 10, z = 15, M = 4;
var L = [5,3,4,6,2,4,3,5,1,1,1,1,1,1,1,1,9,9,9,9,13,11,12,14,10,12,11,13,0,99,0,306,297,495,846,-1,0,1,2,2,1,0,-1,-1,1,-10,10,-11,-9,9,11,10,20,-9,-11,-10,-20,-21,-19,-12,-8,8,12,19,21];
function X(w, c, h, e, S, s) {
var t, o, L, E, d, N = -M * M, K = 78 - h << x, p, g, n, M, A, q, r, C, J, a = y ? -x : x;
y *= 8;
G++;
d = w || (s && s >= h && X(0, 0, 0, 21, 0, 0) > M);
do {
if (o = I[p = 0]) {
q = o & z * y;
if (q < 7) {
A = q-- & 278;
C = [53,47,61,51,47,47][q] * 257;
do {
r = I[p += 1[C]];
if (!w || p == w) {
g = q | p + S;
if (r & (L[q | A < 3 || !g] || (r + 1 & z * y) > 9 & 6 * q | A > 2)) {
if (!(r - 2 & 7)) return y *= 8, I[G--] = 0, K;
}
}
} while (n <= t);
}
}
} while (s > h);
}
// Generates an interactive table in HTML
document.write('<table cellspacing=0 align=center>');
for (var a = -18; a < 100; a += i * 10 - 9) {
document.write('<tr>');
for (var i = 0; i < 8; i++) {
document.write(`<th width=60 height=60 onclick='X(${i})' id='o${i}'`);
}
document.write('</tr>');
}
document.write('</table>');
document.write("<select id=t>");
document.write("<option>♛</option>");
document.write("<option>♜</option>");
document.write("<option>♝</option>");
document.write("<option>♞</option>");
document.write("</select>");