JSFiddle - React, Tailwind, and code Playground

by konijn_gmail_com

HTML

<html>
  <head>
    <!--  -->
    <title>Mevarick</title>
    <style>
      body {background-color:black; color:white; white-space:pre; font-family:monospace; text-align:center }
    </style>
  </head>
  <body>
  <div id="screen">
 </div>
</body>
</html>

JavaScript

/*********************************************************
* 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;
   ...