  Using simulations between pairs of $\epsilon$-greedy q-learners with
one-period memory, this article demonstrates that the potential function of the
stochastic replicator dynamics (Foster and Young, 1990) allows it to predict
the emergence of error-proof cooperative strategies from the underlying
parameters of the repeated prisoner's dilemma. The observed cooperation rates
between q-learners are related to the ratio between the kinetic energy exerted
by the polar attractors of the replicator dynamics under the grim trigger
strategy. The frontier separating the parameter space conducive to cooperation
from the parameter space dominated by defection can be found by setting the
kinetic energy ratio equal to a critical value, which is a function of the
discount factor, $f(\delta) = \delta/(1-\delta)$, multiplied by a correction
term to account for the effect of the algorithms' exploration probability. The
gradient at the frontier increases with the distance between the game
parameters and the hyperplane that characterizes the incentive compatibility
constraint for cooperation under grim trigger.
  Building on literature from the neurosciences, which suggests that
reinforcement learning is useful to understanding human behavior in risky
environments, the article further explores the extent to which the frontier
derived for q-learners also explains the emergence of cooperation between
humans. Using metadata from laboratory experiments that analyze human choices
in the infinitely repeated prisoner's dilemma, the cooperation rates between
humans are compared to those observed between q-learners under similar
conditions. The correlation coefficients between the cooperation rates observed
for humans and those observed for q-learners are consistently above $0.8$. The
frontier derived from the simulations between q-learners is also found to
predict the emergence of cooperation between humans.
