• Make a program that draws the following figure line by line.

  • Your program should wait for one-second after drawing each line(it can be longer, just has to be a noticeable difference) .

  • Your program can only draw line by line (you cannot jump to another point or re-draw over a line)

  • Given a positive integer n, produce an art image of the below drawing

  • The angle measures should always be the same (regardless of n's value)
  • However, each line's length should be 150*n pixels
  • You only need to account for when n = 1, n = 2, n = 3

The picture below shows when n = 1

(You don't have to include the angles and side lengths in your drawing - they are just guides)


Answering - Name the language you used followed by its bytes


Java (swing), 500 bytes


Good luck!


closed as unclear what you're asking by NoOneIsHere, xnor, caird coinheringaahing, Erik the Outgolfer, Sriotchilism O'Zaic Oct 22 '17 at 18:04

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

  • \$\begingroup\$ Can you make the specifics of the dimensions etc more clear? \$\endgroup\$ – Okx Oct 21 '17 at 21:18
  • 1
    \$\begingroup\$ Would you mind showing a diagram of how long the lines should be, the angles, etc. Otherwise this may be closed as unclear. \$\endgroup\$ – Okx Oct 21 '17 at 21:22
  • 1
    \$\begingroup\$ What is the 75px labeling? And are the 150px supposed to be 150*n? \$\endgroup\$ – xnor Oct 22 '17 at 16:57
  • 1
    \$\begingroup\$ Despite the revisions, this looks far underspecified to me. Does the drawing have to be a single image that is modified on screen, on can it be a sequence of images that draw more and more? Do the drawn segments have to form a single Eulerian path? Does drawing a line segment mean tracing it gradually, or can it just appear at once? Does our drawing need to include the angle and length labels, or are those just guides? \$\endgroup\$ – xnor Oct 22 '17 at 17:04
  • 2
    \$\begingroup\$ Length 75px for the inner X segments seems geometrically impossible. \$\endgroup\$ – xnor Oct 22 '17 at 17:04

Python 2, 150 140 132 120 bytes

-5 bytes thanks to @Mr.Xcoder

from turtle import*
for a,b in zip([0,90,30,120,30]+[135]*3+[-75,240],[n]*5+[2**.5*n,n]*2+[n]):rt(a);fd(b)

Try it on Trinket modified slightly to run with Python 3

  • \$\begingroup\$ Thi is exactly what I meant! I just wanted to combine a fun math problem I saw with coding. You understood the prompt and did it exactly as I imagined! \$\endgroup\$ – John D Oct 22 '17 at 17:31
  • \$\begingroup\$ Can’t see the output. \$\endgroup\$ – FrownyFrog Oct 22 '17 at 17:47
  • 1
    \$\begingroup\$ @FrownyFrog you need to enter a number into the input field in the bottom right after pressing run \$\endgroup\$ – ovs Oct 22 '17 at 17:48
  • \$\begingroup\$ You updated the byte count and links, but forgot to change the code... \$\endgroup\$ – Mr. Xcoder Oct 22 '17 at 19:49

Not the answer you're looking for? Browse other questions tagged or ask your own question.