ex09PencilKangYooPark - # ex09PencilKangYooPark.py # Kang...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
# ex09PencilKangYooPark.py # Kang Yoo Park, CS5NM 11/05/08 # importing stuff we need import pygame from pygame.locals import * from sys import exit # A function for running test cases def check_expect(test,check,expect): if (check == expect): print "Test " + test + " passed." else: print "Test " + test + " failed: expected " + str(expect) + \ " but I got " + str(check) # draws the pencil frame def makePencilFrame(x,y,height,width): points = [] points.append((x,(y-((8.0/10)*height)))) #upper left points.append((x,y)) #bottom left points.append(((x+width),y)) #bottom right points.append(((x+width),(y-((8.0/10)*height)))) #upper right points.append(((x+(0.5*width)),(y-height))) #pointy end return points # testing makePencilFrame check_expect("makePencilFrame test 1", makePencilFrame(100,100,200,30), [(100,-60),(100,100),(130,100),(130,-60),(115,-100)]) check_expect("makePencilFrame test 2", makePencilFrame(100,100,200,40), [(100,-60),(100,100),(140,100),(140,-60),(120,-100)]) # returns points to draw the divider def makeEraserDivider1(x,y,height,width):
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 08/28/2009 for the course CS 50 taught by Professor Staff during the Spring '08 term at UCSB.

Page1 / 3

ex09PencilKangYooPark - # ex09PencilKangYooPark.py # Kang...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online