Teacher's Guide

Chapter 2 / Level 4: Opening and Closing commands

Teaching Objective:

  • Student learns how to use open() and close() functions
  • Understands how functions can reshape the map’s usable space
  • Understands what objects that can be manipulated using the functions and how they can be useful to solve problems.

Guide

In order to successfully complete this scenario the student must face the stable door signaled by the X mark and open it using the open() function.

player.open()

After they’re done going through the doorway head for the other X marks and close the doors by facing them and using the close() function.

player.close()

There is one door to open and four doors to close, once all those tasks are done the level will be complete.

Map overview and path

Map overview and path

Code Solution

import player

player.move_forward()
player.turn_left()
player.open()
player.move_forward(2)
player.turn_left()
player.move_forward(2)
player.close()
player.turn_right()
player.move_forward(3)
player.turn_left()
player.close()
player.turn_right()
player.move_forward(2)
player.turn_left()
player.close()
player.turn_right()
player.move_forward(3)
player.turn_left()
player.close()
Chapter 2 / Level 4: Opening and Closing commands | Teacher's Guide