One file for the courseTwo tracksPick up at any lesson
From Lesson 2-1 to the end of the course you keep one program file,
robot.py. Every lesson hands you a skeleton to paste into it: a banner naming
the section, a few comment lines saying what the section does, its settings in
capitals, the outlines of the functions you are about to write, and that
lesson's test functions. The file grows a section at a time, and by Module 5 the
banner comments are its table of contents.
Two rules keep it working all year. New code goes above the RUN block, never
below it — Python runs a file top to bottom, so the run block has to be the
last thing in the file and everything it calls has to be defined above it. And
the run block calls one test function at a time: change the call, don't stack
them.
Each file below is robot.py as a student who has pasted every skeleton
through that lesson, and written nothing yet, would have it: all the banners,
settings and test functions, and every function outline ending in pass. None
of the bodies you are asked to write are in it. If you join the course late, lost
your file, or want a clean start for a lesson, download the file for the
previous lesson, rename it robot.py, and go on from there. The end-of-module
file is the same as the module's last lesson.
Two tracks, because the course has two. The function track is the course
everyone does: each section is plain functions and settings. The class track
is for students who take every optional extension — LineSensor (2-7),
LineTrack (2-9), Manhattan (4-3), Navigator (4-6), BFS (5-5), the class
harness (5-6) and Dijkstra (6-5). On that track a class skeleton replaces the
function section, the object is created right under its class, and the tests
call the object (tracker.track_to_intersection(),
planner.compute_path(...)). Up to Lesson 2-6 the two files are identical. If
you have built a class, stay on the class track; if you have not, use the
function track.