public TurnAction GetNextDirection(IList <TurnAction> movements, Location loc)
            {
                LocationsTracker.Push(loc);//Register location as visited

                if (movements.Count == 1)
                {
                    try
                    {
                        var now = MovementTool.Reverse(ActionTracker.Pop());
                        StepTracker.Push(new TrackedLocation(loc, now));
                        return(now);
                    }catch (Exception e)
                    {
                        var now = movements[0];
                        StepTracker.Push(new TrackedLocation(loc, now));
                        ActionTracker.Push(now);
                        return(now);
                    }
                }

                var trimHasBeen = movements.Where(s => !BeenToTarget(loc, s)).ToList();

                if (trimHasBeen.Count == 0)
                {
                    var now = MovementTool.Reverse(ActionTracker.Pop());
                    StepTracker.Push(new TrackedLocation(loc, now));
                    return(now);
                }


                TurnAction dirToGoBias;

                try
                {
                    dirToGoBias = MovementTool.Leftify(ActionTracker.Peek());
                }
                catch (Exception)
                {
                    dirToGoBias = movements[new Random().Next(movements.Count)];
                }

                var value = trimHasBeen.Contains(dirToGoBias)
                    ? dirToGoBias
                    : trimHasBeen[new Random().Next(trimHasBeen.Count)];

                StepTracker.Push(new TrackedLocation(loc, value));
                ActionTracker.Push(value);

                return(value);
            }
 public void RegisterMove(Location loc, bool isInter, TurnAction ac)
 {
     StepTracker.Push(new TrackedLocation(loc, ac));
     LocationsTracker.Push(loc);
     ActionTracker.Push(ac);
 }