Now that we’ve generated the palette, the most complex part of the algorithm is actually behind us. The remaining code implements the fire algorithm, and is fairly simple:
- Generate fire on the bottom row of the screen.
- Move the already existing fire upwards on the screen. Rather than just move every cell of fire upwards, though, we take into account the fact that heat is always affected by nearby heat. So the fire …


