Code viewer for Mind: Circle_Random_mind

// Cloned by Eoin McLaughlin on 19 Nov 2018 from Mind "Circle_mind" by Eoin McLaughlin 
// Please leave this clone trail here.
 


// Cloned by Eoin McLaughlin on 12 Nov 2018 from Mind "random_mind" by Eoin McLaughlin 
// Please leave this clone trail here.
 
 
function Mind() 
{ 
    this.distance = function(ob1, obj2)
    {
    }
	
	this.newRun = function()                  
	{
	    this.base_rotation = 1
	    this.direction = 0
	    this.previous_Position = [0, 0]
	    this.a = [0, 2, 1, 3]
	    this.ticker = 0
	    
	};


	this.getAction = function ( state )		 
	{
	    console.log(this.ticker)
	    if (this.ticker > 10)
	      {
	          this.ticker = 0
	          x = Math.random()
	          x *=4
	          x = Math.floor(x)
	          console.log(x)
	          return x
	      }
	    current_Enemy_Position = [state[2], state[3]]
	    current_Agent_Position = [state[0], state[1]]
	   
	   if ((state[0] === this.previous_Position[0] && state[1] === this.previous_Position[1]))
	   {
	       var tmp 
	       tmp = this.direction
	       while (this.direction === tmp)
	       {
	           this.direction = Math.random();
               this.direction *= 4; //(5)
               this.direction = Math.floor(this.direction);
	       }
	   }


	   

       this.previous_Position = [state[0], state[1]]
	   return this.a[this.direction]
	};

		 
	this.endRun = function()                 
	{
	};

}