Computer Science in Science PD: The Tutorial #6

PART 6: Create Agents

REMIX “Orientation – version 2” and rename it as “Orientation – version 3” in your public gallery. In this part of the tutorial, you will program “The World” to create some Turtle agents when the user clicks the setup button.

  1. Click on the page tab to switch to “The World” page. You already dropped blocks onto this page in the last task.

  2. Now it is your turn to put the blocks together into a procedure that the World will carry out when the setup button is pushed.

  3. Here’s what the blocks do:

  • The “when pushed” block on the World Page tells the world what to do when the Setup button is pushed.
  • The “create-do” block allows users to create particular numbers of agents of certain type or breed, then have each of the newly created agents perform the commands within the “do” area right away.
  • The “clear terrain” block erases any drawing on the terrain.
  • The “delete everyone” block gets rid of any agents in Spaceland.
  • The “forward” block moves the agent forward.
  1. Try combining the blocks so that when the setup button is pushed, five turtles get created and each of the turtles moves forward 2 steps away from the center of Spaceland.
    After making changes to your program, always click “Save” to save your changes, and always click “Run Code” before running your project.

  2. Check Your Progress:
    After you have made changes and saved your work, click “Run Code” then scroll back up to Spaceland, and click the “Setup” button. When you’ve successfully assembled these blocks, you should see a set of white blocks (the agents you created) in the center of Spaceland.

Congratulations! You’ve created your first agents. Notice that they were all “born” in the center of Spaceland at coordinate (0, 0) facing outward, then they took 2 steps forward just as you instructed them to.

Save your “Orientation – version 3” project in your public gallery.

This is a companion discussion topic for the original entry at