@@ -18,15 +18,15 @@ |
||
18 | 18 | ) |
19 | 19 | ); |
20 | 20 | $puzzle = SudokuPuzzle::fromArrays( |
21 | - [ 5, 3, null, null, 7, null, null, null, null], |
|
22 | - [ 6, null, null, 1, 9, 5, null, null, null], |
|
23 | - [null, 9, 8, null, null, null, null, 6, null], |
|
24 | - [ 8, null, null, null, 6, null, null, null, 3], |
|
25 | - [ 4, null, null, 8, null, 3, null, null, 1], |
|
26 | - [ 7, null, null, null, 2, null, null, null, 6], |
|
27 | - [null, 6, null, null, null, null, 2, 8, null], |
|
28 | - [null, null, null, 4, 1, 9, null, null, 5], |
|
29 | - [null, null, null, null, 8, null, null, 7, 9] |
|
21 | + [5, 3, null, null, 7, null, null, null, null], |
|
22 | + [6, null, null, 1, 9, 5, null, null, null], |
|
23 | + [null, 9, 8, null, null, null, null, 6, null], |
|
24 | + [8, null, null, null, 6, null, null, null, 3], |
|
25 | + [4, null, null, 8, null, 3, null, null, 1], |
|
26 | + [7, null, null, null, 2, null, null, null, 6], |
|
27 | + [null, 6, null, null, null, null, 2, 8, null], |
|
28 | + [null, null, null, 4, 1, 9, null, null, 5], |
|
29 | + [null, null, null, null, 8, null, null, 7, 9] |
|
30 | 30 | ); |
31 | 31 | |
32 | 32 | echo "Starting!!\n\n{$puzzle->representation()}\n"; |
@@ -181,7 +181,7 @@ |
||
181 | 181 | do { |
182 | 182 | $line = readline(); |
183 | 183 | $crates .= "$line\n"; |
184 | - } while(!empty($line)); |
|
184 | + } while (!empty($line)); |
|
185 | 185 | $crate = readline('Which crate to liberate?'); |
186 | 186 | $cratePuzzle = SlidingCratesPuzzle::fromString($crates, $crate); |
187 | 187 |
@@ -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 | } |