In recent weeks my plate has been full as I plan for a big move. When I get stressed I usually play a game of chess to help relax a bit. Last night I took a different approach. I created my own brain teaser. I haven’t played golf with the following code yet, so the code isn’t optimized and it could be greatly reduced. The code is in pure javascript, no libraries, but it does require a decent javascript engine to handle forEach, map etc. Sorry IE.
(function() { var r = function(a) { if (a == undefined) return t; isNaN(a) ? (function(){ t = [a.match(/.{5}/g).map(function(p) { return parseInt(p, 33).toString(10); }).join('').match(/.{6}/g).map(function(p) { return parseInt(p, 7).toString(17); }).join('').match(/.{4}/g).reverse().map(function(p) { var a = p.split(''); return a[1] + a[3] + a[0] + a[2]; }).join('')].map(function(p) { var a = p.match(/.{2}/g); a.forEach(function(c, i) { b[i % 3].push(c); }); return b[2].join('') + b[0].join('') + b[1].join(''); })[0].match(/.{2}/g).map(function(p) { var x = p.split(''); return String.fromCharCode(parseInt(x[1] + x[0], 17).toString(10)); }).join(''); })() : (function(){ d = a.toString().split(''); l = d.length; p = t.split(''); if (l == 3) { d.forEach(function(i) { p.push(p[i]); }); t = p.join(''); } else { t = d.map(function(i){ return p[i];}).join('') + p.join(''); } })(); return arguments.callee; }, t = '', a, p, b = [[], [], []],c,i,d,l; return r; })()('sbuq1iunojjo8q7')(165)(12)();