A fire that goes out this minute still lights its neighbors this minute
So far a fire burned forever. Now it burns for one minute.
row At minute 1, (0,0) goes out, and in the same minute it lights (0,1).
Real rules change more than one thing per round: a fire that burns for one minute and then turns to ash, A, or an infected cell that recovers. Reading the old grid handles both in the same pass. A fire that goes out this minute was still burning at the start of the minute, so it still lights its neighbors this minute. Write the order of events down before you code it, because that's where a wrong order or an in-place write hides.
When a fire burns for minutes instead of one, you know the minute it goes out the moment it catches: that minute plus . Keep a schedule, a defaultdict(list) from a minute to the cells that go out then. Add a cell when it catches (ends[minute + b].append(cell)). At each minute, apply ends.pop(minute, []) together with that minute's new fires. Here is F.. with :
row (0,0), (0,1) and (0,2) catch at minutes 0, 1 and 2, and go out at 3, 4 and 5.
In the editor, write the loop in burn_once(grid, k): one minute of a forest where fires burn out. Every fire F turns to ash A, and every tree with at least k burning neighbors at the start of the minute catches.