dirty implementation for q-learning