Code viewer for Mind: Cloned New Mind
// Cloned by Odhran Byrne-Gildea on 7 Nov 2018 from Mind "New Mind" by Odhran Byrne-Gildea 
// Please leave this clone trail here.
 
 
function Mind() 
{ 
    var counter = 1;
	var moves = [ACTION_UP,ACTION_RIGHT,ACTION_DOWN,ACTION_LEFT];
	this.newRun = function()                  
	{
	        console.log("Game Start!")
	};

		 
	this.endRun = function()                 
	{
	    console.log("game emded")
	};




this.getAction = function ( x )		// x is an array of [ theagent.position.x, theagent.position.z, theenemy.position.x, theenemy.position.z ]
	{ 
		var ai = x[0];
		var aj = x[1];
		var ei = x[2];
		var ej = x[3];

		// if strictly move away, will get stuck at (invisible) wall, so introduce randomness 
		
		 if ( ei < ai-1 ) 	return ( AB.randomPick ( ACTION_RIGHT,	AB.randomPick3 ( ACTION_LEFT, 	ACTION_UP, ACTION_DOWN ) 		)); 
		 if ( ei > ai+1 ) 	return ( AB.randomPick ( ACTION_LEFT,	AB.randomPick3 ( ACTION_RIGHT, 	ACTION_UP, ACTION_DOWN ) 		)); 

		 if ( ej < aj-1 ) 	return ( AB.randomPick ( ACTION_UP,		AB.randomPick3 ( ACTION_DOWN,	ACTION_RIGHT, ACTION_LEFT ) 	)); 
		 if ( ej > aj+1 ) 	return ( AB.randomPick ( ACTION_DOWN,	AB.randomPick3 ( ACTION_UP, 	ACTION_RIGHT, ACTION_LEFT ) 	)); 


 		return  ( AB.randomIntAtoB (0,3) );
	};
	
}