locked
Turtle Problems RRS feed

  • Question

  • I have entered the code for Moving Around from the 'Getting Started' pdf. Instead of it behaving according to Figure 43 and creating a hexagon with dashed lines, it creates a 4-sided figure with solid lines, redraws the first 2 sides and stops. I have compared my listing with the book's listing and can find no differences.


    sides = 6 
     
    length = 400 / sides  
    angle = 360 / sides  
     
    For i = 1 To sides  
        For j = 1 To 6  
            Turtle.Move(length / 12)  
            Turtle.PenUp()  
            Turtle.Turn(angle / 12)  
            Turtle.PenDown()  
        EndFor  
        Turtle.Turn(angle)  
    EndFor 


    I also notice that some of the width and height settings for GraphicsWindow don't behave the way they should. On some of the listings from the book, the window is much wider than it should be. On top of that, changing the number for the width doesn't make much difference in the resulting window. I'm not sure if this an issue relating to screen resolution or some other issue.

    GARuss
    Tuesday, October 28, 2008 8:07 PM

Answers

  • You have a major typo.  Check the line after the PenUp.  It should be a Move, not a Turn.
    • Marked as answer by Vijaye Raji Wednesday, October 29, 2008 5:22 PM
    Wednesday, October 29, 2008 2:59 PM
  • What Loyola IT said.  Plus, the arguments should be length / 12

    Turtle.Move(length / 12)

     

    • Marked as answer by Vijaye Raji Wednesday, October 29, 2008 5:23 PM
    Wednesday, October 29, 2008 5:22 PM

All replies

  • You have a major typo.  Check the line after the PenUp.  It should be a Move, not a Turn.
    • Marked as answer by Vijaye Raji Wednesday, October 29, 2008 5:22 PM
    Wednesday, October 29, 2008 2:59 PM
  • What Loyola IT said.  Plus, the arguments should be length / 12

    Turtle.Move(length / 12)

     

    • Marked as answer by Vijaye Raji Wednesday, October 29, 2008 5:23 PM
    Wednesday, October 29, 2008 5:22 PM