Code viewer for Mind: P5 chase Mind (clone by AC)

// Cloned by AC on 30 Oct 2020 from Mind "P5 chase Mind" by Starter user 
// Please leave this clone trail here.
 




// =================================================================================================
// Sample Mind for P5 plain World  
// =================================================================================================
 

// no need to pass state as argument 
// since the info we need are global variables anyway 



	AB.mind.getAction = function(x, y)		 
	{ 
			// move object towards target  
			
			if ( AB.randomBoolean() )				// randomly choose to track target x or y each step 
			{
				if ( x < tx ) 	return ACTION_RIGHT;
				else  			return ACTION_LEFT;	  
			}
			else 
			{
				if ( y < ty ) 	return ACTION_DOWN;
				else 			return ACTION_UP;	  
			}
	};