You are reading a single comment by @lf and its replies. Click here to read the full conversation.
  • yeah similar here, was filtering to get dy lines after moving down 1 rather than moving down dy lines and then counting...

  • Very C-like, I ended up writing

    def trees(grid, r, d):
        return sum(row[(i*r) % len(row)] == "#"
                   for i, row in enumerate(grid[::d]))
    

    for the find-trees function.

About

Avatar for lf @lf started