ex09PencilKangYooPark

ex09PencilKangYooPark - .py Kang Yoo Park CS5NM importing...

Info icon This 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): penLeft = x penRight = (x + width) divider1_y = y - (height*(1.0/20)) points = [(penLeft, divider1_y),(penRight, divider1_y)] return points # testing the makerEraserDivider1
Image of page 1

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

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

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern