Added a Q-learning implementation that remembers both previous action and state.