Change Contents of the Bubble
Welcome to CS1315. Click on the python to add comments.

This page removed for FERPA compliance
View this PageEdit this Page (locked)Uploads to this PageHistory of this PageHomeRecent ChangesSearchHelp Guide

Tracing Movie code

Consider the code given below, and describe the frames that are produced when the code is run using the invocation


makeTestMovie()

You can assume that writeFrame() is defined to write the frame into an appropriately named and numbered JPG file.

def makeTestMovie():
	  for frameNumber in range(1, 5):
	    frame = makeEmptyPicture(100, 100)
	    x = 25 * (frameNumber – 1)
	    y = 25 
	    addRectFilled(frame, x,  y, 25, 25,  black)
	    writeFrame(frame, frameNumber)



Look at the functions and answer the questions that follow. Make sure that you understand what each part of the function does, not just what the questions ask below.


def question2(): 
  for frame in range (1,250+1):
    canvas = makeEmptyPicture(300, 300) 

    addRectFilled(canvas,1, frame, 50, 50, blue) 
    
    frame_num_string = str(frame) 
    if frame < 10:
      frame_name = 'frame00' + frame_num_string + '.jpg'
    else:
      if frame < 100:
        frame_name =  'frame0' + frame_num_string + '.jpg'
      else:
        frame_name =  'frame' + frame_num_string + '.jpg'

    writePictureTo(canvas, frame_name)


Questions:


1. Assuming this movie runs at 30fps. REMOVEDw long does this movie last?

2. REMOVEDw fast and in what direction does the blue square move?

3. What is the name of the file holding the tenth frame?

Trace through Colin's code from class and make sure that you understand it. There aren't any questions for this part, but it is still important. See a TA if you need help.



Movie Tracing Questions

Links to this Page