Code viewer for Mind: sloyand2 ProjectMind
 
function Mind() 
{ 
	
	this.newRun = function()                  
	{
	};


	this.getAction = function ( state )		 
	{ 
	  return ( 0 );		 		
	};

		 
	this.endRun = function()                 
	{
	};

}

function Mind()
{
    this.getAction = function(x)
    {
        var ai = x[0]
        var aj = x[1]
        var ei = x[2]
        var ej = x[3]
        
        if (ej < aj && aj - ej > 3) return (AB.randomPick(AB.randomPick(ACTION_DOWN,ACTION_UP), AB.randomPick(ACTION_RIGHT,ACTION_LEFT)));
        if (ej < aj && aj - ej < 3) return (AB.randomPick(ACTION_UP, AB.randomPick(ACTION_RIGHT,ACTION_LEFT)));
        if (ej > aj && aj - ej < 3) return (AB.randomPick(ACTION_DOWN, AB.randomPick(ACTION_RIGHT,ACTION_LEFT)));
        if (ej > aj && aj - ej > 3) return (AB.randomPick(AB.randomPick(ACTION_DOWN,ACTION_UP), AB.randomPick(ACTION_RIGHT,ACTION_LEFT)));
        
        if (ei < ai && ai - ei > 3) return (AB.randomPick(AB.randomPick(ACTION_RIGHT,ACTION_LEFT), AB.randomPick(ACTION_UP,ACTION_DOWN)));
        if (ei < ai && ai - ei < 3) return (AB.randomPick(ACTION_RIGHT, AB.randomPick(ACTION_UP,ACTION_DOWN)));
        if (ei > ai && ai - ei > 3) return (AB.randomPick(ACTION_LEFT, AB.randomPick(ACTION_UP,ACTION_DOWN)));
        if (ei > ai && ai - ei < 3) return (AB.randomPick(AB.randomPick(ACTION_RIGHT,ACTION_LEFT), AB.randomPick(ACTION_UP,ACTION_DOWN)));
       
        
        return (AB.randomIntAtoB(0,3))
    }
}