-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathplaygame.php
35 lines (30 loc) · 967 Bytes
/
playgame.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
<?php
require 'bootstrap.php';
$scoreStrategy = array(
'Hit'=>'\\Iannsp\PhpWar\\Game\\Score\\Hit',
'Neibor'=>'\\Iannsp\PhpWar\\Game\\Score\\Neibor',
);
$arenaLimits = new Iannsp\PhpWar\Geometry\Cartesian\Point(10,10);
$arena = new Iannsp\PhpWar\Arena($arenaLimits, $scoreStrategy);
$players = array (
new Iannsp\PhpWar\Player\P1($arenaLimits),
new Iannsp\PhpWar\Player\P1($arenaLimits)
);
$game = new Iannsp\PhpWar\Game($arena, $players);
$frameRate = 4;
foreach ($game as $currentTurn) {
print $game->render($frameRate);
}
echo "
_____ _ _ _____ __ __
| __ \| | | | __ \ \ \ / /
| |__) | |__| | |__) | \ \ /\ / /_ _ _ __
| ___/| __ | ___/ \ \/ \/ / _` | '__|
| | | | | | | \ /\ / (_| | |
|_| |_| |_|_| \/ \/ \__,_|_|
\nResult\n";
$stats = $arena->stats();
foreach ($stats as $id=>$stat){
if ($id!=='.')
echo "Player {$id} has {$stat} position(s).\n";
}