1 | <?php |
||
18 | class Engine |
||
19 | { |
||
20 | private $objectivePlayer; |
||
21 | |||
22 | private $maxDepth; |
||
23 | |||
24 | /** |
||
25 | * @var ?Analytics Only available after run, contains statistics about the |
||
26 | * execution. |
||
27 | */ |
||
28 | private $analytics; |
||
29 | |||
30 | /** |
||
31 | * @param Player $objectivePlayer The player to play as |
||
32 | * @param int $maxDepth How far ahead should the engine look? |
||
33 | */ |
||
34 | 16 | public function __construct(Player $objectivePlayer, int $maxDepth = 3) |
|
39 | |||
40 | /** |
||
41 | * Evaluate possible decisions and take the best one |
||
42 | * @param GameState $state Current state of the game for which there needs |
||
43 | * to be made a decision. This implicitly means that the objective player |
||
44 | * currently must have its turn in the GameState. |
||
45 | * @return GameState The state resulting after the engine made its decision. |
||
46 | */ |
||
47 | 16 | public function decide(GameState $state): GameState |
|
71 | |||
72 | 1 | public function getAnalytics(): Analytics |
|
79 | } |
||
80 |