Professional Documents
Culture Documents
``
Click on the white space to the left
of the screen once button is
selected. A button prompt will
come up. Type in the under the
Commands line
Setup
Hit ok
``
Click on the Code Tab above so in
order to add the Setup button code.
``
Click the Check Mark. This makes
sure we dont have errors in our
code and will change from green to
gray if everything is ok.
``
Click the Code Tab. Use the zoom
magnifying glass to see how to write
the code on the left.
This time we want to add turtles our
agent base value and set them to
random x and y coordinates.
Type right after clear all before the
end:
create-turtles 50
[
setxy random xcor random ycor
]
This adds 50 turtles or triangles on
the screen. We need to use brackets
when we assign each the
coordinates. [ for opening and
] for closing like a sandwich bun
the meat is your code that goes in-
between.
Click the Check mark to make
sure there are no syntax errors. It
will turn from green to gray.
``
Click on the Setup button we
made.
The turtles now show up in the
center of the display screen as seen
on the left.
``
The go button will turn red and a
loop arrows will appear.
Its red because we dont have any
code for the button in the coding
tab. The loop arrows appear
indicating that it will run in a
forever loop until clicked on again.
``
Click on the interface tab,
Now click on the go button we
made,
The turtles will now move around
until unclicked. They are on a
forever loop.
(Optional step)
Right Click the go button we made
to click edit and the button opens.
Unclick the forever box to see the
turtles move one step at a time.
Click ok at the bottom of the
button.
Hit the go button we made now
Each time you hit go it will move
the turtles one step.
``
(Optional step)
Right Click the go button we made
to click edit and the button opens.
Re-click the forever box to see the
turtles until go is unclicked.
Click ok at the bottom of the
button.
Hit the go button we made now
The turtles move until unclicked.
``