// Cloned by Joe Rathborne on 18 Nov 2018 from Mind "New Mind" by Joe Rathborne
// Please leave this clone trail here.
function Mind()
{
this.getAction = function ( state )
{
var ai = state[0];
var aj = state[1];
var ei = state[2];
var ej = state[3];
// if strictly move away, will get stuck at wall, so introduce randomness
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) );
};
}