Contributions to http://techkim.wikispaces.com/ are licensed under a Creative Commons Attribution Non-Commercial 3.0 License.

Portions not contributed by visitors are Copyright 2018 Tangient LLC

TES: The largest network of teachers in the world

Portions not contributed by visitors are Copyright 2018 Tangient LLC

TES: The largest network of teachers in the world

Loading...

## Basic Logo Commands

In the NetLogo Command Center at the bottom of the window, you will see that you can switch between observer, turtles, patches & links by clicking on

. The first commands you need to learn are eitherobservercommands - to setup your environment orobservercommands - to move your turtles.turtle

ca - clear allObserver commandscrt

number- creates the number of turtles specified

fdTurtle commandsnumber- moves the turtle(s) forward the number of steps specifiedbk

number- moves the turtle(s) backward the number of steps specifiedpd - puts the pen down, so when the turtle(s) move, they will leave a mark

pu - puts the pen up

rt

number- turns the turtle(s) rt the number of degrees specifiedlt

number- turns the turtle(s) lt the number of degreed specifiedrepeat

number[ ] - repeats the commands in the brackets the number of times specified

To create a squareCreate a squareWith the command center set to observer>, type:

ca

crt 1

Change the command center to turtles> and then type:

pd

fd 10

rt 90

fd 10

rt 90

fd 10

rt 90

fd 10

rt 90

There's a more efficient way to create the square using the repeat command. Can you figure it out? Try creating multiple turtles and use the repeat command to create patterns.

Here's an example of using the repeat command:

repeat 10 [fd 4 rt 34 bk 1 lt 180 fd 7 lt 66 bk 3]

If you get an error, check your

. Just like there are rules of language that dictate how the various parts of a sentence go together, programming languages also have rules for how a set of instructions can be put together. If you miss a bracket or forget to tell the program how many spaces to move forward, then you will receive a syntax error.syntax## Next Lesson

Turtle shapes