Learning to play nice with others