List Info

Thread: Re: retrieving who




Re: retrieving who
country flaguser name
United States
2008-06-03 08:55:45

>
> I am pretty new in netlogo's world, I wonder if you can help me with a simple question.
>
> How can I ask a turtle to inform me about his ID?
>
> I know how to use the who function to select a particular turtle but I do not know how to ask the turtle to give me ID.
>
> The dictionary says: "
> You can use the turtle reporter to retrieve a turtle with a given
> who number" but I cannot find out how to do it from the code
>;

Hi Manuel -

You should probably take a look at the variables section of the
programming guide:

http://ccl.northwestern.edu/netlogo/docs/programming.html#variables

turtles can access their own variables directly, for example.

ask turtles[ print who ]

will print the who numbers of all the turtles to the command center.

the observer can access turtle variables using OF, for example:

print [who] of turtle 0

will print '0' to the command center.

hope this helps.

esther

__._,_.___
.

__,_._,___
Re: retrieving who
country flaguser name
United States
2008-06-04 19:13:12

THANKS, ESTHER AND HOWARD FOR YOUR HELP!



--- EL MAR 3-JUN-08, ESTHER VERREAU <EVERREAUCCL.NORTHWESTERN.EDU> ESCRIBIó:
DE: ESTHER VERREAU <EVERREAUCCL.NORTHWESTERN.EDU>
ASUNTO: RE: [NETLOGO-USERS] RETRIEVING WHO
PARA: NETLOGO-USERSYAHOOGROUPS.COM
FECHA: MARTES, 3 DE JUNIO DE 2008, 10:55 AM

>
&GT; I AM PRETTY NEW IN NETLOGO'S WORLD, I WONDER IF YOU CAN HELP ME WITH A SIMPLE QUESTION.
>
&GT; HOW CAN I ASK A TURTLE TO INFORM ME ABOUT HIS ID?
>
> I KNOW HOW TO USE THE WHO FUNCTION TO SELECT A PARTICULAR TURTLE BUT I DO NOT KNOW HOW TO ASK THE TURTLE TO GIVE ME ID.
>
> THE DICTIONARY SAYS: "
> YOU CAN USE THE TURTLE REPORTER TO RETRIEVE A TURTLE WITH A GIVEN
&GT; WHO NUMBER" BUT I CANNOT FIND OUT HOW TO DO IT FROM THE CODE
>;

HI MANUEL -

YOU SHOULD PROBABLY TAKE A LOOK AT THE VARIABLES SECTION OF THE
PROGRAMMING GUIDE:

HTTP://CCL.NORTHWES TERN.EDU/ NETLOGO/DOCS/ PROGRAMMING. HTML#VARIABLES

TURTLES CAN ACCESS THEIR OWN VARIABLES DIRECTLY, FOR EXAMPLE.

ASK TURTLES[ PRINT WHO ]

WILL PRINT THE WHO NUMBERS OF ALL THE TURTLES TO THE COMMAND CENTER.

THE OBSERVER CAN ACCESS TURTLE VARIABLES USING OF, FOR EXAMPLE:

PRINT [WHO] OF TURTLE 0

WILL PRINT '0' TO THE COMMAND CENTER.

HOPE THIS HELPS.

ESTHER


__________________________________________________
CORREO YAHOO!
ESPACIO PARA TODOS TUS MENSAJES, ANTIVIRUS Y ANTISPAM ¡GRATIS!
¡ABRí TU CUENTA YA! - HTTP://CORREO.YAHOO.COM.AR

__._,_.___
.

__,_._,___
[1-2]

about | contact  Other archives ( Real Estate discussion Medical topics )