From 7e23cb0e2a2ad82cddf354ee0d3c2773b99b4d02 Mon Sep 17 00:00:00 2001 From: Benjamin Franzke Date: Mon, 12 Nov 2012 10:23:57 +0100 Subject: Prisoners Dilemma: Implement Gradual Killer --- rules/gradual_killer.pl | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 rules/gradual_killer.pl diff --git a/rules/gradual_killer.pl b/rules/gradual_killer.pl new file mode 100644 index 0000000..599ef3e --- /dev/null +++ b/rules/gradual_killer.pl @@ -0,0 +1,19 @@ +% Gradual Killer: +% In the first five rounds it defects, than it cooperates in two rounds. +% If the opponent has defected in rounds 6 and 7, than the Gradual Killer +% keeps defecting forever, otherwise he keeps cooperation forever. + +gradual_killer(_, d, [], [1]). +gradual_killer(_, d, [1], [2]). +gradual_killer(_, d, [2], [3]). +gradual_killer(_, d, [3], [4]). +gradual_killer(_, d, [4], [5]). + +gradual_killer(_, c, [5], [6]). +gradual_killer(_, c, [6], [7]). + +gradual_killer([d,d|_], d, [7], [d]):-!. +gradual_killer(_, c, [7], [c]). + +gradual_killer(_, c, [c], [c]). +gradual_killer(_, d, [d], [d]). -- cgit