def main(): # create world and turtle earth = makeWorld(800, 800) fred = makeTurtle ( earth ) bob = makeTurtle ( earth ) # change default turtle color to blue # using setPenColor METHOD fred.setPenColor ( blue ) bob.setPenColor ( green ) turn ( fred , 45 ) turn ( bob, 45 ) drawCircle ( fred, 10 ) repositionTurtle ( fred, -50, -25 ) drawCircle ( fred, 10 ) repositionTurtle ( fred, -50, -25 ) drawCircle ( fred, 10 ) repositionTurtle ( fred, 50, -75 ) drawCircle ( fred, 10 ) repositionTurtle ( fred, 50, 75 ) drawCircle ( fred, 10 ) repositionTurtle2 ( bob, 0, -150 ) drawCircle ( bob, 10 ) repositionTurtle2 ( bob, -50, -25 ) drawCircle ( bob, 10 ) repositionTurtle2 ( bob, -50, -25 ) drawCircle ( bob, 10 ) repositionTurtle2 ( bob, 50, -75 ) drawCircle ( bob, 10 ) repositionTurtle2 ( bob, 50, 75 ) drawCircle ( bob, 10 ) def repositionTurtle ( t1, deltaX, deltaY ): # note: this function assumes the turtle starts facing toward the top # # In keeping the the coordinate axis system of pictures in JES # x direction is horizontal ( positive direction to the right ) # y direction is vertical ( positive direction is down ) # reposition turtle right deltaX pixels and down deltaY pixels penUp ( t1 ) turn ( t1, 90 ) # point in the positive x direction forward ( t1, deltaX ) turn ( t1, 90 ) # point in the positive y direction forward ( t1 , deltaY ) turn ( t1, 180 ) penDown ( t1 ) def repositionTurtle2 ( t1, deltaX, deltaY ): # note: this function DOES NOT assumes the turtle starts facing toward the top # # In keeping the the coordinate axis system of pictures in JES # x direction is horizontal ( positive direction to the right ) # y direction is vertical ( positive direction is down ) # reposition turtle right deltaX pixels and down deltaY pixels penUp ( t1 ) currentX = getXPos ( t1 ) currentY = getYPos ( t1 ) newX = currentX + deltaX newY = currentY + deltaY moveTo ( t1, newX, newY ) penDown ( t1 ) def takeCourse ( prof, subject, number, student ): print ( "Hello" ) def drawCircle ( t1, length ): # draw Circle: turn for the angle: 360 / number of sides # draw a many sided polygon ==> 30 # turn = 360 / 30 = 12 loopCount = 1 while ( loopCount <= 30 ) : # draw the line and turn for each side of the shape forward ( t1, length ) turn ( t1, 360 / 30 ) # increment my loopCount variable loopCount = loopCount + 1 def drawOct ( t1, length ): # draw octagon: turn for the angle: 360 / number of sides # turn = 360 / 8 = 45 loopCount = 1 while ( loopCount <= 8 ) : # draw the line and turn for each side of the shape forward ( t1, length ) turn ( t1, 45 ) # increment my loopCount variable loopCount = loopCount + 1 def drawHex ( t1, length ): # draw hexagon: turn for the angle: 360 / number of side # turn = 360 / 6 = 60 loopCount = 1 while ( loopCount <= 6 ) : # draw the line and turn for each side of the shape forward ( t1, length ) turn ( t1, 60 ) # increment my loopCount variable loopCount = loopCount + 1