Code viewer for Mind: Big Brain
 
function Mind() 
{ 

	this.newRun = function(World)                  
	{
	    
	    //Description: This method is called in the beginning of each simulation, 
	    //it is the best place to set and reset the inner variables of this Mind object.
	    
	};
//const ACTION_LEFT                       = 0;               
//const ACTION_RIGHT                      = 1;
//const ACTION_UP                         = 2;             
//const ACTION_DOWN                       = 3;
//const ACTION_STAYSTILL                   = 4;

//grid blank = 0, grid wall = 1, gridmaze = 2
    
	this.getAction = function ( state )//there would have to be if statements here depending on 
	{
	 this.pos1x = state[0];
	 this.pos1y = state[1];
	 this.pos2x = state[2];
	 this.pos2y = state[3];
	 //var object=new World();
	 //object.occupied(4,4);
    if ( AB.randomBoolean() )
    {
        if (this.pos2y < this.pos1y)
        {
            if(this.pos1x == this.compy)
            {
                console.log(this.compx, this.pos1x)
                return Math.floor(Math.random() * 4);
            }
            this.compy = this.pos1y; //compare
            return (2);
        }
        if ( this.pos2y > this.pos1y )
        {
            if(this.pos1y == this.compy)
            {
                console.log(this.compy, this.pos1x)
                return Math.floor(Math.random() * 4);
            }
            this.compy = this.pos1y
            return (3);
        }
    }
    else
    {
        if ( this.pos2x < this.pos1x )
        {
            if(this.pos1x == this.compx)
            {
                console.log(this.compx, this.pos1x)
                return Math.floor(Math.random() * 4);
            }
            this.compx = this.pos1x
            return (1); 
        }
        if ( this.pos2x > this.pos1x ) 
        {
            if(this.pos1x == this.compx)
            {
                console.log(this.compx, this.pos1x)
                return Math.floor(Math.random() * 4);
            }
            this.compx = this.pos1x
            return (0);
        }
    }

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

	 
	 
	 
	 
	 
	 
	 
	 
	 
	 
	 
	 /*
	 if(this.position1x > this.position2x) 
	    {
	        if(this.position1x > 16)
	        {
	            return 0
	        }
	        return 1;
	    }
	 else if(this.position1x < this.position2x)
	    {
	        if(this.position1x < 3)
	        {
	            return 1
	        }
	        return 0;
	    }
	 else if(this.position1y < this.position2y) //go down
	    {
	        if(this.position1x < 3)
	        {
	            return 2; //2 is up
	        }
	        return 3;
	    }
	 else if(this.position1y > this.position2y) //go up
	    {
	        if(this.position1x > 16)
	        {
	            return 3   //3 is down
	        }
	        return 2;
	    }
	 // move towards agent 
    /*
    // after n failed moves, start making random moves 
    if ( stuckfor > 2 ) return  ( AB.randomIntAtoB (0,3) );


    if ( AB.randomBoolean() )
    {
     if ( ej < aj )     return (   ACTION_UP );           pos2y < pos1y
         if ( ej > aj )         return (   ACTION_DOWN ); pos2y < pos1y
    }
    else
    {
         if ( ei < ai )         return (   ACTION_RIGHT ); pos2x < pos1x
         if ( ei > ai )         return (   ACTION_LEFT );  pos2x > pos1x
    }

        return  ( AB.randomIntAtoB (0,3) );*/

		 
	this.endRun = function()                 
	{
	    
	    //Description: This method is called in the end of each simulation.
	    
	};

}