Talk:Wave function collapse: Difference between revisions

m
Line 16:
: That is an algorithm which works, but it's not the only valid approach. For example, instead of using indices, we could use a bitmask. Here, if a single bit is set, that selects the tile. If multiple bits are set, the tile has not yet been determined. The number of set bits in the bitmask here would be the entropy of that grid location.
 
: AlsoAnd/or, instead of scanning the full list of unassigned grid locations, we could instead maintain a list of unassigned grid locations for each level of entropy. For the current task example, this would be four lists, corresponding to: entropy 2, 3, 4 or 5. Here, we would want data structure support locating a list entry from a grid location, and vice versa, and it would be convenient to also be tracking the length of each list. But the extra storage and data movement weight per-item would tend to be countered by the need to inspect fewer grid locations at each stage of iteration (adding a tile to the grid would change entropy for at most four grid locations).
 
: There's probably other possibilities (some which might have better performance on large examples due to memory cache structures). That said... for rosettacode, it's probably best to ignore optimizations which have introduce high code complexity. --[[User:Rdm|Rdm]] ([[User talk:Rdm|talk]]) 13:26, 12 July 2022 (UTC)
6,951

edits