(This isn't entirelyEdit: This is now a valid because C++ doesn't allow nested functions. Seeanswer, thanks to the code belowforward declarations of GR
and BL
.)
Now for the (not quite valid) code. I need the recursive function to compute the sequence, which I can't put inside the colour functions, unfortunately. However, ifTo do that I use did add the length of the preliminary codeRD
whenever j
is negative. Unfortunately, that does not leave enough characters to each ofcompute the function bodiesred channel value itself, they would be 139 bytes each:so RD
in turn calls GR
with an offset to produce the red channel.
int h[1000];
int f(int n){if(!h[n])h[n]=n<2?1:f(n-f(n-1))+f(n-f(n-2));returnunsigned h[n];}
charshort red_fnRD(int i,int j){
returnstatic 256-f(sqrt(int h[1000];return j<0?h[i]?h[i]:h[i]=i<2?1:RD(i-256)*RD(i-2561,j)+(,j-256)*+RD(ji-256RD(i-2,j),j)/2.9:GR(i+256,j+512);
}
charunsigned green_fnshort GR(int i,int j){
return 256DIM-f4*RD(sqrt((i-512)*(i-512)+(j-768)*(j-768))/2.9,-1);
}
charunsigned blue_fnshort BL(int i,int j){
return 256DIM-f4*RD(sqrt((i-768)*(i-768)+(j-256)*(j-256))/2.9,-1);
}
Of course, this is pretty much the simplest possible usage of the sequence, and there are loads of characters left. Feel free to borrow it and do other crazy things with it!
Here is another version where the boundary and the colours are determined by the Q-sequence. In this case, there was enough room in RD
so that I didn't even need the forward declaration:
charunsigned red_fnshort RD(int i,int j){
returnstatic 2*fint h[1024];return j<0?h[i]?h[i]:h[i]=i<2?1:RD(i)-i+512>1023RD(i-1,j?f),j)+RD(i)/-RD(i-2.4,j),j):fRD(2*RD(i,-1)-i+512>1023-j?i:1023-i,-1)/20.4;6;
}
charunsigned green_fnshort GR(int i,int j){
return red_fnRD(i, j);
}
charunsigned blue_fnshort BL(int i,int j){
return red_fnRD(i, j);
}