Information about cookies on this page

Our website uses cookies to ensure the functionality of the website, to collect and analyze information about the performance and usage of the website. Privacy Policy

  • Courses
    • Discord
    • Twitter
    • Linkedin
    • Facebook
    • Instagram
  • Pricing
  • English
  • Čeština
  • Deutsch
  • Русский
Sign inStart free
  • Courses
  • Pricing

Community

Sign in
  
  • Courses
    • Discord
    • Twitter
    • Linkedin
    • Facebook
    • Instagram
  • Pricing
  • English
  • Čeština
  • Deutsch
  • Русский
Sign inStart free
  • Courses
  • Pricing

Community

Sign in

Turning

Congratulations on your first program! So far, though, the dog can only walk straight. Two new blocks change its direction:

  • Turn left ↺ turns the dog a quarter turn to the left,
  • Turn right ↻ turns it a quarter turn to the right.

The dog turns on the spot: a turn block doesn't move it anywhere, it only changes the direction the dog is facing. Only the next Move forward moves it, in the new direction. So to go around a corner, you need two blocks: turn, then move forward.

Left and right are from the dog's point of view, not yours. As long as the dog faces away from you (up the screen), its left and right are the same as yours, so you don't have to worry about it yet. You'll see what happens when the dog faces another way in the next exercise.

Before you start building, look at the map and count the tiles: how many steps the dog has to take before it turns, and how many after.

Instructions

  1. 1

    Get the dog to the goal: go up to the end of the path, turn right and walk to the goal.

Back

2/7

  1. 1. What Is an Algorithm
  2. 2. Turning
  3. 3. Left or Right?
  4. 4. Planning the Route
  5. 5. Finding Bugs
  6. 6. Collecting Bones
  7. 7. The Shortest Way
Next

Try it yourself

Do this exercise right here in your browser. No account needed.