@@ -45,7 +45,7 @@ |
||
45 | 45 | return Moves::none(); |
46 | 46 | } |
47 | 47 | [$r, $c] = $this->firstEmptyPosition; |
48 | - return Entry::allPossibilitiesFor($r, $c)->filterWith(function (Entry $entry) { |
|
48 | + return Entry::allPossibilitiesFor($r, $c)->filterWith(function(Entry $entry) { |
|
49 | 49 | return $this->allows($entry); |
50 | 50 | }); |
51 | 51 | } |
@@ -26,7 +26,7 @@ |
||
26 | 26 | public static function allPossibilitiesFor(int $row, int $column): Moves |
27 | 27 | { |
28 | 28 | return new Moves(...array_map( |
29 | - static function (int $number) use ($row, $column): Entry { |
|
29 | + static function(int $number) use ($row, $column): Entry { |
|
30 | 30 | return new self($number, $row, $column); |
31 | 31 | }, |
32 | 32 | range(1, 9) |
@@ -67,7 +67,7 @@ |
||
67 | 67 | foreach ($crateCoordinates as $id => $coordinates) { |
68 | 68 | $crates[] = Crate::fromCoordinates($id, ...$coordinates); |
69 | 69 | } |
70 | - usort($crates, static function (Crate $crate1, Crate $crate2): int { |
|
70 | + usort($crates, static function(Crate $crate1, Crate $crate2): int { |
|
71 | 71 | return $crate1->id() <=> $crate2->id(); |
72 | 72 | }); |
73 | 73 |
@@ -70,7 +70,7 @@ |
||
70 | 70 | public function possiblePushes(): Moves |
71 | 71 | { |
72 | 72 | return Push::allFor($this->crates) |
73 | - ->filterWith(function (Push $push): bool { |
|
73 | + ->filterWith(function(Push $push): bool { |
|
74 | 74 | return $this->crates->withId($push->crateId())->canPush( |
75 | 75 | $push, |
76 | 76 | $this->crates, |
@@ -49,7 +49,7 @@ |
||
49 | 49 | |
50 | 50 | public function possibleMoves(): Moves |
51 | 51 | { |
52 | - return Action::all()->filterWith(function (Action $action) { |
|
52 | + return Action::all()->filterWith(function(Action $action) { |
|
53 | 53 | return $this->maze->isValidPosition($this->hero->after($action)); |
54 | 54 | }); |
55 | 55 | } |
@@ -24,7 +24,7 @@ |
||
24 | 24 | { |
25 | 25 | return new Moves( |
26 | 26 | new Crossing($riverbank->isStart(), null), |
27 | - ...array_map(static function (Purchase $purchase) use ($riverbank) { |
|
27 | + ...array_map(static function(Purchase $purchase) use ($riverbank) { |
|
28 | 28 | return new Crossing($riverbank->isStart(), $purchase); |
29 | 29 | }, $riverbank->purchases()) |
30 | 30 | ); |
@@ -37,7 +37,7 @@ |
||
37 | 37 | public function possibleCrossings(): Moves |
38 | 38 | { |
39 | 39 | return Crossing::allCrossingsFor($this->currentBank) |
40 | - ->filterWith(function (Crossing $crossing) { |
|
40 | + ->filterWith(function(Crossing $crossing) { |
|
41 | 41 | return $this->currentBank->canTakeAway($crossing->bringAlong()); |
42 | 42 | }); |
43 | 43 | } |
@@ -26,8 +26,7 @@ discard block |
||
26 | 26 | SearchSettings $settings |
27 | 27 | ): PuzzleSolver { |
28 | 28 | return $puzzle->singleSolution() ? |
29 | - EagerSolver::using($this->add($settings, $this->eagerStrategy($puzzle))) : |
|
30 | - LazySolver::using($this->add($settings, $this->lazyStrategy($puzzle))); |
|
29 | + EagerSolver::using($this->add($settings, $this->eagerStrategy($puzzle))) : LazySolver::using($this->add($settings, $this->lazyStrategy($puzzle))); |
|
31 | 30 | } |
32 | 31 | |
33 | 32 | private function add( |
@@ -67,8 +66,7 @@ discard block |
||
67 | 66 | } |
68 | 67 | return VisitedNodeSkipperFactory::using( |
69 | 68 | $puzzle->isExhausting() ? |
70 | - DepthFirstStrategyFactory::make() : |
|
71 | - BreadthFirstStrategyFactory::make() |
|
69 | + DepthFirstStrategyFactory::make() : BreadthFirstStrategyFactory::make() |
|
72 | 70 | ); |
73 | 71 | } |
74 | 72 |
@@ -62,8 +62,7 @@ discard block |
||
62 | 62 | isset($puzzle['heuristic']) ? new $puzzle['heuristic']() : null |
63 | 63 | ); |
64 | 64 | $renderer = ($puzzle['display'] ?? 'states') === 'states' ? |
65 | - PuzzleStatesToFileRenderer::fromFilenameAndSeparator(OUT, $sep, $time) : |
|
66 | - MovesToFileRenderer::fromFilenameAndSeparator(OUT, $sep, $time); |
|
65 | + PuzzleStatesToFileRenderer::fromFilenameAndSeparator(OUT, $sep, $time) : MovesToFileRenderer::fromFilenameAndSeparator(OUT, $sep, $time); |
|
67 | 66 | |
68 | 67 | $puzzleInfo[$puzzle['name']] = []; |
69 | 68 | foreach (scandir($dir) as $file) { |
@@ -75,7 +74,7 @@ discard block |
||
75 | 74 | 'factory' => $factories[$puzzle['type']], |
76 | 75 | 'description' => $description, |
77 | 76 | 'renderer' => $renderer, |
78 | - 'isDefault' => (($puzzle['default'] ?? '') . '.txt') === $file, |
|
77 | + 'isDefault' => (($puzzle['default'] ?? '') . '.txt') === $file, |
|
79 | 78 | 'isTheOnlyOne' => (bool) ($puzzle['level'] ?? false), |
80 | 79 | ]; |
81 | 80 | } |