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