Answered Spiderweb Problem

  • Saturday, October 06, 2012 1:33 PM
     
      Has Code

    Hi guys,

    I recently started  programming. But i have some problems with my programm. It doesnt't do what i want. :(

    I want to create a spiderweb. But the lines doesn't connect.
    Heres the code:

    Turtle.Speed=10
    
    For i = 1 To 6
      For w = 1 To 2
        Turtle.Move(170)
        Turtle.Turn(180)
      EndFor
      Turtle.Turn(60)
    EndFor
    
    Turtle.Move(20)
    Turtle.Turn(120)
    
    
    
    l = 20
    
    
    For q = 1 To 54
      Turtle.Move(l)
      Turtle.Turn(60)
      l = l + 2.5
      
    EndFor

    Thank you guys

All Replies

  • Saturday, October 06, 2012 2:22 PM
     
     

    The lines don't connect to what or where?

    It works fine for me.


    I am a 10 year old that loves math, games, and computers. "Everyone is potentially great, you just have to turn it into kinetic greatness."


    • Edited by Math Man Saturday, October 06, 2012 2:22 PM
    •  
  • Saturday, October 06, 2012 4:04 PM
     
     
    If you look closely you can see it isn't 100 % correct. I think i must change something on the turtle.turn(60) in the second for loop.
  • Sunday, October 07, 2012 12:11 AM
     
     

    This was as close as I could get it.

    Import XSJ843

    Even better is XSJ843-1


    I am a 10 year old that loves math, games, and computers. "Everyone is potentially great, you just have to turn it into kinetic greatness."


  • Sunday, October 07, 2012 5:38 PM
     
     

    1) I want to use turtle

    2) This little mistake is my problem

  • Monday, October 08, 2012 4:31 AM
     
     Answered

    Turtle.Moveto method is easy.  (If you use turtle.move and turtle.turn , it is very difficult)

    See picture. 

    X0= Turtle.x
    y0= Turtle.y
    Turtle.Speed=10
    Turtle.PenDown()
    For i = 1 To 6
      For w = 1 To 2
        Turtle.Move(170)
        Turtle.Turn(180)
      EndFor
      Turtle.Turn(60)
    EndFor

    L=20
    dl=8

    Turtle.PenUp()
    Turtle.MoveTo(x0,y0)
    Turtle.PenDown()
    For i=0 To 54
      r=L+i*60/360*dL
      X=x0+r*math.cos(math.GetRadians( 90-i*60))
      Y=y0+r*math.sin(math.GetRadians( 90-i*60))
      Turtle.MoveTo(x,y)
    EndFor

  • Tuesday, October 09, 2012 12:49 AM
     
     Answered Has Code

    Maybe you mean like this?

    Turtle.Speed=10
    Turtle.X = GraphicsWindow.Width/2
    Turtle.Y = GraphicsWindow.Height/2
    For i = 1 To 6
      For w = 1 To 2
        Turtle.Move(170)
        Turtle.Turn(180)
      EndFor
      Turtle.Turn(60)
    EndFor
    Turtle.X = GraphicsWindow.Width/2
    Turtle.Y = GraphicsWindow.Height/2
    For dist = 2 To 150
      angle = angle+1
      x = GraphicsWindow.Width/2 + Math.Cos(Math.GetRadians(angle*60+90))*dist
      y = GraphicsWindow.Height/2 + Math.Sin(Math.GetRadians(angle*60+90))*dist
      Turtle.MoveTo(x,y)
    EndFor


    I am a 10 year old that loves math, games, and computers. "Everyone is potentially great, you just have to turn it into kinetic greatness."