// Cloned by Noel Hendrick on 28 Nov 2020 from Mind "Complex Mind (clone by Noel Hendrick)" by Noel Hendrick
// Please leave this clone trail here.
// Cloned by Noel Hendrick on 23 Nov 2020 from Mind "Complex Mind" by Starter user
// Please leave this clone trail here.
// =================================================================================================
// Sample Mind for more complex starter World
// =================================================================================================
// World tells us agent position and enemy position
// World does not tell us of existence of walls
// if return invalid move (not empty square) World just ignores it and we miss a turn
AB.mind.getAction = function ( x ) // x is an array of [ ai, aj, ei, ej ]
{
var agenti = x[0];
var agentj = x[1];
var enemyi = x[2];
var enemyj = x[3];
// if strictly move away, will get stuck at wall, so introduce randomness
if ( enemyj < agentj ) return ( AB.randomPick ( ACTION_UP, AB.randomPick(ACTION_RIGHT,ACTION_LEFT) ));
if ( enemyj > agentj ) return ( AB.randomPick ( ACTION_DOWN, AB.randomPick(ACTION_RIGHT,ACTION_LEFT) ));
if ( enemyi < agenti ) return ( AB.randomPick ( ACTION_RIGHT, AB.randomPick(ACTION_UP,ACTION_DOWN) ));
if ( enemyi > agenti ) return ( AB.randomPick ( ACTION_LEFT, AB.randomPick(ACTION_UP,ACTION_DOWN) ));
return ( AB.randomIntAtoB (0,3) );
};