Code viewer for Mind: Cloned Cloned New Mind

// Cloned by nolanm45 on 6 Nov 2018 from Mind "Cloned New Mind" by nolanm45 
// Please leave this clone trail here.
 


// Cloned by nolanm45 on 5 Nov 2018 from Mind "New Mind" by nolanm45 
// Please leave this clone trail here.
 
 
function Mind() 
{ 
	
	this.newRun = function()                  
	{
	};

function randomPick ( a, b )
{
 if ( randomBoolean() ) 
  return a;
 else
  return b;
    }

	this.getAction = function ( state )		 
	{ 
	    var ai = x[0];
                var aj = x[1];
                var ei = x[2];
                var ej = x[3];

                //if strictly move away, will get stuck at wall, so introduce randomness 

                if ( ej < aj )  return ( randomPick ( ACTION_UP,        randomPick(ACTION_RIGHT,ACTION_LEFT)    )); 
                if ( ej > aj )  return ( randomPick ( ACTION_DOWN,      randomPick(ACTION_RIGHT,ACTION_LEFT)    )); 

                if ( ei < ai )  return ( randomPick ( ACTION_RIGHT,     randomPick(ACTION_UP,ACTION_DOWN)               )); 
                if ( ei > ai )  return ( randomPick ( ACTION_LEFT,      randomPick(ACTION_UP,ACTION_DOWN)               )); 

                return  ( randomintAtoB (0,3) );
};

		 
	this.endRun = function()                 
	{
	};

}