In laboratory experiments, we manipulate the levels of niceness and reciprocity of seven simulated players in eight-person, iterated social dilemmas. Subjects rationally cooperate most frequently against nice, reciprocal players. However, subjects systematically deviate from optimal responses in intermediate environments that are either nice or reciprocal, but not both. The collective-action heuristic-a simple model of the subject's decision process based on introspection and surprise-driven search explains several observed asymmetries of behavior that have important implications for the evolution of cooperation and the theory of social capital: (1) On average, initial cooperators gain a cooperators' advantage over initial defectors due to defectors' inability to take advantage of reciprocal environments: (2) Past experience with reciprocity reduces exploitation even when reciprocity is currently absent, while past experience with nonreciprocity does not hamper cooperation when reciprocity is currently present: and (3) Institutions that punish noncooperation enhance cooperation by initial defectors, but reduce cooperation by initial cooperators.