我是一个相当新的Java,我正在学习递归我发现了一些很酷的东西,比如这个链接实现了递归,以便做一个波斯地毯.我想将这个代码实现到java中
float a = 1.0;
int left = 0;
int right = 340;
int top = 0;
int bot = 340;
int r,g,b;
color firstColor;
color backC;
//color backC = color(35,95,28);
void setup()
{
//size(700, 700);
size(341, 341);
r = floor(random(1,255));
g = floor(random(1,255));
b = floor(random(1,255));
firstColor = color(g);
backC = color(r,g,b);
background(backC);
stroke(firstColor);
line(left,top,right,top);
line(left,bot,right,bot);
line(left,top,left,bot);
line(right,top,right,bot);
a = random(1,6);
chooseColor(left, right, top, bot, a);
}
void draw()
{}
void chooseColor(int left, int right, int top, int bot, …Run Code Online (Sandbox Code Playgroud)