codes for reinforcement learning