// Cloned by Abdelshafa Abdala on 5 Nov 2022 from Mind "CA686: Practical 1 - Complex Mind - Stage 2 (Adding Movable Walls)" by Kieron
// Please leave this clone trail here.
// Cloned by Kieron on 26 Oct 2022 from Mind "Complex Mind (clone by Kieron)" by Kieron
// Please leave this clone trail here.
/*
Author: Kieron Drumm.
Student Number: 13314446.
Module: CA686 (Foundations of Artifical Intelligence).
Assignment: Practical 1.
Stage: Stage 1 (Modifying the enemy to use the A* algorithm when seeking out it's opponent).
*/
// Cloned by Kieron on 23 Oct 2022 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) {
var ai = x[0];
var aj = x[1];
var ei = x[2];
var ej = x[3];
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));
};