Code viewer for Mind: Mind_M (uses left and right)


function Mind_1() { 


//--- public functions / interface / API ----------------------------------------------------------


        this.newRun = function()
        {
        };


        this.getAction = function ( x )         // x is an array of [ ai, aj, ei, ej ]
        { 
         return  ( 0 );         // Ignore enemy. Just move randomly 
        };


        this.endRun = function()
        {
        };


}


function Mind_2() { 


//--- public functions / interface / API ----------------------------------------------------------


        this.newRun = function()
        {
        };


        this.getAction = function ( x )         // x is an array of [ ai, aj, ei, ej ]
        { 
         return  ( 1 );         // Ignore enemy. Just move randomly 
        };


        this.endRun = function()
        {
        };


}


function Mind() { 

  var m1 = new Mind_1();
  var m2 = new Mind_2();

	
	this.newRun = function()
	{  
	    m1.newRun();
        m2.newRun();
	};


	this.getAction = function ( state )		// State format is defined by each World.
	{ 
	    if ( randomBoolean()      )
	        return  ( m1.getAction(state) );                   
        else 
            return  ( m2.getAction(state) );    
	};


	this.endRun = function()
	{
	};

}