diff options
author | Benjamin Franzke <benjaminfranzke@googlemail.com> | 2012-11-08 11:04:25 +0100 |
---|---|---|
committer | Benjamin Franzke <benjaminfranzke@googlemail.com> | 2012-11-08 11:04:25 +0100 |
commit | f22d7a9894d530fa2f8ceaeff3a8a52746ad7a1c (patch) | |
tree | c295f5d80c5c69aa26cf198e073e855c60879a89 | |
parent | 60f1dc0764ba6c9a138fbd8976a2a2961564196c (diff) | |
download | wbs-f22d7a9894d530fa2f8ceaeff3a8a52746ad7a1c.tar.gz wbs-f22d7a9894d530fa2f8ceaeff3a8a52746ad7a1c.tar.bz2 wbs-f22d7a9894d530fa2f8ceaeff3a8a52746ad7a1c.zip |
Prisoners Dilemma: Add descriptions to non-trivial understandable modules
-rw-r--r-- | grudger.pl | 1 | ||||
-rw-r--r-- | hard_tit4tat.pl | 4 | ||||
-rw-r--r-- | mistrust_tit4tat.pl | 3 | ||||
-rw-r--r-- | naive_prober.pl | 7 | ||||
-rw-r--r-- | pavlov.pl | 1 | ||||
-rw-r--r-- | tit4tat.pl | 5 |
6 files changed, 17 insertions, 4 deletions
@@ -1,3 +1,4 @@ +% Grudger, Spiteful: % Cooperates until the second has defected, after % that move defects forever (he does not forgive). % http://euler.fd.cvut.cz/predmety/game_theory/lecture_repeat.pdf diff --git a/hard_tit4tat.pl b/hard_tit4tat.pl index 5bff447..8efc124 100644 --- a/hard_tit4tat.pl +++ b/hard_tit4tat.pl @@ -1,2 +1,6 @@ +% Hard Tit for Tat: +% Cooperates unless the opponent has defected +% at least once in the last two rounds. + hard_tit4tat([A,B|_],d,_,_):-(A=d;B=d),!. hard_tit4tat(_,c,_,_). diff --git a/mistrust_tit4tat.pl b/mistrust_tit4tat.pl index 3c150c5..5e80c02 100644 --- a/mistrust_tit4tat.pl +++ b/mistrust_tit4tat.pl @@ -1,4 +1,5 @@ -% Syntax: MODULE(UserDecisionHistry [in], ModuleDecision [out]) +% Mistrust Tit for Tat: +% In the first round it defects, than it plays opponent’s move. % Use opponents last decision mistrust_tit4tat([Last|_],Last,_,_). diff --git a/naive_prober.pl b/naive_prober.pl index dde376d..df2bcf5 100644 --- a/naive_prober.pl +++ b/naive_prober.pl @@ -1,6 +1,7 @@ -% Naive Prober: Like Tit for Tat, but sometimes, after the -% opponent has cooperated, it defects (e.g. at random, in -% one of ten rounds in average). +% Naive Prober: +% Like Tit for Tat, but sometimes, after the opponent has cooperated, it +% defects (e.g. at random, in one of ten rounds in average). + naive_prober([d|_],d,_,_). % but only for for 90% if coorporated naive_prober([c|_],Choice,_,_):-random(Number), (Number < 0.1 -> Choice=d; Choice=c). @@ -1,3 +1,4 @@ +% Pavlov: % Cooperates if and only if both players opted for the % same choice in the previous move, otherwise it defects. pavlov([], c, _, c):-!. @@ -1,3 +1,8 @@ +% Tit for Tat: +% Begins with cooperation and then plays what its opponent played in the last +% move (if the opponent defects in some round, Tit for Tat will defect in the +% following one; to cooperation it responds with cooperation). + % Syntax: MODULE(UserDecisionHistry [in], ModuleDecision [out]) % Use opponents last decision |