Week 13 Lab: Putting it All Together

For this lab, you are going to move most of your code from move.py into a class CS104Scribbler and encapsulate information about the Scribbler into that class.

Step 1: Make the lab13 Folder, etc.

Step 2: Make a CS104Scribbler class

We are going to make a new class CS104Scribbler that is a subclass of Scribbler, a class provided by the myro module that we've been using all semester. To do this, do these steps:

Step 3: Add a constructor method and getters and setters

Next, we need to add a constructor for CS104Scribbler:

Step 4: Fix the goToPoint method

The goToPoint method previously took two parameters, both of them being ScribPoint objects. Now, the CS104Scribbler class stores its current x, y, and angle of the Scribbler robot, so a call to goToPoint does not need to pass in the first parameter -- where the Scribbler robot currently is on the whiteboard. Also, we don't need a ScribPoint class anymore -- we can just pass in the x and y coordinates for where the scribbler robot should move to.

Step 5: Test your code

Step 6: Optimize your code

The robot still turns to face east after every move. This is dumb. We can store the angle the robot is facing in the CS104Scribbler object, and then the code can figure out how to turn to get to the next point it needs to go to.

Step 7: Make your code draw a 5 point star

At the end of lab11 I give you the points necessary to draw a 5-point star. Look in that lab to get those points. Implement this again in your lab13.py main code.

Note: you are done with the lab. But, notice that we really didn't finish our cs104scrib.py code. We really should fix travelForw(), travelBack(), turnLeftDegrees(), and turnRightDegrees() so that they each store the current x, y, and angle of the robot. If we changed those, we wouldn't have to make the changes we did to goTo(). But, we'll just leave the code as it is, for now...

Step 8: Submit your code

To submit your final version of lab13.py and cs104scrib.py, you’ll need to use Windows Explorer.


Grading Rubric: 15 points total

10 points: program that runs correctly.  There are many parts to handle in this program, so make sure all work correctly.
1 points: correct comments at the top of the file.
4 points: code is clean and neat and uses good comments and variable names. I.e., the code is hospitable.