| 800 | ): Array<Block> => { |
| 801 | const blocks: Array<Block> = [] |
| 802 | const push = (a: number, b: number, length: number) => { |
| 803 | if (length === 0) return |
| 804 | const last = blocks[blocks.length - 1] |
| 805 | if (last !== undefined && last.a + last.length === a && last.b + last.length === b) { |
| 806 | blocks[blocks.length - 1] = { a: last.a, b: last.b, length: last.length + length } |
| 807 | } else { |
| 808 | blocks.push({ a, b, length }) |
| 809 | } |
| 810 | } |
| 811 | |
| 812 | // Forward and reverse furthest-reaching x per diagonal, offset by n + m + 1 |
| 813 | const offset = n + m + 1 |