Natural selection favours the strong and selfish who maximize their own resources at the expense of others. But many biological systems, and especially human societies, are organized around altruistic, cooperative interactions. How can natural selection promote unselfish behaviour? Various mechanisms have been proposed including kin selection, group selection and reciprocal altruism. The latter is traditionally formulated as direct reciprocity: I help you and you help me. More recently, a rich analysis of indirect reciprocity has emerged: I help you and somebody else helps me. Direct reciprocity relies on ones own experience in past encounters, whereas indirect reciprocity also uses the experience of others. The evolution of cooperation by indirect reciprocity leads to reputation building, morality judgement and complex social interactions with ever increasing cognitive demands.