Code viewer for Mind: Complex Mind (clone by OmO...

// Cloned by OmO on 6 Nov 2020 from Mind "Complex Mind (clone by OmO)" by OmO 
// Please leave this clone trail here.
 


// Cloned by OmO on 4 Nov 2020 from Mind "Complex Mind" by Starter user 
// Please leave this clone trail here.
 



// =================================================================================================
// Sample Mind for more complex starter World  
// =================================================================================================

// World tells us agent position and enemy position
// World does not tell us of existence of walls
// if return invalid move (not empty square) World just ignores it and we miss a turn 


 

	AB.mind.getAction = function ( x )		// x is an array of [ ai, aj, ei, ej ]
	{ 
		var ai = x[0];
		var aj = x[1];
		var ay = x[2];
		var ei = x[3];
		var ej = x[4];
		var ey = x[5];
        
        
		// if strictly move away, will get stuck at wall, so introduce randomness 

		 if ( ej < aj ) 	return ( AB.randomPick ( ACTION_UP,		AB.randomPick(ACTION_RIGHT,ACTION_LEFT,ACTION_Y_DOWN,ACTION_Y_UP) 	)); 
		 if ( ej > aj ) 	return ( AB.randomPick ( ACTION_DOWN,	AB.randomPick(ACTION_RIGHT,ACTION_LEFT,ACTION_Y_UP,ACTION_Y_DOWN) 	)); 
		 
		 if ( ey > ay ) 	return ( AB.randomPick ( ACTION_Y_UP,	AB.randomPick(ACTION_UP,ACTION_DOWN,ACTION_RIGHT,ACTION_LEFT) 		)); 
		 if ( ey < ay ) 	return ( AB.randomPick ( ACTION_Y_DOWN,	AB.randomPick(ACTION_UP,ACTION_DOWN,ACTION_RIGHT,ACTION_LEFT) 		)); 

		 if ( ei < ai ) 	return ( AB.randomPick ( ACTION_RIGHT,	AB.randomPick(ACTION_UP,ACTION_DOWN,ACTION_Y_UP,ACTION_Y_DOWN) 		)); 
		 if ( ei > ai ) 	return ( AB.randomPick ( ACTION_LEFT,	AB.randomPick(ACTION_UP,ACTION_DOWN,ACTION_Y_UP,ACTION_Y_DOWN) 		)); 
		 

 		return  ( AB.randomIntAtoB (0,3) );
	};