First cut at Q-learning implementation.