I think my output is correct.
"The ball can go through empty spaces by rolling up (u), down (d), left (l) or right (r), but it won't stop rolling until hitting a wall. When the ball stops, it could choose the next direction."
So in the second example, the ball won't stop until it rolls to row 0.
@fallcreek ok, got it now, thanks.