Cooperation and Reputation Dynamics with Reinforcement Learning