summaryrefslogtreecommitdiff
path: root/rules/pavlov.pl
blob: 5fe3702472f13c26f27c9f22c3636c9f47f71ef2 (plain)
1
2
3
4
5
6
7
8
9
% Pavlov:
% Cooperates if and only if both players opted for the
% same choice in the previous move, otherwise it defects.

% Syntax: pavlov(+history, -choice, +state_in, -state_out)

pavlov([], c, _, c):-!.
pavlov([Choice|_], c, Choice, c):-!.
pavlov(_, d, _, d).