summaryrefslogtreecommitdiff
path: root/rules/naive_prober.pl
blob: 72debd38aac305122d13a40766963e22d7d90421 (plain)
1
2
3
4
5
6
7
8
9
10
11
% 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).

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

naive_prober([d|_],d,_,_).
% but only for for 90% if coorporated
naive_prober([c|_],Choice,_,_):-random(Number), (Number < 0.1 -> Choice=d; Choice=c).
% Fallback to coorporate if history is empty.
naive_prober([],c,_,_).