Saturday, June 13, 2015

Generating looping color gradients with a limited palette

I was trying to generate a Mandelbrot set fractal in Minecraft using a python script. But the palette available is very limited, which led me to thinking how to generate a pleasing color progression out of a limited palette, and then I had a neat idea: just solve the Traveling Salesman Problem for the palette in RGB space. This generates a color progression that can be nicely used for looping the colors. The first version uses the larger palette of wool+hardened clay+redstone (and a version of this simulated annealing code), while the second drops the hardened clay (and now we can get an exact solution using this code).


Austin said...

Since you often post about Python, I'm curious about what sorts of things (other than Minecraft) you use it for? I just began taking an online course in Python for fun (I already know how to program in general, but am not really proficient in any one high level language), and am interested in finding practical applications for it. For example, I'd like to apply it to web-design at some point, and I've thought about purchasing an Anrduino board and using Python for some basic automation projects.

Alexander R Pruss said...

To be honest, I don't use it for other things. For text processing (e.g., changing file formats) and server side scripts, I use perl. For computation, I tend to use C, though occasionally I've used perl. For Android, I use java.