1616use Bywulf \Jigsawlutioner \Service \PuzzleSolver \ByWulfSolver \Strategy \MergeGroupsStrategy ;
1717use Bywulf \Jigsawlutioner \Service \PuzzleSolver \ByWulfSolver \Strategy \RemoveBadPiecesStrategy ;
1818use Bywulf \Jigsawlutioner \Service \PuzzleSolver \ByWulfSolver \Strategy \RemoveSmallGroupsStrategy ;
19- use Bywulf \Jigsawlutioner \Service \SideMatcher \SideMatcherInterface ;
2019use Closure ;
21- use Symfony \Component \Cache \Adapter \FilesystemAdapter ;
2220
2321class ByWulfSolver implements PuzzleSolverInterface
2422{
@@ -31,22 +29,17 @@ class ByWulfSolver implements PuzzleSolverInterface
3129 3 => ['x ' => 1 , 'y ' => 0 ],
3230 ];
3331
34- private FilesystemAdapter $ cache ;
32+ private ? Closure $ stepProgressionCallback = null ;
3533
36- private bool $ allowRemovingWhileMerging = true ;
37-
38- private bool $ outputStepSaving = false ;
3934 private AddBestSinglePieceStrategy $ addBestSinglePieceStrategy ;
4035 private MergeGroupsStrategy $ mergeGroupsStrategy ;
4136 private FillBlanksWithSinglePiecesStrategy $ fillBlanksWithSinglePiecesStrategy ;
4237 private RemoveBadPiecesStrategy $ removeBadPiecesStrategy ;
4338 private RemoveSmallGroupsStrategy $ removeSmallGroupsStrategy ;
4439 private CreateMissingGroupsStrategy $ createMissingGroupsStrategy ;
4540
46- public function __construct (
47- private SideMatcherInterface $ sideMatcher ,
48- private ?Closure $ stepProgression = null ,
49- ) {
41+ public function __construct ()
42+ {
5043 $ this ->addBestSinglePieceStrategy = new AddBestSinglePieceStrategy ();
5144 $ this ->mergeGroupsStrategy = new MergeGroupsStrategy ();
5245 $ this ->fillBlanksWithSinglePiecesStrategy = new FillBlanksWithSinglePiecesStrategy ();
@@ -55,6 +48,11 @@ public function __construct(
5548 $ this ->createMissingGroupsStrategy = new CreateMissingGroupsStrategy ();
5649 }
5750
51+ public function setStepProgressionCallback (Closure $ stepProgressionCallback ): void
52+ {
53+ $ this ->stepProgressionCallback = $ stepProgressionCallback ;
54+ }
55+
5856 /**
5957 * @param Piece[] $pieces
6058 * @param array<string, array<string, float>>
@@ -66,7 +64,7 @@ public function findSolution(array $pieces, array $matchingMap): Solution
6664 $ context = new ByWulfSolverContext (
6765 $ pieces ,
6866 $ matchingMap ,
69- $ this ->stepProgression
67+ $ this ->stepProgressionCallback
7068 );
7169
7270 $ this ->addBestSinglePieceStrategy ->execute ($ context , 0.8 , 0.5 );
0 commit comments