Test for complete or incomplete generation

Author: GouvernathorCreated May 1, 2026Updated Jul 11, 2026

First observation : there is (minor) code duplication between the two models when it comes to the saving process, in the if that is used to switch between handling a complete or incomplete generation. The old JS port did move that boolean to the Model class.

Second observation, that condition seems wrong. In Model, the observed array is initialized to -1 everywhere, and then for each cell, if the wave says so, the -1 is replaced with a positive-or-0 value. So, to know if the generation is complete is to know whether at least one boolean in the wave array is false, or equivalently to know whether any value in observed is -1. But the check that is being made in both models, is to test only the first value of observed for being -1. How can that be correct ?

Source: mxgmn/WaveFunctionCollapse