Talk About Network



Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > Logo > [LogoForum] Re:...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 1 of 2 Topic 1533 of 1588
Post > Topic >>

[LogoForum] Re: How can I shrink/grow squares in mswlogo

by "John St. Clair" <john.stclair@[EMAIL PROTECTED] > Jan 23, 2008 at 10:44 PM

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 important 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




 2 Posts in Topic:
[LogoForum] Re: How can I shrink/grow squares in mswlogo
"John St. Clair"  2008-01-23 22:44:19 
Re: [LogoForum] Re: How can I shrink/grow squares in mswlogo
"John St. Clair"  2008-01-23 22:47:27 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Wed May 14 5:51:18 CDT 2008.