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 http://studio.code.org/s/sciencePD/stage/11/puzzle/6

http://www.slnova.org/carrie.crawford/projects/61180/

http://www.slnova.org/bmcfall/projects/61525/

http://www.slnova.org/bmcfall/projects/61637/

http://www.slnova.org/dmeltsner/projects/62293/

http://www.slnova.org/dbloch/projects/62332/

http://www.slnova.org/SBChorba/projects/62511/

http://www.slnova.org/jojobean100/projects/63212/edit/

http://www.slnova.org/edelpino/projects/64526/

http://www.slnova.org/mszscience/projects/64904/

http://www.slnova.org/casero20/projects/65008/

http://www.slnova.org/shemerson/projects/65016/

http://www.slnova.org/sarah.gordy/projects/65064/

http://www.slnova.org/wellalan/projects/65073/

http://www.slnova.org/dejahlm/projects/64928/

http://www.slnova.org/hbainer/projects/65131/

http://www.slnova.org/Gladiator%241/projects/65132/

http://www.slnova.org/paugh.rebecca/projects/65172/

http://www.slnova.org/bhollingsworth/projects/65196/

http://www.slnova.org/Turtle%24k8/projects/65222/