function Mind() { this.getAction = function(level) { var enX = level[2] var enY = level[3] var plX = level[0] var plY = level[1] console.log("Enemy Location: X:", enX, "Y:", enY) console.log("Player Location: X:", plX, "Y:", plY) if (AB.randomBoolean()){ if (plX >= enX) { return ACTION_RIGHT; } else{ return ACTION_LEFT; } if (plY >= enY) { return ACTION_UP; } else{ return ACTION_DOWN; } } return AB.randomIntAtoB(0, 3); }; }