Hi - I am using grasshopper to create a pattern where certain percentages of colors are randomly distributed and repeated. The results have been pretty good, except that some grouping has resulted from the randomization, i.e. several colors are ending up next to each other, forming shapes. I want to use a script that will require colors to not be grouped next two more than 2 of the same color. Does anyone know how to do this?
the way you created the jitter gives the repeating pattern
there is a delete consecutive component to help too
if you upload the script we can probably help better
You may want to read through
Paver Study.gh (5.9 KB)
I’ve uploaded the script. I tried @dowazura’s solution, but the result was the same. Maybe it’s the jitter as @Will_Wang suggested? Any help with the script would be appreciated!
Meanwhile I’ll keep perusing the four color theorem link
There is no magical solution, with n color script you will get something like that
After that you could try to replace certain colors with the constrains you have. You will have to make some code to do that.
Here’s an idea. Since you want to populate a rectangular grid with four colours without any two adjacent cells sharing the same colour, create two chequerboard patterns and then randomly pick from one or the other to create the final pattern.
forum-pavercolors.gh (18.9 KB)
this will do what Laurent Delrieu mentioned
but this also eliminates any same-color adjacency altogether
Wow - no easy solution I guess. It doesn’t help that I have an older version of Grasshopper. Will, I wasn’t able to get your script going either, maybe because of a compatibility issue. Recognize this pop up at all?
Those are standard components in more recent versions of Grasshopper.
if you have rhino 5 you should download the ghpython component
don’t really need the relay. you can re-link the u and v into the proper parameter inputs
list item is already in rhino5/gh0.9 so you can just replace that
Hey @Will_Wang,
thanks for the script - I recoded a bit so it can take more than 3 colours.
forum-pavercolors.gh (19.3 KB)
Kindest
Christian