Code viewer for Mind: Cloned Simple Mind

// Cloned by earlyd2 on 5 Nov 2018 from Mind "Simple Mind" by Starter user 
// Please leave this clone trail here.
 



// ==== Starter Mind ===============================================================================================
// (c) Ancient Brain Ltd. All rights reserved.
// This code is only for use on the Ancient Brain site.
// This code may be freely copied and edited by anyone on the Ancient Brain site.
// This code may not be copied, re-published or used on any other website.
// To include a run of this code on another website, see the "Embed code" links provided on the Ancient Brain site.
// ==================================================================================================================



// =================================================================================================
// Sample Mind for simple 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 


 


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];

	

		if ( ej < aj  && ei < ai){
		        return (ACTION_UP, ACTION_RIGHT);
		    }
		    else if( ej < aj  && ei > ai){
		        return (ACTION_UP,ACTION_LEFT);
		    }
		    else if( ej > aj  && ei < ai){
		        return (ACTION_DOWN,ACTION_RIGHT);
		    }
		    else if( ej > aj  && ei > ai){
		        return (ACTION_DOWN,ACTION_LEFT);
		    }
		    else if(ej < aj){
		        return(ACTION_UP,AB.randomPick(ACTION_LEFT,ACTION_RIGHT));
		    }
		    else if(ej > aj){
		        return(ACTION_DOWN,AB.randomPick(ACTION_LEFT,ACTION_RIGHT));
		    }
		    else if(ei < ai){
		        return(ACTION_RIGHT,AB.randomPick(ACTION_UP,ACTION_DOWN));
		    }
		    else if(ei > ai){
		        return(ACTION_LEFT,AB.randomPick(ACTION_UP,ACTION_DOWN));
		    }
		    else{
		        return ( AB.randomPick(ACTION_UP,ACTION_DOWN,ACTION_RIGHT,ACTION_LEFT));
		    }
	};

		 
	this.endRun = function()                 
	{
	};

}
}