Code viewer for Mind: New Mind
   
	
function Mind() 
{   
    
   
	this.newRun = function()                  
	{
        
         const TEXTURE_WALL = "/uploads/starter/earth.1.jpg";
         var   loader       = new THREE.TextureLoader();
 
       	var loader1 = new THREE.TextureLoader();
	var loader2 = new THREE.TextureLoader();
	var loader3 = new THREE.TextureLoader();
	var loader4 = new THREE.TextureLoader();
	
	loader1.load ( TEXTURE_WALL, function ( thetexture )  		
	{
		thetexture.minFilter  = THREE.LinearFilter;
		wall_texture = thetexture;
		if ( asynchFinished() )	initScene();		// if all file loads have returned 
	});
		
	loader2.load ( TEXTURE_AGENT, function ( thetexture )  	 
	{
		thetexture.minFilter  = THREE.LinearFilter;
		agent_texture = thetexture;
		if ( asynchFinished() )	initScene();		 
	});	
	
	loader3.load ( TEXTURE_ENEMY, function ( thetexture )  
	{
		thetexture.minFilter  = THREE.LinearFilter;
		enemy_texture = thetexture;
		if ( asynchFinished() )	initScene();		 
	});
	
	loader4.load ( TEXTURE_MAZE, function ( thetexture )  
	{
		thetexture.minFilter  = THREE.LinearFilter;
		maze_texture = thetexture;
		if ( asynchFinished() )	initScene();		 
	});
        

	}

	this.getAction = function ( state )
	{ 
	    var ax = state[0];               
        var ay = state[1];
        var ex = state[2];             
        var ey = state[3];

        //if ( stuckfor > 2 ) return  ( AB.randomIntAtoB (0,3) );
        
        if (AB.randomBoolean())

	    { 
	        
	        if ( ey < ay && ex == ax) return  (ACTION_UP, ACTION_RIGHT, ACTION_LEFT );
           // if (ey == ax ) return (ACTION_UP, ACTION_DOWN, ACTION_RIGHT, ACTION_LEFT ); 
            if ( ey > ay && ex == ax) return (ACTION_DOWN,ACTION_RIGHT, ACTION_LEFT );
            

            if ( ex < ax) return (ACTION_RIGHT);
          //  if ( ex == ay ) return (ACTION_UP, ACTION_DOWN, ACTION_RIGHT, ACTION_LEFT );; 
            if ( ex > ax ) return (ACTION_LEFT);
        
	    }
	    
	    return  (AB.randomIntAtoB(0,3));
	}



		 
	this.endRun = function()                 
	{
	};

}