Code viewer for Mind: CA318 Project

// Cloned by Ethan Harkin on 5 Nov 2018 from World "CA318 2018 World" by test  
// Please leave this clone trail here.




function Mind()
{ 
	
	this.newRun = function()                  
	{
	};


	this.getAction = function ( x )		 
	{ 
	  var ai = x[0];
	  var aj = x[1];
	  var ei = x[2];
	  var ej = x[3];
	  
	  
	  //AB.randomPick(ACTION_UP, ACTION_DOWN)
	  //AB.randomPick(ACTION_RIGHT, ACTION_LEFT)
	  
	  //AGENT LEFT
	  if (ai < ei && ei-ai < 6) return (AB.randomPick(ACTION_LEFT, AB.randomPick(ACTION_UP, ACTION_DOWN)));
	  
	  //AGENT RIGHT
	  if (ai > ei && ai-ei < 6) return (AB.randomPick(ACTION_RIGHT, AB.randomPick(ACTION_UP, ACTION_DOWN)));
	  
	  //AGENT ABOVE
	  if (aj > ej && aj-ej < 6) return (AB.randomPick(ACTION_UP, AB.randomPick(ACTION_RIGHT, ACTION_LEFT)));
	  
	  //AGENT BELOW
	  if (aj < ej && ej-aj < 6) return (AB.randomPick(ACTION_DOWN, AB.randomPick(ACTION_RIGHT, ACTION_LEFT)));
	  
	  return ( AB.randomIntAtoB ( 0, 4 ) );		 		
	};

		 
	this.endRun = function()                 
	{
	};

}