Teacher's Guide

Chapter 2 / Level3: Collecting Resources

Teaching Objective:

  • Student learns how the collect() function works
  • Understands how the function can interface with water() and other functions
  • Understands how to use several conjoining functions together to solve a problem

Guide

Sometimes your canteen will be empty and you’ll need water to fill it up. You can collect more water by facing a water supply and typing the collect() function and writing “water” inside the function.

player.collect("water")

You need to make sure you write the word “water” exactly as written in order to collect it successfully. After you collect the water head over to the three X marks and use the water() function learned in the previous level to water the crops.

player.water()

You need to make sure you are facing the object you wish to water otherwise it won’t work.

Map overview and path

Map overview and path

Code Solution

import player

player.move_forward(2)
player.turn_left()
player.move_forward(5)
player.turn_left()
player.collect("water")
player.turn_right()
player.turn_right()
player.move_forward(2)
player.water()
player.turn_right()
player.move_forward(2)
player.turn_left()
player.water()
player.turn_right()
player.move_forward(2)
player.turn_left()
player.water()
player.turn_right()
player.move_forward(2)
player.turn_left()
player.water()
player.turn_right()
player.move_forward(2)
player.turn_left()
player.water()
Chapter 2 / Level3: Collecting Resources | Teacher's Guide