[Back to GSN Home Page] [Back to Message Index]

Global SchoolNet - Automated Message Archive

Re: LOGO-L> MicroWorlds Query: random setpos?




Douglas Clements (clements@mailhub.acsu.buffalo.edu)
Sat, 3 Feb 1996 11:44:22 -0600

I would like to
>pose another to the list:
>
>I'm trying to send a turtle (or multiple turtles) to random positions on
>the screen. Here's the best I could figure:
>
>setpos [random 250 random 250]
>
>This doesn't work because setpos only gets one input.
>
>I'm sure the solution lies in an extra set of parentheses or brackets.
>
>My students and I appreciate your help.
>
>Bill Donaldson
>Public School 11
>NY, NY

Bill,

Double quotes (for words) and brackets (for lists) in Logo mean "do not
evaluate this expression"; so, your [random 250 random 250] goes to setpos
just as it is...[random 250 random 250]. Instead, assemble a LIST of two
random numbers, such as:

setpos list random 250 random 250

or

setpos sentence random 250 random 250

If you wish to use all four quadrants, then you need to get negative
numbers in there; depending on the size of your screen, it might be:

setpos sentence (250 - random 500) (250 - random 500)

Doug

* * * > > > > * * * < < < < * * *

Douglas H. Clements
State University of New York at Buffalo
Department of Learning and Instruction
593 Baldy Hall
Buffalo, NY 14260

1339 North Forest Rd.
Building B, Apt. #15
Williamsville, NY 14221-2155

Internet e-mail address: clements@acsu.buffalo.edu
Voice: 716-645-3158

---------------------------------------------------------------
Please post messages to the Logo forum to logo-l@gsn.org. Mail
questions about the list administration to logofdn@gsn.org. To
unsubscribe send unsubscribe logo-l to majordomo@gsn.org.