// Cloned by Mohamad Sheikh Sharaf on 5 Dec 2022 from Mind "Expo Mind" by Test account
// Please leave this clone trail here.
// Mind has to make decision based on partial state x
// x tells us agent position and enemy position
// does not tell us of existence of walls
// if return invalid move (not empty square) World just ignores it and we miss a turn
function Mind()
{
this.getAction = function ( x ) // x is an array of [ ai, aj, ei, ej ]
{
var ai = x[0];
var aj = x[1];
var ei = x[2];
var ej = x[3];
if ( AB.randomBoolean() )
{
if ( ej < aj ) return ( ACTION_UP );
if ( ej > aj ) return ( ACTION_DOWN );
if ( ei < ai ) return ( ACTION_RIGHT );
if ( ei > ai ) return ( ACTION_LEFT );
}
else
return ( AB.randomIntAtoB (0,3) );
};
}