Developing NNN Patterns

I have been trying to work on the art/science of developing interesting NNN patterns. It seems difficult to create a rule for most patterns that would quickly come to the imagination, since a bit can only be influence by the five bits directly around and preceding it. So, for example, a rule component that might produce a desirable behavior on the fourth line of a pattern, might conflict with desired behavior on the second line.

One approach I have is to figure out the rule for a very basic two or three line pattern, starting with a single pixel. E.g., rule 0,4,1,2 gives us:

O O O O X O O O O
O O X O O X O O O
X O O O X O X O O

nnn000_004_001_002

The overall graphic is not very interesting, though it is a bit more so as you zoom into the pattern which walks to one side:

nnn000_004_001_002zoom

Also when it collides with itself and bends:

nnn000_004_001_002zoom2

But, how can we make this design more interesting? Next step is to try to introduce a rule component to try to prevent convergence, i.e., disrupt it when it starts to get boring. One interesting tweak was 0,6,1,2 (X O O O X -> X) creating a triangle texture:

nnn000_006_001_002

Another was 0,20,1,2 (X O X O O -> X), which does not prevent convergence, but it does create a scale-like texture:

nnn001_020_001_002

nnn000_020_001_002zoom.png

Posted in NNN

NNN 1,32,65,28

Another interesting rule is 1,32,65,28, which starting from a single dot, proceeds

O O O O X O O O O
O O O X X X O O O
O O X O X O X O O
O X O O X O O X O

It does not grow, but seems rather to converge on a single small triangle, or one of several smaller patterns (graphic growing from the bottom):

nnn001_032_065_028

This is a close-up starting with just one dot:

nn001_032_065_028x

Two dots:

nn001_032_065_028xx

And then, a dot, dot, blank, dot, dot line:

nnn001_032_065_028xxoxx

Posted in NNN

Serpinski’s Triangle – Single Point NNN

I adjusted parameters to have the NNN progress from a single point rather than a line of random pixels. Now the rule 0,0,1,4 gives clearly Serpinkski’s Triangle. Now, drawing happens to be from the bottom of the screen, so the triangle is upside down from the usual representation:nnn000_000_001_004_singleWe achieve the infinite resolution of the fractal, not in our ability to zoom in as much as we want, but rather in our ability to zoom out.

Again, rule 0,0,1,4 simply means pixel white if we see B W B B B or B B B W B in the five pixels above it (or rather, below it, in the above graphical representation.

Screenshot from 2018-08-28 13-57-36

Posted in NNN

NNN Study

I’ve recently had a reawakened interest in Next Nearest Neighbor patterns and fractals. My previous work was to randomly generate NNN rules and then browse through the results, looking for interesting designs. But now I am wondering what can be done to “program” a rule, so as to produce a desired pattern or fractal.

Constructing a rule is to construct a 32 bit value, where each bit represents how a new dot responds to a certain pattern of 5 dots above (or below) it. The rule could be represented as a 32 bit binary value, but an four 8 bit values are more convenient. It helps me to have a spreadsheet like so:

Screenshot from 2018-08-28 13-57-36.png

A simple but dynamic example indicated above is rule 0.0.1.4. If we start with line

O O O O X O O O O

then the rule produces
O O O O X O O O O
O O O X O X O O O

This seems rather simple, but if we start with a random line of bits, and continue on the process for a lot more steps, we get something like so (with the lines come up from the bottom):

nnn000_000_001_004.png

Zooming a little closer, we see:

Screenshot from 2018-08-28 14-04-18.png

You can see a pattern like Serpinski’s Triangle owing to the fact that the rule allows the pattern to repeat as we progress to enough lines.

O O O O X O O O O
O O O X O X O O O
O O X O O O X O O
O X O X O X O X O

On the other hand, there is additional variety as the patterns, starting in different parts of the random line, collide with each other. The rule produces varying effects at various collision borders. I think it would be helpful to my study to be able to start with just a single dot, rather than multiple lines, but I need to do a small amount of additional programming first.

For the graphics generation, I had to dust off my old autom program written in Haskell. The program’s dependencies currently will not work with Debian 9, so I just installed Debian 8 on an old laptop and ran the program from the laptop.

I do not have time to write more on this subject today, but I here are a few additional constructed patterns for fun:

0.0.1.2

O O O O X O O O O
O O X O O X O O O

nnn000_000_001_002

This one is a bit more complicated:

48.16.88.44

nnn48_16_88_44

Zooming in, we see:

Screenshot from 2018-08-28 14-29-22.png

Posted in NNN

Arduino NNN Fractal

20180821_165604

I was able to get the Arduino Mega 2560 to calculate and draw a next nearest neighbor fractal using uLisp-TFT. However, I had to use some rather aggressive GC to keep from running out of memory, which slowed the calculation down very much (about 8 or 9 hours for this image). I only need to store two lines of pixels at a time, but I think data extraction and rule-related calculation creates a lot of intermediate lisp objects. To make this practical I think I need to re-implement the core NNN functions in C, leaving the Lisp rule selection and drawing interface on top.

uLisp code is available here: http://download.savannah.nongnu.org/releases/ulisp-tft/nnn-slow.tar.gz

This call should get you a similar image:

(lcdinit)

(drawnnn (buildf32 187 71 254 245) (randomline 30))

30 is for 30 blocks of 16 pixels, i.e., start with 480 pixel line.