implemented basic qlearning functions