Code viewer for Mind: Cloned New Mind

// Cloned by John Griffin on 15 Nov 2018 from Mind "New Mind" by John Griffin 
// Please leave this clone trail here.
 
 
function Mind() 
{ 
	
	this.newRun = function()   //org func               
	{
	    
        const ACTION_LEFT       = 4;               
        const ACTION_RIGHT      = 3;
        const ACTION_UP         = 2;             
        const ACTION_DOWN       = 1;
        const ACTION_STAYSTILL  = 0;
        const BLOCKPUNISH       = 1;
        
        var ei, ej, ai, aj;
	};

    AB.clockTick = 20;    
    

    AB.maxSteps = 1000 ;        


    this.getAction = function ( ar )         
        { 
                var ai = ar[0];
                var aj = ar[1];
                var ei = ar[2];
                var ej = ar[3];         // ar = array of [ai, aj, ei, ej]

               

                 if (ej < aj)     return (AB.randomPick ( ACTION_UP, AB.randomPick(ACTION_RIGHT,ACTION_LEFT))); //moves up or left/right
                 if (ej > aj)     return (AB.randomPick ( ACTION_DOWN, AB.randomPick(ACTION_RIGHT,ACTION_LEFT))); //AB.random this returns a or b randomly
                 if (ei < ai)     return (AB.randomPick ( ACTION_RIGHT, AB.randomPick(ACTION_UP,ACTION_DOWN))); //moves right or up/down
                 if (ei > ai)     return (AB.randomPick ( ACTION_LEFT,  AB.randomPick(ACTION_UP,ACTION_DOWN)));
                 
         
                return  ( AB.randomIntAtoB (0,3) ); //returns a random int between these numbers 
        };        
                
	this.endRun = function() // org func                
	{
	    if (AB.step == 1000) return (score); 
	};
}