adventofcode/2021/11/part2.mjs

20 lines
372 B
JavaScript
Raw Normal View History

2021-12-11 17:08:28 +00:00
import fs from "fs-extra";
import fp from "lodash/fp.js";
import _ from "lodash";
import * as p1 from './part1.mjs';
const allFlashed = grid => grid.every(
row => row.every( x => x === 0 )
);
export function solution(grid) {
let step = 0;
while(true) {
step++;
p1.playTurn(grid);
if( allFlashed(grid) ) return step;
}
}