mikepound / opencubes

A community improved version of the polycubes project!
MIT License
44 stars 23 forks source link

C++ | fix split cache files #38

Closed JATothrim closed 11 months ago

JATothrim commented 11 months ago

The split cache files are not saved correctly: they break the cache file format that states: numShapes <= numPolycubes must be true.

The bug is that the -s/split_cache is saving the entire hashy.byshape as the shape table for each split cache file but it is not actually removing the targetShape from the hashy.byshape so the saved shape table is too big.

Fix this by saving only the target shape with Cache::save_split() and loading only single shape from split cache files. The targetShape is erased from hashy.byshape

The split cache files have to be "boot-strapped" before -u flag is used: Run cubes -n 5 -w -s first Then cubes -n 6 -w -c -s -u can continue from this point on step by step.

@bertie2 @nsch0e please review.

Edit: I ran this further and looks like cubes -n 11 -w -c -s -u fails.. I assumed with the fixup that split cache files should contain only single shape, but I don't know if this is the case?

@nsch0e explained that the shape table may contain empty sections, so my numShapes <= numPolycubes assumption was wrong.