// Cloned by cam on 11 Nov 2018 from Mind "Deliverable For Week 7&8" by cam
// Please leave this clone trail here.
function Mind()
{
this.newRun = function()
{
};
this.getAction = function ( x )
{
var grinch_x_coord = x[0];
var grinch_y_coord = x[1];
var present_x_coord = x[2];
var present_y_coord = x[3];
// if strictly move away, will get stuck at (invisible) wall, so introduce randomness
// basically wherever the grinch is, we randomly pick another direction to run in
// the problem is, I can't work out how to detect walls or the blocks...
// I think if I made an if statement making sure I'm not in space 0 or 18 that would detect walls..?
if ( present_x_coord < grinch_x_coord ) return ( AB.randomPick ( ACTION_RIGHT, AB.randomPick3 ( ACTION_LEFT, ACTION_UP, ACTION_DOWN ) ));
if ( present_x_coord > grinch_x_coord ) return ( AB.randomPick ( ACTION_LEFT, AB.randomPick3 ( ACTION_RIGHT, ACTION_UP, ACTION_DOWN ) ));
if ( present_y_coord < grinch_y_coord ) return ( AB.randomPick ( ACTION_UP, AB.randomPick3 ( ACTION_DOWN, ACTION_RIGHT, ACTION_LEFT ) ));
if ( present_y_coord > grinch_y_coord ) return ( AB.randomPick ( ACTION_DOWN, AB.randomPick3 ( ACTION_UP, ACTION_RIGHT, ACTION_LEFT ) ));
return ( AB.randomIntAtoB (0,3) );
};
this.endRun = function()
{
};
}