Log In  

Cart #fillp_cat-2 | 2023-06-06 | Code ▽ | Embed ▽ | License: CC4-BY-NC-SA

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():

fillp() -- reset

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.

P#130531 2023-06-05 09:02 ( Edited 2023-06-06 01:27)


that looks pretty handy.

P#130535 2023-06-05 11:34

Ha super helpful to quickly choose a pattern 👍

📈 Perfs note:
since search() is called in _draw() and the optimistic stat(1)<.98 causes it to run most of the time at 15/30fps I've tweaked the cpu check at stat(1)<.96 and it runs quite faster. Comparison: launching this <.98 one and immediately after the tweaked <.96, the latter reaches 100% while the other is still around 65%

P#130561 2023-06-05 17:35 ( Edited 2023-06-05 17:37)

love to see the classic «repeated diagonal brick» from gb pokemon!

P#130567 2023-06-05 20:58

Nice one @Heracleum -- I fixed that in #fillp_cat-2.

P#130571 2023-06-06 01:31

Over on mastodon, @[email protected] directed me towards her taxonomy of 4x4 patterns, which uses the same symmetries to group patterns in interesting ways with cute names:


P#130572 2023-06-06 01:37

As a zx81 fan & programmer, I see mazes, space ships and a ton of beatifull shapes...

Thanks, I always learn a lot from your code!

P#130579 2023-06-06 03:09 ( Edited 2023-08-18 06:11)

[Please log in to post a comment]

Follow Lexaloffle:          
Generated 2023-10-01 02:14:57 | 0.116s | Q:26