Before revision:  Here we show the emergence of generosity in a resource-gathering-and-sharing gameinspired by animal behavior .
After revision:  Here we show the emergence of generosity in a Markov game, which couples the resource sharing between two players with the gathering task of that resource. At variance with the classical evolutionary models for cooperation, the optimal strategies of this game can be potentially learned by animals during their life-time .