Code viewer for Mind: New Mind
 
function Mind() 
{ 
	
	this.newRun = function()                  
	{
	};


	this.getAction = function(x)
	{ 
	  var allyx = x[0];          // player x coordinate
	  var allyy = x[1];         // player y coordinate
	  var enemyx = x[2];     // enemy x coordinate
	  var enemyy = x[3];     // enemy y coordinate
	  
	  if((allyx-2 <= enemyx) || (allyy-2 <= enemyy)) return (AB.randomPick(ACTION_RIGHT, ACTION_DOWN));
	
	  if((allyx+2 <= enemyx) || (allyy+2 <= enemyy)) return (AB.randomPick(ACTION_LEFT, ACTION_UP));
	 
	  
	  if((allyx-2 <= enemyy) && (allyy-2 <= enemyx)) return (AB.randomPick(ACTION_RIGHT,ACTION_DOWN));
      if((allyx+2 <= enemyy) && (allyy+2 <= enemyx)) return (AB.randomPick(ACTION_LEFT,ACTION_UP));
	  
	  return ( AB.randomIntAtoB(0,3));		 		
	};

		 
	this.endRun = function()                 
	{
	};

}