Closed schrum2 closed 2 years ago
Added the new command line parameters for this issue (MINIMUM_REQUIRED_BLOCKS, USE_MIN_BLOCK_REQUIREMENT, MIN_BLOCK_PRESENCE_INCREMENT).
The last commit causes an infinite loop due to the value of presence_threshold
being assigned inside a different helper function.
I think this is resolved. Comment, test, and then close if appropriate
Commented and tested, seems to work now. I also changed the default value for MINIMUM_REQUIRED_BLOCKS to 10 and USE_MIN_BLOCK_REQUIREMENT to True.
Sometimes a "shape" is generated that is nothing but empty space. This is boring, and should be prevented.
Make a command line parameter MINIMUM_REQUIRED_BLOCKS whose default value is
sys.maxsize
(need toimport sys
), which means there is effectively no requirement. Also make parameters USE_MIN_BLOCK_REQUIREMENT (default False) and MIN_BLOCK_PRESENCE_INCREMENT (default 0.1)Now, have
query_cppn_for_shape
count the number of non-air blocks that are generated. If USE_MIN_BLOCK_REQUIREMENT is True and the resulting number is less than MINIMUM_REQUIRED_BLOCKS, then the effective presence threshold (for this shape only, NOT for all future shapes) will be incremented by MIN_BLOCK_PRESENCE_INCREMENT. Basically, the presence threshold from args needs to be saved in a separate variable that changes if needed. Also, all the code for generating the blocks needs to be in a loop that depends on a boolean that sees if either USE_MIN_BLOCK_REQUIREMENT is False or the number of non-air blocks was big enough.At a high-level, the CPPN will generate a shape, but if there are not enough blocks, it changes its presence threshold (which makes it more likely to place blocks) and tries again. Eventually, the effective presence threshold should be big enough that enough blocks are generated.