Code viewer for Mind: Mind tutorial

// Cloned by Mathias Bazin on 13 Aug 2018 from Mind "New Mind" by Mathias Bazin 
// Please leave this clone trail here.
 
 
function Mind() 
{ 
	
	this.newRun = function()                  
	{
	};


	this.getAction = function ( state )		 
	{ 
	    console.log(state);  
	    let a = new THREE.Vector3(state.agentx, 0 , state.agentz);
	    let c = new THREE.Vector3(state.coinx, 0 , state.coinz);
	    
	    let direction = new THREE.Vector3().subVectors(c, a);
	    if (Math.abs(direction.x) > Math.abs(direction.z))
	    {
	        if (direction.x > 0 ) return actionEnum.right;
	        else return actionEnum.left;
	    }
	    else
	    {
	        if (direction.z > 0 ) return actionEnum.down;
	        else return actionEnum.up;
	    }
	};

		 
	this.endRun = function()                 
	{
	};

}