@@ -55,26 +55,26 @@ public static Optional<Slice> rightStep(Pizza pizza, Slice slice) {
5555 * For each slice find all available steps. We DON'T change the pizza on this stage
5656 *
5757 * @param pizza given pizza
58- * @param output given slices in the pizza
58+ * @param startPos given slices in the pizza
5959 * @return available steps
6060 */
61- public static Map <Slice , List <Step >> getAvailableSteps (Pizza pizza , List <Slice > output ) {
61+ public static Map <Slice , List <Step >> getAvailableSteps (Pizza pizza , List <Slice > startPos ) {
6262 Map <Slice , List <Step >> groupedSteps = new HashMap <>();
63- for (Slice slice : output ) {
63+ for (Slice slice : startPos ) {
6464 List <Step > steps = new ArrayList <>();
6565 Slice stepLeftDelta = slice .generateStepDeltaLeft ();
6666 Slice stepRightDelta = slice .generateStepDeltaRight ();
6767 Slice stepAboveDelta = slice .generateStepDeltaAbove ();
6868 Slice stepBelowDelta = slice .generateStepDeltaBelow ();
69- if (pizza . containsCells ( stepLeftDelta )) steps .add (new Step (slice , stepLeftDelta ));
70- if (pizza . containsCells ( stepRightDelta )) steps .add (new Step (slice , stepRightDelta ));
71- if (pizza . containsCells ( stepAboveDelta )) steps .add (new Step (slice , stepAboveDelta ));
72- if (pizza . containsCells ( stepBelowDelta )) steps .add (new Step (slice , stepBelowDelta ));
69+ if (Step . isValid ( pizza , slice , stepLeftDelta )) steps .add (new Step (slice , stepLeftDelta ));
70+ if (Step . isValid ( pizza , slice , stepRightDelta )) steps .add (new Step (slice , stepRightDelta ));
71+ if (Step . isValid ( pizza , slice , stepAboveDelta )) steps .add (new Step (slice , stepAboveDelta ));
72+ if (Step . isValid ( pizza , slice , stepBelowDelta )) steps .add (new Step (slice , stepBelowDelta ));
7373 groupedSteps .put (slice , steps );
7474 }
7575 LOGGER .info ("available steps for" +
7676 "\n pizza: " + pizza
77- + "\n slices: " + output
77+ + "\n slices: " + startPos
7878 + "\n steps: " + groupedSteps );
7979 return groupedSteps ;
8080 }
0 commit comments