none
Challenge of the Month - April 2020 RRS feed

  • General discussion

  • This idea is from Tryhest. I moved his idea here as an independent thread.

    Flower Challenge

    Draw a turtle image like a flower.  You can use LitDev Extension as following sample.


    hi nonki!

    here are some ideas for april challenges of month:

    draw a turtle image like one of following:

    to fill an area can be used:

    • ldshapes.addpolygon
    • graphicswindow.filltriangle
    • LDShapes.RasteriseTurtleLines
    • LDGraphicsWindow.FloodFill


    Saturday, April 4, 2020 4:20 PM

All replies

  • sample code to create turtle shapes:

    args=0
    Sub t_Move
      ox=t_X
      oy=t_Y
      mm=LDMath.Convert2Cartesian(ox oy args[1] t_Angle-90)
      t_x=mm[1]
      t_y=mm[2]
      pi=pi+1
      pp[pi][1]=t_X
      pp[pi][2]=t_y
      
    EndSub
    
    t_x=200
    t_y=200
    For a0=0 To 360 Step 30
      
      t_Angle=a0 -15
      LDCall.Function("t_Move" 50)
      t_Angle=a0+15
      LDCall.Function("t_Move" 50)
      t_Angle=a0+180-15
      LDCall.Function("t_Move" 50)
      t_Angle=a0+180+15
      LDCall.Function("t_Move" 50)
      
      LDShapes.AddPolygon(pp)
      pp=""
    EndFor

    it creates this nice star:

    Saturday, April 4, 2020 4:40 PM
  • I wrote HRT413.

    Screen shot of a program Turtle Flower


    Nonki Takahashi

    Saturday, April 4, 2020 11:07 PM
    Moderator
  • A simple work: DSD647.

    I don't know why LDGraphicsWindow.FloodFill cannot work...

    Turtle.Speed=10
    Turtle.Angle=-60
    GraphicsWindow.BrushColor="Yellow"
    GraphicsWindow.FillEllipse(307,241,35,35)
    GraphicsWindow.PenColor="Pink"
    For i = 1 To 5
      Turtle.Move(50)
      For a = 1 To 100
        Turtle.Move(0.5)
        Turtle.Turn(2)
      EndFor
      Turtle.Move(72)
      Turtle.Angle=-60+72*i
    EndFor
    Turtle.Hide()

    Seid Bereit!

    Best Regards.

    Sunday, April 5, 2020 11:56 AM
  • This is my second solution: MTJ275.

    Screen shot of a program Turtle Flower 2


    Nonki Takahashi

    Sunday, April 5, 2020 12:32 PM
    Moderator
  • For the last image in the original posting: I made TKK350

    Jan [ WhTurner ] The Netherlands

    Sunday, April 5, 2020 12:41 PM
    Answerer
  • Thaelmann-Pioniere

    Add the following two lines at the end of your program, and move your third and fourth line after those two.

    LDShapes.RasteriseTurtleLines()
    LDGraphicsWindow.FloodFill(315,225,"Pink")


    Jan [ WhTurner ] The Netherlands


    Sunday, April 5, 2020 3:09 PM
    Answerer
  • For the last image in the original posting: I made TKK350

    Jan [ WhTurner ] The Netherlands

    Perfect!

    Nonki Takahashi

    Sunday, April 5, 2020 3:17 PM
    Moderator
  • Hi Jan,

    Thank you so much! It works well. I missed 

    LDShapes.RasteriseTurtleLines()

    in the first version.

    Best Regards!

    Sunday, April 5, 2020 3:29 PM
  • Hi everyone, I could draw the sixth image: XGD977.  Thanks.

    Nonki Takahashi

    Monday, April 6, 2020 2:37 AM
    Moderator
  • the turtle code is always a fascinating one as it can do miracles in a few code lines!

    also u can obtain nice images with golden rule angle of 137,50 deg.

    Monday, April 6, 2020 7:08 AM
  • the turtle code is always a fascinating one as it can do miracles in a few code lines!

    also u can obtain nice images with golden rule angle of 137,50 deg.

    Hi Tryhest, I tried.  The program ID is RPB297-0.

    Screen shot of a program Turtle Flower 137.5 update version


    Nonki Takahashi


    Monday, April 6, 2020 11:35 AM
    Moderator
  • congrats nonki almost like real ones!
    Monday, April 6, 2020 1:17 PM
  • After a lot of experiments, I succeeded in creating a look-alike of the third challenge. THe programcode is KRR126.


    Jan [ WhTurner ] The Netherlands

    Tuesday, April 14, 2020 10:37 AM
    Answerer
  • nice done Jan!

    Converted to shapes and speedup redraw (turtle is too slow to draw this): LQT869


    • Edited by Tryhest Wednesday, April 15, 2020 5:55 AM
    Wednesday, April 15, 2020 5:54 AM
  • Hi,

    To do a "turtle challenge" without a turtle doesn't seem right  ;-) ;-))


    Jan [ WhTurner ] The Netherlands

    Wednesday, April 15, 2020 10:48 AM
    Answerer
  • Cherry blossoms:

    Turtle.Speed=10
    Turtle.Angle=-60
    GraphicsWindow.PenColor="Pink"
    For i = 1 To 5
      Turtle.Move(50)
      For a = 1 To 100
        Turtle.Move(1)
        Turtle.Turn(2)
      EndFor
      Turtle.Move(50)
      Turtle.Angle=-60+72*i
    EndFor
    Turtle.Hide()
    LDShapes.RasteriseTurtleLines()
    LDGraphicsWindow.FloodFill(315,225,"Pink")
    GraphicsWindow.BrushColor="DeepPink"
    GraphicsWindow.FillEllipse(320,210,65,65

    Todo: draw the gaps on the edges of the petals.

    Seid Bereit!

    Best Regards.

    Wednesday, April 15, 2020 2:05 PM
  • Finished! A new work, adding gaps and music. The ID is DSD647-2.

    Seid Bereit!

    Best Regards.

    Wednesday, April 15, 2020 2:53 PM
  • Not very similar, but has a three-dimensional sense! DSD647-3

    Friday, April 17, 2020 2:17 PM
  • After my turtle version of the third drawing ( KRR126) wich runs in more than 4 minutes, and the Shapes version of Tryhest (LQT869) wich runs in about 20 seconds, I converted the program to draw with GW.DrawLine. The program is published as QFW939 and draws the figure in about 3 seconds.

    Jan [ WhTurner ] The Netherlands

    Monday, April 20, 2020 10:52 AM
    Answerer
  • 'flower draw using turtle
    'created by aabproducoes
    'Antonio Augusto Barbaro
    'ID to import HRW310
    GraphicsWindow.PenWidth=0.3
    GraphicsWindow.Title="Flower Draw Using Turtle 0.1"
    space= 5 'space between the lines
    points= 13 'points to draw the flower
    lenght= 50 'max lenght to draw the lines
    div= 150 'angles to add and subract of the central angle
    dist= 100 'flower radius 
    scndst= 10 'distance between the turle points
    pwstart= 0.3 'pen width start
    pwsum= 0.19 'value added to pwstart every loop
    cx= GraphicsWindow.Width/2 ' center X
    cy= GraphicsWindow.Height/2 'center Y
    GraphicsWindow.Top= Desktop.Height/2-cy 'centralize Y
    GraphicsWindow.Left= Desktop.Width/2-cx 'centralize X
    Turtle.Show()
    Turtle.PenUp()
    Turtle.Speed=10
    For n=1 To points 
      ang= n*Math.Pi/(points/2)-Math.Pi/2
      angre= (n*(360/points))
      px = cx+dist*Math.Cos(ang)
      py = cy+dist*Math.Sin(ang)
      GraphicsWindow.FillEllipse(px-3,py-3,6,6 )
      For c=space To lenght Step space
        If color[c]="" Then
          color[c]= GraphicsWindow.GetRandomColor()
        EndIf
        GraphicsWindow.PenWidth= pwstart 
        GraphicsWindow.PenColor= color[c]
        For z= angre-div To angre+div Step scndst 
          GraphicsWindow.PenWidth= GraphicsWindow.PenWidth+pwsum 
          ang= (z )*Math.Pi/180-Math.Pi/2
          lx[1]= px+c*Math.Cos(ang)
          ly[1]= py+c*Math.Sin(ang)
          Turtle.MoveTo(lx[1], ly[1])
          If z= angre-div+10 Then
            Turtle.PenDown()
          EndIf
          If z>=angre+div Then
            Turtle.PenUp()
          EndIf
        EndFor
      EndFor
    EndFor
    Turtle.Hide()

    Sunday, April 26, 2020 6:14 PM
  • Garden tulip:KJZ926.

    Seid Bereit!

    Best Regards.

    Monday, April 27, 2020 2:26 AM
  • Now I'm reading a book.  I inspired by the book and wrote a program: QDW737.

    The book is "MINDSTORMS Children, Computers, and Powerful Ideas" written in 1980 by Seymour Papert.

    Screen shot of a program Turtle Flower 5 


    Nonki Takahashi

    Tuesday, April 28, 2020 1:54 AM
    Moderator
  • updated to nice flower anim: NRR576

    a bit slow to generate slices, however...

    Wednesday, April 29, 2020 5:18 PM