summaryrefslogtreecommitdiff
path: root/rules/pavlov.pl
diff options
context:
space:
mode:
Diffstat (limited to 'rules/pavlov.pl')
-rw-r--r--rules/pavlov.pl6
1 files changed, 6 insertions, 0 deletions
diff --git a/rules/pavlov.pl b/rules/pavlov.pl
new file mode 100644
index 0000000..0da8011
--- /dev/null
+++ b/rules/pavlov.pl
@@ -0,0 +1,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).