Code viewer for Mind: New Mind for CA318

// Cloned by Santiago on 6 Nov 2018 from Mind "New Mind" by Santiago 
// Please leave this clone trail here.
 

/*
 var enemyX,enemyY,lastpos_turn=[-1,-1,-1,-1],forbidden=[];
 
 function Mind()
 
 {
     var e,n;
     
        this.newRun=function(){
            
        },
        
        this.getAction=function(o)
        
        {
            for(var s in e=o[0],n=o[1],e==lastpos_turn[0]&&n==lastpos_turn[1]&&forbidden.push([lastpos_turn[2],lastpos_turn[3]]),enemyX=o[2],enemyY=o[3],possible=newMoves(e,n),possible)in_multi_dimenstion_array(possible[s],forbidden)&&(console.log("oooh thats forbidden"),possible[s]=[enemyX,enemyY,-1]);return possible=possible.sort(compare_moves),console.log(""+possible),bestTurn=possible[possible.length-1],lastpos_turn=[e,n,bestTurn[0],bestTurn[1]],bestTurn[2]},this.endRun=function(){}}function newMoves(e,n){var o=[];return o.push([e-1,n,0]),o.push([e+1,n,1]),o.push([e,n+1,2]),o.push([e,n-1,3]),o}function value(e,n,o){var s=Math.pow(e[0]-n,2)+Math.pow(e[1]-o,2);return s=Math.sqrt(s)}function compare_moves(e,n){return move1_v=value(e,enemyX,enemyY),move2_v=value(n,enemyX,enemyY),move1_v<move2_v?-1:move1_v==move2_v?0:1}function filter_forbidden(e){}function in_multi_dimenstion_array(e,n){for(var o in n)if(n[o][0]==e[0]&&n[o][1]==e[1])return!0;return!1}
*/
 
 

function Mind() 

{
	
	this.newRun = function()                  
	
	{
	    };

    this.getAction = function(n) {
        
        console.log(n);
        
        
        
    
        
        if (n.stuckfor > 1)
            return AB.randomIntAtoB(0, 3);
            
        if (AB.randomBoolean()) {
            
            if (n[0] >= n[2])
                return 1;
                
            if (n[1] >= n[3])
                return 2
        } 
        
        else {
            
            if (n[0] <= n[2])
                return 0;
                
            if (n[1] <= n[3])
                return 3
        }
        
        return AB.randomIntAtoB(0, 3)
        
    };
    
    
        


	this.endRun = function()                 
	
	{
	    };

}