commit 292b9caaaa1bd357d474e56029cccd3337392732
parent 0d4605487ae6cdcbe41b0a9fcd6b9b9f2b7476eb
Author: Ryan Wolf <rwolf@borderstylo.com>
Date: Mon, 1 Mar 2010 17:09:58 -0800
output the board
Diffstat:
2 files changed, 22 insertions(+), 1 deletion(-)
diff --git a/README.md b/README.md
@@ -22,6 +22,11 @@ Run resera.pl with the arguments
For example, using the Example PD payoff matrix for the wiki page [prisoner's dilemma](http://en.wikipedia.org/wiki/Prisoner%27s_dilemma):
$ perl resera.pl 3 3 0 5 5 0 1 1
+ Choice 1 | Choice 2
+ -------------------
+ Choice 1 | 3, 3 | 0, 5
+ Choice 2 | 5, 0 | 1, 1
+
Player Column: (0.000000%, 100.000000%)
Player Row: (0.000000%, 100.000000%)
@@ -31,6 +36,5 @@ TODO
-----
* expand summary
-* ouput the board
* there's a lot of room to optimise (precomputing $a-$b-$c+$d instead of finding it n times comes immediately to mind)--faster means more iterations
* add a fun license
diff --git a/resera.pl b/resera.pl
@@ -15,6 +15,23 @@ if (scalar @ARGV == 8) {
];
}
+my $pm = " Choice 1 | Choice 2\n" .
+ " -------------------\n" .
+ "Choice 1 | %d, %d | %d, %d\n" .
+ "Choice 2 | %d, %d | %d, %d\n\n";
+printf(
+ $pm,
+ $grid->[0][0][0],
+ $grid->[0][0][1],
+ $grid->[0][1][0],
+ $grid->[0][1][1],
+ $grid->[1][0][0],
+ $grid->[1][0][1],
+ $grid->[1][1][0],
+ $grid->[1][1][1]
+);
+
+
my $choices = [[0,0], [0,0]];
my $iterations = 10000;