The rule F ->
means that F can be replaced by nothing.
Showing posts with label Chapter 9. Show all posts
Showing posts with label Chapter 9. Show all posts
Wednesday, September 23, 2009
Chapter 9 Listing 9.7
when
setposition
is called to restore the turtle's position and heading to a previously stored location, the tail should be up. so Lines 16 and following should read:
elif cmd == ']':
pos,head = stateSaver.pop()
aTurtle.up()
aTurtle.setposition(pos)
aTurtle.setheading(head)
aTurtle.down()
Tuesday, February 10, 2009
Chapter 9 -- Page 314 -- Listing 9.4
The recursive calls to sierpinski in lines 14,15, and 16 have an extra comma at the end of the parameter list as shown below.
sierpinski(myTurtle,p1,midPoint(p1,p2),midPoint(p1,p3),depth-1,)
sierpinski(myTurtle,p2,midPoint(p2,p3),midPoint(p2,p1),depth-1,)
sierpinski(myTurtle,p3,midPoint(p3,p1),midPoint(p3,p2),depth-1,)
This is a typo. Although these extra commas do not cause any syntactic problem, they should be removed.
Subscribe to:
Posts (Atom)