Log In  

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

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(0x95a6)
circfill(64,64,40,0xacd)
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)

1

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)
1

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

P#130567 2023-06-05 20:58
1

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

P#130571 2023-06-06 01:31
2

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:

https://notes.yip.pe/notes/notes/A%20taxonomy%20of%204x4%20patterns%20Thread.html

P#130572 2023-06-06 01:37
1

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)

Nice work! I'm wondering what the letters are about (e.g.,803C)

P#136358 2023-10-25 04:29
1

these letters are actually numbers! the hexadecimal number 8017 is more compact than 32791, both being much shorter than the binary form 1111101010001 which represents pixels on and off in the fill pattern

resources:
https://www.lexaloffle.com/dl/docs/pico-8_manual.html#FILLP
https://mboffin.itch.io/pico8-fill-patterns
https://seansleblanc.itch.io/pico-8-fillp-tool

P#136375 2023-10-25 15:14 ( Edited 2023-10-25 15:15)

[Please log in to post a comment]

Follow Lexaloffle:          
Generated 2024-02-23 06:51:17 | 0.037s | Q:30