I think generate.py is trying to choose a number of levels that would result in it stopping when the last level has one tile. But sometimes it does an extra level, downscaling again after it has already done a level with a single tile.
This little script tries to reproduce what generate.py is doing at different sizes:
In the edge case condition on line 200, if you used int() instead of round(), matching the rounding of the size in the tiling loop, then I think it would work correctly. I can give you that as a pull request if you prefer.
I think generate.py is trying to choose a number of levels that would result in it stopping when the last level has one tile. But sometimes it does an extra level, downscaling again after it has already done a level with a single tile.
This little script tries to reproduce what generate.py is doing at different sizes:
In the edge case condition on line 200, if you used
int()
instead ofround()
, matching the rounding of the size in the tiling loop, then I think it would work correctly. I can give you that as a pull request if you prefer.I haven't actually confirmed this by running generate.py. I'm reading the code because I'm reimplementing generate.py in C++.