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


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

		 
	this.endRun = function()                 
	{
	};

}