summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBenjamin Franzke <benjaminfranzke@googlemail.com>2012-11-08 13:38:52 +0100
committerBenjamin Franzke <benjaminfranzke@googlemail.com>2012-11-08 13:38:52 +0100
commit85a747753b52a47be9c3a9ecf53d1dfd940e36fb (patch)
tree9b3a96eea551a55006e91fe7ac54c1bf8f4f9af0
parent858300e97a00f969e16992d479698d048e551df6 (diff)
downloadwbs-85a747753b52a47be9c3a9ecf53d1dfd940e36fb.tar.gz
wbs-85a747753b52a47be9c3a9ecf53d1dfd940e36fb.tar.bz2
wbs-85a747753b52a47be9c3a9ecf53d1dfd940e36fb.zip
prisoners_dilemma: Use format instead of write
-rw-r--r--prisoners_dilemma.pl7
1 files 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]).