Teacher's Guide
Chapter 9 / Level 1: Creating a class
Teaching Objective:
- Students learn what classes are and how they can be used to create objects
- Learn syntax used in classes and how they differ from custom functions
- Understand how modular classes can be when used properly
Guide
In this level the objective is to create grain stacks by using classes.
class grain_stack:
name = "Grain"
number = 4
Once a class is set up you are able to create objects of this class, these are individual instances of the class.
stack = grain_stack()
Grab all the grains in the field and walk to the three X marks in the field. Use the build() function to put together the type of object previously defined.
player.build(stack)
Map overview and path

Code Solution
import player
player.turn_right()
player.move_forward(2)
player.turn_right()
player.move_forward(3)
player.turn_right()
player.move_forward(2)
player.turn_left()
player.move_forward(2)
player.turn_right()
player.move_forward(2)
player.turn_right()
player.move_forward(3)
player.turn_left()
player.move_forward(4)
player.turn_left()
player.move_forward(4)
class grain_stack:
name = "Grain"
number = 4
stack = grain_stack()
player.build(stack)
player.turn_left()
player.move_forward(2)
player.turn_right()
player.build(stack)
player.turn_left()
player.move_forward(3)
player.turn_right()
player.move_forward(3)
player.turn_right()
player.build(stack)