implementing QLearning simulation