// Cloned by cahillrock on 5 Nov 2018 from Mind "New Mind" by cahillrock
// Please leave this clone trail here.
function Mind()
{
this.getAction = function ( x ) // x is an array of [ ai, aj, ei, ej ]
{
var ai = x[0]; // AI IS X COORDS. AI=AI-1 IS LEFT AI=AI+1 IS RIGHT
var aj = x[1]; // AJ IS Y COORDS.
var ei = x[2];
var ej = x[3];
// if strictly move away, will get stuck at wall, so introduce randomness
//return(ACTION_UP);
if ( ej < aj ) return ( AB.randomPick ( ACTION_UP, AB.randomPick(ACTION_RIGHT,ACTION_LEFT) ));
if ( ej > aj ) return ( AB.randomPick ( ACTION_DOWN, AB.randomPick(ACTION_RIGHT,ACTION_LEFT) ));
if ( ei < ai ) return ( AB.randomPick ( ACTION_RIGHT, AB.randomPick(ACTION_UP,ACTION_DOWN) ));
if ( ei > ai ) return ( AB.randomPick ( ACTION_LEFT, AB.randomPick(ACTION_UP,ACTION_DOWN) ));
return ( AB.randomIntAtoB (0,3) );
};
}