In a word: Build a 1024*1024 color matrix with limited code, show your programming & Art Beauty
One of the problems that originated in Stackexchange is a bit of an extension that supports more programming languages and relaxes the limits of code length.
Rules
Goal:
By implementing a function Get_color_at (x, y) in the template, draw the "interesting" pattern on a 1024*1024 canvas.
Parameters:
int x, int y, values are 0-1023, corresponding to the canvas on the punctuation, the upper left corner is the starting point (0,0)
Return:
int r, int g, int b, int alpha, RGBA component of corresponding color, all 0-255.
Attention:
The alpha component definitions in each language may be different, and the unified conversion of the template to: 0-255, the greater the value the more transparent.
Requirements:
You can only edit code in the Get_color_at (x, y) function body/{{Code start}}-//{{code end}} in the template;
The total number of code characters cannot exceed 1024, and is of good readability.
1 2 3 4 5 6 7 8 9 of |
if (typeof f_c== "undefined") {f_c=function (x,y,px,py,r) {return math.sqrt (Math.pow (x-px,2) +math.pow (y-py,2)) <=r ; }; } var x0=x-512,y0=y-512; r=g=b=128; if (F_c (x0,y0,0,0,512)) r=g=b= (x0>0) 255:0; if (F_c (x0,y0,0,256,256) &&x0<=0) r=g=b=255; if (F_c (x0,y0,0,-256,256) &&x0>0) r=g=b=0; if (F_c (x0,y0,0,256,64)) r=g=b=0; if (F_c (x0,y0,0,-256,64)) r=g=b=255; |