summaryrefslogtreecommitdiff
path: root/rules/pavlov.pl
blob: 0da8011520940e5f8d8b5a99340a975f989175a5 (plain)
1
2
3
4
5
6
% Pavlov:
% Cooperates if and only if both players opted for the
% same choice in the previous move, otherwise it defects.
pavlov([], c, _, c):-!.
pavlov([Choice|_], c, Choice, c):-!.
pavlov(_, d, _, d).