1. Member
Join Date
Apr 2011
Posts
4
Rep Power
0

## spiral recursion

first part does a spiral
second part is in recursion but its not workin
can anyone help

// variables used for ends of lines
int x1 = 0;
int y1 = 0;
int x2 = 0;
int y2 = 0;;

int offset = 5;

// set initial starting values for line
x1 = 200; // find center of width
y1 = 100; // find center of height

// set initial endpoints for line
x2 = x1 + 100;
y2 = y1;

// in a loop draw line and change endpoints
for( int i=0; i<=20; i++) {
myCanvas.drawLine(x1,y1,x2,y2);
x1+=offset;
y2+=offset;
myCanvas.wait(15);
}*/

//This is the recursive method for the draw2 exercise
//recursiveDraw2(200,300,100,100,5,20);

}//end method draw2()

/** Uncomment the method and insert the correct parameters...*/

//Recursive method for draw2 exercise
void recursiveDraw2(int x1,int y1,int x2,int y2,int offset,int i){

if (i==0){
myCanvas.drawLine(x1,y1,x2,y2);
myCanvas.wait(15);
}

else {

//Draw line correspondent to actual iteration
myCanvas.drawLine(x1,y1,x2,y2);
myCanvas.wait(15);

//Draw the next line in a recursive way
recursiveDraw2(x1,y1+offset,x2,y2+offset,offset,i-1);

}
}

2. [max smart]
Ahh the old "dump your homework and expect someone else to fix it" trick
[/max smart]

3. Member
Join Date
Apr 2011
Posts
4
Rep Power
0
Aaaahhh yes the good ol typical member that has nothing else to do but ...

4. But what? I'm dying of suspense.

5. Ahh yes the stupid n00b who thinks that making snide remarks about those that they are asking for help will work!

6. Member
Join Date
Apr 2011
Posts
4
Rep Power
0
Ah yes ...indeed yes

7. Oh boy, war inc.

8. Member
Join Date
Apr 2011
Posts
4
Rep Power
0
It's okay I was looking for ideas. Junky your the man !

9. If it is ideas you want then here's one: provide more information.

10. Many useful ideas here.

db

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•