summaryrefslogtreecommitdiff
path: root/tit4tat.pl
diff options
context:
space:
mode:
Diffstat (limited to 'tit4tat.pl')
-rw-r--r--tit4tat.pl13
1 files changed, 8 insertions, 5 deletions
diff --git a/tit4tat.pl b/tit4tat.pl
index 5eb54f4..85df991 100644
--- a/tit4tat.pl
+++ b/tit4tat.pl
@@ -20,7 +20,7 @@ pay(d,d,2).
pay(c,c,3).
pay(d,c,4).
-step(A, B, PAY_A, PAY_B) :-
+step(A, B, PAY_A, PAY_B) :-
pay(A, B, PAY_A),
pay(B, A, PAY_B).
@@ -33,12 +33,15 @@ tit4tat(A, Hist, PayA, PayB) :-
tit4tat_select(Old, Hist),
step(A, Old, PayA, PayB).
-loop(end, [_]).
+loop(end, _).
loop(End, Hist):- End\=end,
- write('Type c,d or end to end: '), read(Word),
- tit4tat(Word, Hist, PAY_A, PAY_B),
+ write('Type c,d or end to end: '), read(Choice),
+
+ tit4tat(Choice, Hist, PAY_A, PAY_B),
+
write('A Pay: '),write(PAY_A),nl,
write('B Pay: '),write(PAY_B),nl,
- loop(Word, [Word|Hist]).
+
+ loop(Choice, [Choice|Hist]).
start:-loop(noend, []).