The message below is being cross-posted from the LogoForum. Please
reply here at comp.lang.logo and it will be cross-posted back to the
LogoForum. The original author of this message is
gene_sullivan@[EMAIL PROTECTED]
course the guts of the square-drawing code have to be in there.
I was highlighting the control structure.
repeat 4 [fd :side_length <lt or rt> 90]
I'm sure you will figure out where to insert this within
your implementation of `square' or `recursive_square'.
Cheers!
Gene
__._,_.___
LogoForum messages are archived at:
http://groups.yahoo.com/group/LogoForum
> The message below is being cross-posted from the LogoForum. Please
> reply here at comp.lang.logo and it will be cross-posted back to the
> LogoForum. The original author of this message is
> gene_sullivan@[EMAIL PROTECTED]
>
>
>
> --- In LogoForum@[EMAIL PROTECTED]
John St. Clair <john.stclair@[EMAIL PROTECTED]
>
> wrote:
> >
> > The message below is being cross-posted from comp.lang.logo. Please
> > reply to LogoForum@[EMAIL PROTECTED]
or a11 <ashabsurya@[EMAIL PROTECTED]
>.
> >
> > Hi
> >
> > I want to draw [ shrink or grow squares ] using recursion in logo
> > like stacking them . Can anyone please help me with this?
>
> Maybe. I'll let you decide how helpful this is.
>
> If you define a word `square' with a parameter for side length
> it is fairly easy to do as want.
> From inside your `square' you can invoke another square
> with the parameter fed the argument of the present call,
> which has been scaled -- either up or down -- by multiplying
> it by a number greater or less than 1, depending on whether
> you want larger or smaller squares.
>
> Of course, the im****tant issue is the `stop condition'.
> When entering the `square' word you are creating
> you will want to test for a stop condition so your
> recursive square doesn't recurse indefinitely.
>
> Here is a template
>
> to square :side_length :scaling_factor
> ;stop condition
> if not <too big or small> [
> square :side_length * :scaling_factor
> ]
> end
>
> Something like this --^.
> As to whether the stop condition is handled as
> a constant inside `square', a global variable,
> or a parameter is up to you.
>
> Q: what happens if one picks a scaling factor of 1?
>
> Best of luck,
> Gene
>
> >
> >
> > Thanks
> >
>
> __._,_.___
> LogoForum messages are archived at:
> http://groups.yahoo.com/group/LogoForum


|