Code viewer for Mind: P5 chase Mind (clone by Co...

// Cloned by Colin Duggan on 4 Oct 2021 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()		 
	{ 
			// 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;	  
			}
	};