for loopified

This commit is contained in:
mtrx 2024-12-06 20:58:42 +01:00
parent 199303ce82
commit d28803dba6

View file

@ -27,14 +27,12 @@ class DayFour implements Solvable {
let [b,a] = [0, mat[0].length - 1]
const lines = []
while (b < mat.length) {
let [y,x] = [b,a]
let line = ''
// walk top left of diagonal to bottom right
while (x < mat[y].length && y < mat.length - 1) {
for (let [y,x] = [b,a]; x < mat[y].length && y < mat.length - 1; y++,x++)
line += mat[y][x]
y++
x++
}
lines.push(line.split(''))
if (a > 0) {