Evolutionary programming experiments are conducted to investigate the conditions that promote the evolution of cooperative behavior in the iterated prisoner's dilemma. A population of logical stimulus-response devices is maintained over successive generations with selection based on individual fitness. The reward for selfish behavior is varied across a series of trials. Simulations indicate three distinct patterns of behaviors in which mutual cooperation is inevitable, improbable, or apparently random. The ultimate behavior can be reliably predicted by examining the payoff matrix that defines the reward for alternative joint behaviors.