Fill Pattern Catalogue

0
0
Published 2023-06-12


This is a little tool for viewing all possible 4x4 fill patterns, after removing duplicates which are the same pattern inverted, translated, rotated, or flipped in x/y/diagonally. There are 65536 possible raw fill patterns (1 << 16), but only 433 unique patterns once "equivalent" ones have been discarded.

To use a fill pattern that you like, prefix it with "0x" (it is a hexadecimal number) and pass it fillp():

Press UP and DOWN to browse the catalogue, [X] to invert and [O] (z/c) to hide the info bar.

I don't know if there is a more efficient way to calculate groups (or the number of groups) for these equivalence relations, but PICO-8 is more than fast enough to brute force it, so that's what this cartridge does! For each 16-bit fill pattern, its group id (the "orbit") is calculated by applying every combination of transformation and returning the lowest result. If that value not already found in the list of patterns, it is added.

I was able to take a few shortcuts though -- for example, calculating 90 degree rotations is not necessary, because for every orientation there is a combinations of flipping in x, y and through the diagonal (transpose) that is equivalent to that rotation.