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

Looking for the book? They have it at the Engineer's Bookstore at 748 Marietta St NW. Here is there website: http://www.engrbookstore.com/ - Monica

Hotspots: Slides and CodeTA CornerComments?AnnouncementsFAQStatic Webspace
View this PageEdit this PageUploads to this PageHistory of this PageHomeRecent ChangesSearchHelp Guide

simple square-dancing turtles

def choreography1():
  world = makeWorld()
  dexter = makeTurtle(world)
  elliott = makeTurtle(world)
  square2(dexter, 90)
  square2(elliott, -90)

def square2(turtle, angle):
  for i in range(4):
    turtle.forward(100)
    turtle.turn(angle)
    time.sleep(1.0)

def choreography2():
  picture = makePicture(getMediaPath("beach-smaller.jpg"))
  world = makeWorld(getWidth(picture), getHeight(picture))
  anon = makeTurtle(world)
  anon.penUp()
  anon.hide()
  anon.moveTo(0,0)
  anon.drop(picture)
  dexter = makeTurtle(world)
  elliott = makeTurtle(world)
  for side in range(4):
    myForward(dexter, 100)
    myForward(elliott, 100)
    dexter.turn(90)
    elliott.turn(-90)
    time.sleep(0.25)

def myForward(turtle, dist):
  for i in range(dist):
    turtle.forward(1)
    time.sleep(0.01)



Link to this Page