Skip to content

Commit

Permalink
Some code to run lots of games and total the results.
Browse files Browse the repository at this point in the history
  • Loading branch information
Thomas Baker committed May 14, 2016
1 parent 037bb96 commit f0ae12a
Showing 1 changed file with 28 additions and 4 deletions.
32 changes: 28 additions & 4 deletions exec.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,36 @@
class Exec {
public function go() {
$players = [
new Player('Qwirky'),
new Player('Kwirkster'),
new Player('Mr. Three'),
new CautiousPlayer('Cautious Player')
// new Player('Qwirky'),
// new Player('Kwirkster'),
// new Player('Mr. Three'),
new Player('bakert'),
new Player('Syl'),
new Player('Fra')
];
$game = new Game($players, unserialize(TestGames::FIRST));
$game->go();
exit;

$players = [
// new Player('Qwirky'),
// new Player('Kwirkster'),
// new Player('Mr. Three'),
new CautiousPlayer('bakert'),
new CautiousPlayer('Syl'),
new Player('Fra')
];
$totals = [];
for ($i = 0; $i < 100; $i++) {
$game = new Game($players/*, unserialize(TestGames::FIRST)*/);
$game->go();
foreach ($game->scores()->scores() as $score) {
if (!isset($totals[(string)$score->player()])) {
$totals[(string)$score->player()] = 0;
}
$totals[(string)$score->player()] += $score->score();
}
print_r($totals);
}
}
}

0 comments on commit f0ae12a

Please sign in to comment.