Function
zigzag_path_tb
(N, start_row=0, start_col=0, dir_row=1, dir_col=1)
Source from the content-addressed store, hash-verified
| 152 | return path |
| 153 | |
| 154 | def zigzag_path_tb(N, start_row=0, start_col=0, dir_row=1, dir_col=1): |
| 155 | path = [] |
| 156 | for j in range(N): |
| 157 | for i in range(N): |
| 158 | # If the column number is even, move down; otherwise, move up |
| 159 | row = i if j % 2 == 0 else N - 1 - i |
| 160 | path.append((start_row + dir_row * row) * N + start_col + dir_col * j) |
| 161 | return path |
| 162 | |
| 163 | paths = [] |
| 164 | for start_row, start_col, dir_row, dir_col in [ |
Tested by
no test coverage detected