CS 206 Data Structures
Spring 2010
Assignment#2 (Modeling the LOGO turtle)
Due on Tuesday, February 9, 2009.
In this assignment you will complete the implementation of turtle graphics.
Design and implement all of the functions provided in the class handout.
First, using some sample runs, show that all of the newly implemented functionality works correctly.
Next, write a few (at least three) short programs that use the turtle(s) to draw some interesting drawings.
Hand-in your programs along with sample outputs.
# Below are functions you need to define to enhance this module.
# You will need to modify the existing __init__ to meet this spec...
def __init__(self, width, height):
'''Models an idealized drawing Scribbler robot in a width x height world.''''
def home(self):
'''Moves the scribbler to home position: center of window, facing east.'''
def setDirection(self, degrees):
'''Make the Scribbler point at degrees angle.'''
def down(self):
'''Put the Scribbler's pen down.'''
def up(self):
'''Put the Scribbler's pen up.'''
# Note: Change in this function's name....
def moveTo(self, x, y):
'''Moves the Scribbler to the specified position.'''
def setColor(self, r, g, b):
'''sets the color of the pen to <r,g,b> color.'''
def setWidth(self, width):
'''Sets the width of Scribbler's pen to width pixels.'''
def getWidth(self):
'''returns the width of Scribbler's world in pixels.'''
def getHeight(self):
'''Returns the height of scribbler's world in pixels.'''