adventofcode/2021/11/part2.mjs
2021-12-11 12:08:28 -05:00

20 lines
372 B
JavaScript

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;
}
}