@@ -20,26 +20,26 @@ private DFSMethods() {
2020 * For each slice find all available steps. We DON'T change the pizza on this stage
2121 *
2222 * @param pizza given pizza
23- * @param output given slices in the pizza
23+ * @param startPos given slices in the pizza
2424 * @return available steps
2525 */
26- public static Map <Slice , List <Step >> getAvailableSteps (Pizza pizza , List <Slice > output ) {
26+ public static Map <Slice , List <Step >> getAvailableSteps (Pizza pizza , List <Slice > startPos ) {
2727 Map <Slice , List <Step >> groupedSteps = new HashMap <>();
28- for (Slice slice : output ) {
28+ for (Slice slice : startPos ) {
2929 List <Step > steps = new ArrayList <>();
3030 Slice stepLeftDelta = slice .generateStepDeltaLeft ();
3131 Slice stepRightDelta = slice .generateStepDeltaRight ();
3232 Slice stepAboveDelta = slice .generateStepDeltaAbove ();
3333 Slice stepBelowDelta = slice .generateStepDeltaBelow ();
34- if (pizza . containsCells ( stepLeftDelta )) steps .add (new Step (slice , stepLeftDelta ));
35- if (pizza . containsCells ( stepRightDelta )) steps .add (new Step (slice , stepRightDelta ));
36- if (pizza . containsCells ( stepAboveDelta )) steps .add (new Step (slice , stepAboveDelta ));
37- if (pizza . containsCells ( stepBelowDelta )) steps .add (new Step (slice , stepBelowDelta ));
34+ if (Step . isValid ( pizza , slice , stepLeftDelta )) steps .add (new Step (slice , stepLeftDelta ));
35+ if (Step . isValid ( pizza , slice , stepRightDelta )) steps .add (new Step (slice , stepRightDelta ));
36+ if (Step . isValid ( pizza , slice , stepAboveDelta )) steps .add (new Step (slice , stepAboveDelta ));
37+ if (Step . isValid ( pizza , slice , stepBelowDelta )) steps .add (new Step (slice , stepBelowDelta ));
3838 groupedSteps .put (slice , steps );
3939 }
4040 LOGGER .info ("available steps for" +
4141 "\n pizza: " + pizza
42- + "\n slices: " + output
42+ + "\n slices: " + startPos
4343 + "\n steps: " + groupedSteps );
4444 return groupedSteps ;
4545 }
0 commit comments