// Cloned by Quinc3y on 15 Nov 2018 from Mind "New Mind" by Quinc3y
// Please leave this clone trail here.
function Mind()
{
this.newRun = function(x)
{
};
this.getAction = function ( x )
{
ai = x[0];
aj = x[1];
ei = x[2];
ej = x[3];
var distan = AB.distance2D(ai,aj,ei,ej);
if (distan < Math.floor(gridsize/2)) {
if (ai < ei && aj < ej){
return(ACTION_DOWN,ACTION_LEFT);
}
if(ai < ei && aj > ej){
return(ACTION_UP,ACTION_LEFT);
}
else if (ai > ei && aj < ej) {
return(ACTION_DOWN,ACTION_RIGHT);
}
else if (ai > ei && aj > ej) {
return(ACTION_UP,ACTION_RIGHT);
}
else if(ai == ei && aj < ej){
return(ACTION_DOWN,AB.randomIntAtoB(0,1));
}
else if(ai == ei && aj > ej){
return (ACTION_UP,AB.randomIntAtoB(0,1));
}
else if(aj == ej && ai > ei){
return (ACTION_RIGHT,AB.randomIntAtoB(2,3));
}
else if(aj == ej && ai > ei){
return (ACTION_LEFT,AB.randomIntAtoB(2,3));
}
return(AB.randomIntAtoB (0,3));
}
};
this.endRun = function()
{
};
}