## ONE-LINERS: Grow a picture or video from a single line of C or Python code |

**I get a text picture that says there's an error but it's not very helpful.
**

Unfortunately I can't relay better debug information. Usually the best thing to do is try a simplified version of what you want then build up from that.

**I get a text picture that says there are only a few library functions I
can use. I'd like more.
**

Yes, the only things available are a subset of the python math module that provides the most commonly used mathematical functions from the C library. If additional functions would be really useful, you could email me a request.

**The picture is just like the last one I made, not what it should be.
**

Your C expression got past the interpreter in a way that I was not able to catch. This is unusual. More often you get the general error picture.

**The picture is in colour but it's supposed to be greyscale. **

You have used one of the strings "red", "green", "blue", somewhere.

**Oh no I haven't. **

Ah, you've used "rand()" and you'd like it to just produce a single random value at (x,y) not separate values for red, green and blue? It's a fair cop. That was an implementation decision I'm afraid.

**The picture is supposed to be in colour, but not those
colours.**

When a colour is multiplied by a negative value, that colour is taken away! (Try setting the picture to -1*green, for example.) It's usually simplest to keep your colours positive.

**The ternary operator isn't working right.
**

Try using multiplications by conditions rather than ternary operator. Also add brackets for extra parsing protection. But, I have to fess up, there is something a bit broken here. Annoyingly Python doesn't provide a plug-in replacement for C's (much superior) ternary operator. To do full, robust translation, you need to implement a mini-parser to rearrange keywords and associations to any depth of complexity. I haven't done that, so sometimes things go wrong. Sorry.

**One-liners are just 256 x 256 pixels. Can't they be bigger?**

They certainly can be bigger, but you wouldn't want to run the program on a webserver. Here's a 2048 x 2048 one-liner (click on the image to get the full-sized version). Higher resolutions better reveal how much detail you can get out of a one-liner. This coiled green tube, complete with all its shading and simulated specular reflections is generated from the single line:

green*sqrt(sqrt(2*(x*x+y*y) - 2*sqrt(x*x+y*y)*(x*cos(sqrt(x*x+y*y)/40.0)+y*sin(sqrt(x*x+y*y)/40.0))))-red*sqrt(sqrt(2*(x*x+y*y) - 2*sqrt(x*x+y*y)*(x*cos(sqrt(x*x+y*y)/30.0)+y*sin(sqrt(x*x+y*y)/30.0))))-blue*sqrt(sqrt(2*(x*x+y*y) - 2*sqrt(x*x+y*y)*(x*cos(sqrt(x*x+y*y)/50.0)+y*sin(sqrt(x*x+y*y)/50.0))))