graphics-8 - CMSC 143 Objects: Robots, W indow s, and...

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

View Full Document Right Arrow Icon
Sep 29 2010 CMSC143 - O'Hara 1 CMSC 143 Objects: Robots, Windows, and Shapes, oh my Keith O’Hara kohara@bard.edu
Background image of page 1

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

View Full DocumentRight Arrow Icon
Quiz Sep 29 2010 CMSC143 - O'Hara 2 Trace the function call (draw stack diagram) What builit-in python function is this? def mysteryFunction (s): if s == ”” : return 0 else : return 1 + mysteryFunction(s[1:]) print mysteryFunction( ”cat” )
Background image of page 2
Multiple Robots - Objects You can control multiple robots from one python shell Use the “object” interface to the robot Methods functions on objects Sep 29 2010 CMSC143 - O'Hara 3 alice = Scribbler(‘com30’) bob = Scribbler(‘com31’) alice.forward(0.75, 1) bob.beep(1, 440) apic = alice.takePicture() bpic = bob.takePicture() computer.beep(1, 440) computer.playSong()
Background image of page 3

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

View Full DocumentRight Arrow Icon
Objects Sep 29 2010 CMSC143 - O'Hara 4 object = Class() object.method() alice = Scribbler(‘com30’) bob = Scribbler(‘com31’) alice.forward(0.75, 1) bob.beep(1, 440) Constructor (create objects of type Class) Method (functions on objects)
Background image of page 4
Image of page 5
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 18

graphics-8 - CMSC 143 Objects: Robots, W indow s, and...

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

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