From a40ea9b1904e872ca35daa168c4f7ec995895be2 Mon Sep 17 00:00:00 2001 From: Benjamin Franzke Date: Mon, 5 Nov 2012 14:42:26 +0100 Subject: tit4tat.pl: Fix variable names --- tit4tat.pl | 13 ++++++++----- 1 file 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, []). -- cgit