-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.php
55 lines (42 loc) · 997 Bytes
/
index.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
<?php
declare(strict_types=1);
require __DIR__ . '/vendor/autoload.php';
/**
* The Bee game by Clobee
*/
use php_exercices\Game;
use php_exercices\FactoryBee;
use php_exercices\Entity\QueenBee;
use php_exercices\Entity\DroneBee;
use php_exercices\Entity\WorkerBee;
$factoryBee = new factoryBee(
new QueenBee,
new WorkerBee,
new DroneBee
);
$game = new Game($factoryBee);
$game->play();
$hitResults = $game->getHitResults();
$hitlist = $game->getHitList();
$hits = array_count_values(array_values($hitlist));
echo "The Bee game by Clobee </br/>";
echo "<br /><br />\n";
echo "== HITS LIST ==";
echo str_repeat("-=", 10);
echo "<br /><br />\n";
array_walk(
$hits,
function ($val, $key) {
echo "$key will be hit $val time(s)<br />\n";
}
);
echo "<br /><br />\n";
echo "== RESULTS ==";
echo str_repeat("-=", 10);
echo "<br /><br />\n";
array_walk(
$hitResults,
function ($val, $key) {
echo "$key has $val lifespan left<br />\n";
}
);