A one dimensional cellular automata model, describing the evolutionary dynamics of cooperation when grouping by cooperators provides protection against predation, is used to compare the dynamics of evolution of cooperation in three settings: in G only vertical transmission of information is allowed, as an analogy of genetic evolution with heredity; in H only horizontal information transfer is simulated through diffusion of the majority's opinion, as an analogy of opinion dynamics or social learning, and in C, the analogy of cultural evolution, information is transmitted both horizontally (H) and vertically (V) as learned behavior is transmitted to offspring. Our results show that the evolutionary prevalence of cooperative behavior depends on the costs and benefits of cooperation so that: a) cooperation becomes the dominant behavior, even in the presence of free-riders (i.e., non-cooperators obtain benefits from the cooperation of others), under all scenarios, if the benefits of cooperation compensate for its cost; b) G is more susceptible to selection pressure than H achieving a closer adaptation to the fitness landscape; c) evolution of cooperative behavior in H is less sensitive to the cost of cooperation than in G; and d) C achieves higher levels of cooperation than the other alternatives at low costs, whereas H does it at high costs. Our results also suggest that a synergy between H and V is elicited making the dominance of cooperation much more likely under cultural evolution than under the hereditary kind where only V is present.