/*********************************************************
* All sources in Mevarick are Copyright (c) by Konijn *
* I Konijn, release all code and data under the terms of *
* of the GNU General Public License (version 2), as well *
* as under the traditional Angband license. Distribution *
* is allowed both under the terms of the GPL (version 2) *
* or under the terms of the traditional Angband license. *
* *
* Exception: Alea code got borrowed from rot.js *
* Disclaimer: you would have to be crazy to re-use this! *
*********************************************************/
//Global constants
hack="";
//Protype magic
Array.prototype.shuffle = function()
{
var out = [] , tmp = this , idx;
while( tmp.length )
{
out.push( tmp[idx = floor(tmp.length * random())] );
tmp = tmp.slice( 0 , idx ).concat( tmp.slice( idx + 1 ) );
}
return out;
}
Array.prototype.random = function()
{
return this[ floor(this.length * random() ) ]
}
Array.prototype.each = function(f)
{
for( var i = 0 ; i < this.length ; i++)
f(this[i],this);
}
Object.prototype.merge = function(bag)
{
for(var key in bag)
if(bag.hasOwnProperty(key))
this[key] = bag[key]
}
//Silly magic
var a = Object.getOwnPropertyNames(Math);
for( var key in a ) this[a[key]] = Math[a[key]];
//global secret sauce helpers
function Args( o )
{
if ( !(this instanceof Args) )
return new Args(o);
var s = o.callee.toString();
var keys = s.slice(s.indexOf('(')+1, s.indexOf(')')).match(/([^\s,]+)/g);
for( var i = 0 ; i < keys.length ; i ++ )
this[keys[i]] = o[i];
}
/* Alea
random = Alea.seed(123).random; Hijacked from rot.js */
Alea =
{
_frac: 2.3283064365386963e-10, /* 2^-32 */
seed: function(seed) {
this._s0 = ((seed||new Date().getTime()) >>> 0) * this._frac;
this._s1 = (seed = (seed*69069 + 1) >>> 0) * this._frac;
...
Please Whitelist JSFiddle in your content blocker.
Help keep JSFiddle free for always by one of two ways:
Whitelist JSFiddle in your content blocker (two clicks)
Go PRO and get access to additional PRO features →
Join the 4+ million users, and keep the JSFiddle dream alive.
Ad-free
All ads in the editor and listing pages are turned completely off.
Use pre-released features
You get to try and use features (like the Palette Color Generator) months before everyone else.
Fiddle collections
Sort and categorize your Fiddles into multiple collections.
Private collections and fiddles
You can make as many Private Fiddles, and Private Collections as you wish!
Console
Debug your Fiddle with a minimal built-in JavaScript console.