From 85a747753b52a47be9c3a9ecf53d1dfd940e36fb Mon Sep 17 00:00:00 2001 From: Benjamin Franzke Date: Thu, 8 Nov 2012 13:38:52 +0100 Subject: prisoners_dilemma: Use format instead of write --- prisoners_dilemma.pl | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/prisoners_dilemma.pl b/prisoners_dilemma.pl index f4f5d74..535db0d 100644 --- a/prisoners_dilemma.pl +++ b/prisoners_dilemma.pl @@ -34,10 +34,9 @@ do(Choice, Module, ModuleState, Hist, PayedA, PayedB) :- decide(Module, Hist, ModuleDecision, ModuleState, NewModuleState), pay2(Choice, ModuleDecision, PayA, PayB), - write('A Pay: '), write(Choice), write(': '), write(PayA), write('\t'), - write('B Pay: '), write(ModuleDecision), write(': '), write(PayB), write('\t'), - write('A: '), sum([PayA|PayedA], SumA), write(SumA), write('\t'), - write('B: '), sum([PayB|PayedB], SumB), write(SumB), nl, + sum([PayA|PayedA], SumA), sum([PayB|PayedB], SumB), + format('A [~w]: ~w\tB [~w]: ~w\tA Total: ~w\tB Total: ~w\n', + [Choice, PayA, ModuleDecision, PayB, SumA, SumB]), loop(Module, NewModuleState, [Choice|Hist], [PayA|PayedA], [PayB|PayedB]). -- cgit