Total Complexity | 9 |
Total Lines | 54 |
Duplicated Lines | 0 % |
Changes | 2 | ||
Bugs | 0 | Features | 0 |
1 | <?php declare(strict_types=1); |
||
9 | final class SlidingPuzzle implements Puzzle |
||
10 | { |
||
11 | /** @var Board */ |
||
12 | private $board; |
||
13 | /** @var Moves */ |
||
14 | private $moves; |
||
15 | |||
16 | private function __construct(Board $board, Moves $moves) |
||
17 | { |
||
18 | $this->board = $board; |
||
19 | $this->moves = $moves; |
||
20 | } |
||
21 | |||
22 | public static function withPieces(array ...$pieces): Puzzle |
||
25 | } |
||
26 | |||
27 | public function goalState(): string |
||
30 | } |
||
31 | |||
32 | public function currentState(): string |
||
33 | { |
||
34 | return $this->board->currentState(); |
||
35 | } |
||
36 | |||
37 | public function representation(): string |
||
38 | { |
||
39 | return (string) $this->board; |
||
40 | } |
||
41 | |||
42 | public function afterMaking(Move ...$moves): Puzzle |
||
43 | { |
||
44 | return new self( |
||
45 | $this->board->afterSliding(...$moves), |
||
46 | $this->moves->add(...$moves) |
||
47 | ); |
||
48 | } |
||
49 | |||
50 | public function isSolved(): bool |
||
53 | } |
||
54 | |||
55 | public function movesSoFar(): Moves |
||
56 | { |
||
57 | return $this->moves; |
||
58 | } |
||
59 | |||
60 | public function possibleMoves(): Moves |
||
63 | } |
||
64 | } |
||
65 |