Create Each Do/es: Difference between revisions
No edit summary |
(Updating to match new version of source page) |
||
(8 intermediate revisions by 2 users not shown) | |||
Line 3: | Line 3: | ||
[[Category: Agentes]] | [[Category: Agentes]] | ||
<section begin=image/>[[File:CreateEachDo.png|alt=Crear Cada uno hacer bloquear|thumb]]<section end=image/> | <section begin=image/>[[File:CreateEachDo.png|alt=Crear Cada uno hacer bloquear|thumb]]<section end=image/> | ||
<div lang="en" dir="ltr" class="mw-content-ltr"> | |||
The created agents have the default shape, color, and size specified in their breed’s ‘Show Traits’ area. They are created in the middle of the terrain, on the ground (x=0, y=0, z=0), with their headings evenly distributed, starting at 0 degrees (e.g. if 4 are created, one will start out facing toward each of the 4 sides of spaceland.) The turtles then follow the instructions provided within the each do hook once. | |||
</div> | |||
<section begin="name" />'''<code>crear [_] [_▼](s) cada uno hacer</code>'''<section end="name" /> es un [[bloque de código]] parte de [[Special:MyLanguage/agents|agentes]] cajón. | <section begin="name" />'''<code>crear [_] [_▼](s) cada uno hacer</code>'''<section end="name" /> es un [[bloque de código]] parte de [[Special:MyLanguage/agents|agentes]] cajón. | ||
Line 9: | Line 14: | ||
==Sintaxis== | ==Sintaxis== | ||
[[File:CED Nums ES.png|right|alt=The Create Each Do Block|thumb]] | |||
<!-- <code>crear [Textbox: Number of Agents to Create] [Dropdown: Type of Agent](s) each do [code]</code> --> | |||
Entradas en este bloque: | |||
#un número en el zócalo | |||
#una raza del menú desplegable | |||
#código relevante | |||
<div lang="en" dir="ltr" class="mw-content-ltr"> | |||
==Example== | |||
</div> | |||
< | <div lang="en" dir="ltr" class="mw-content-ltr"> | ||
[[File:create_each_do_example.gif|alt=Create Each Do example gif|thumb]] | |||
[[File:create_each_do_example.png|alt=Create Each Do example code|thumb]] | |||
</div> | |||
<div lang="en" dir="ltr" class="mw-content-ltr"> | <div lang="en" dir="ltr" class="mw-content-ltr"> | ||
When setup is pushed, The World creates 100 turtles, and each of those turtles follow the instructions within the “each do” block. In this example, each turtle takes on a random color and moves to a random position in spaceland. All turtles are created, change color, and relocate in one tick of the StarLogo clock. | |||
</div> | </div> | ||
Latest revision as of 18:18, 11 August 2023
The created agents have the default shape, color, and size specified in their breed’s ‘Show Traits’ area. They are created in the middle of the terrain, on the ground (x=0, y=0, z=0), with their headings evenly distributed, starting at 0 degrees (e.g. if 4 are created, one will start out facing toward each of the 4 sides of spaceland.) The turtles then follow the instructions provided within the each do hook once.
crear [_] [_▼](s) cada uno hacer
es un bloque de código parte de agentes cajón.
Uso
crear[_] [▼](s) cada uno hacer
se usa para poblar Spaceland con agentes y luego ejecutar un stack de código individualmente para cada agente. Esto puede ser útil para crear muchos agentes y configurar diferentes rasgos para cada.
Sintaxis
Entradas en este bloque:
- un número en el zócalo
- una raza del menú desplegable
- código relevante
Example
When setup is pushed, The World creates 100 turtles, and each of those turtles follow the instructions within the “each do” block. In this example, each turtle takes on a random color and moves to a random position in spaceland. All turtles are created, change color, and relocate in one tick of the StarLogo clock.
Para tener en cuenta
crear [_] [▼](s) cada uno hacer
es muy similar a crear [_] [▼](s)
. Ambos comandos crean agentes, pero generalmente crear [_] [▼](s) cada uno hacer
permite usos más complejos y potentes.
Bloques relacionados
Recursos en video relevantes