1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Programming Help/Question? (Python)

Discussion in 'Entertainment and Technology' started by theMaverick, Jul 15, 2015.

  1. theMaverick

    Full Member

    Joined:
    Nov 15, 2012
    Messages:
    963
    Likes Received:
    0
    Location:
    DFWTX
    Hey guys,

    Hopefully one of you can help me! I'm trying to do this thing in Python where I have to draw a snowman using Turtle Graphics but I have to draw it without using the circle function!:***:

    Programming isn't my forte, and so needless to say, I'm super frustrated. I have no idea where to start and nothing I've tried has worked. The snowman has to be made of three circles. I'm not asking for you to post the code for me, but if you could just point me in a direction, that'd be lovely! :bang::bang::tantrum:

    Thanks!

    theMaverick
     
  2. Tetra

    Full Member

    Joined:
    Mar 10, 2014
    Messages:
    1
    Likes Received:
    0
    Location:
    Canada
  3. Michael

    Regular Member

    Joined:
    Aug 30, 2014
    Messages:
    2,602
    Likes Received:
    4
    Location:
    Europe
    Gender:
    Other
    Gender Pronoun:
    He
    Sexual Orientation:
    Bisexual
    Out Status:
    Not out at all
    The Stack has spoken...

    ... No code was harmed in the making of this thread.
     
  4. Pret Allez

    Full Member

    Joined:
    Apr 19, 2012
    Messages:
    6,785
    Likes Received:
    67
    Location:
    Seattle, WA
    Gender:
    Female (trans*)
    Gender Pronoun:
    She
    Sexual Orientation:
    Bisexual
    Out Status:
    Some people
    I hate stack overflow. What functions can you use? If you're allowed to use points, then draw a circle with the points. If you're allowed to draw with lines, draw the circle with lines.

    Drawing a circle with points:

    Circle is a point and a radius. Color the point if it is a distance between (r-dr) and (r+dr) from the center of the circle. (Where r is the radius of the circle, dr is a small threshold value, like one pixel, and distance is calculated using the point distance formula. Note that you don't have to take the square root.)

    Drawing a circle with lines:

    Pick an arbitrary point on or near the perimeter of the circle, and a small angle dt. Move about the circle through an angle dt, and draw the endpoint of that line segment. Take the end point as the start of the next line segment. Move through another angle dt. Draw the next endpoint. Etc. Loop from 0 <= dt <= 2pi. (Possible optimization: loop from 0 <= dt <= pi, drawing half the circle, and then reflect the points about the center of the circle and whatever the line was.)