Solved

Stage 2 — why reverse the loops?

MateoGOP

Stage 1 goes row by row, stage 2 column by column. Why?

9

Comments 5

Join the discussion

Already have an account? Log in

  1. LiamByte Solutionreplies: 1

    To decide if a column is clear you need to look at every row in that column before deciding. So the outer loop is the column, the inner loop goes through rows, and a blocked flag records whether any row had debris there.

    9
    1. MateoGOP

      So the outer loop is "the thing I'm deciding about". Nice rule.

      2
    2. AmeliaRunsreplies: 1

      Reset blocked = False at the start of each column, not before the outer loop. That's the usual bug.

      5
      1. MateoGOP

        ...which I had. Every column after the first was blocked 😅

        0