Conversation
|
Still needs work to account for transparent tiles and item tiles |
There was a problem hiding this comment.
Looks fine for me, but would appreciate a look from @duncathan if possible
| tile next to them. Non-item tiles can use any blank tile, but solitary tiles are preferred | ||
| to save more tiles for item tiles.""" | ||
| valid_tile_id: int | None = None | ||
| for tile_id in blank_tile_ids: |
There was a problem hiding this comment.
iterating over a set is generally inadvisable because the order is not guaranteed
There was a problem hiding this comment.
The order does not matter
There was a problem hiding this comment.
if we're trying to maximize open space, then it does matter since otherwise you could end up running out of viable slots for item tiles if you get unlucky enough with the random order you get. it would be much more robust and predictable to iterate over sorted(blank_tile_ids)
There was a problem hiding this comment.
It would use the same amount of space whether they're sorted or not. If you look at the code, non-item tiles explicitly check for solitary tiles so that tile pairs are saved for item tiles
There was a problem hiding this comment.
consider a trivial example where you have two item tiles to make and four blank spaces, {0, 1, 2, 3}. if the first item tile happens to land on index 1 first, it'll take up tiles 1 and 2 and there will be no space for the second one
There was a problem hiding this comment.
I see now. I don't think it will be an issue in practice but I can change it
change_minimap_tilesin door_locks.py to create an add new tiles when they don't already existBLANK_TILE_IDSin minimap_tiles.py)Fixes #164