Updated Q-Learning to newAdvanced
Capped distance to reduce complexity