53
\$\begingroup\$

Your task is to draw the mandelbrot set in ascii. It should look something like enter image description here

The complex number c lies in the mandelbrot set, when the sequence z(n+1) = z(n)^2 + c, z(0) = 0 remains bounded. For the purpose of this challenge you can consider the sequence bounded for c if |z(32)| < 2.

Plot the mandelbrot set on the complex plane from (-2 - i) to (1 + i), and a minimum resolution of 40x30, using ascii characters in your favourite language, using as few characters as possible.

\$\endgroup\$
11
  • 35
    \$\begingroup\$ Since the specification is a little bit unclear with respect to that point I can propose the following low-res ;-) 1-char php solution: * \$\endgroup\$
    – Howard
    Commented Jul 6, 2011 at 17:32
  • 3
    \$\begingroup\$ Well I was hoping I could just say "don't be a jerk" :D. We'll go with at least 40x30 then. \$\endgroup\$
    – Hannesh
    Commented Jul 6, 2011 at 18:40
  • 3
    \$\begingroup\$ I have a personal preference for tasks that solve a class of problems rather than one instance. Making the region to use an input would makes this questions qualify. In any case, the specification is a bit light. In the future you can get help with these kinds of issues on the meta sandbox or the puzzle lab chat before you task goes live \$\endgroup\$ Commented Jul 6, 2011 at 19:16
  • 1
    \$\begingroup\$ @Hannesh, I agree with dmckee. If you change the question, I'll be happy to add arguments. \$\endgroup\$
    – boothby
    Commented Jul 7, 2011 at 0:01
  • 2
    \$\begingroup\$ Here's a source code in the shape of the mandelbrot set, which then generates high resolution mandelbrot set (preshing.com/20110926/…) - OT for this question but I thought people here might like it. \$\endgroup\$
    – DanBeale
    Commented Oct 1, 2011 at 11:54

31 Answers 31

1
2
0
\$\begingroup\$

TI-BASIC, 256

PROGRAM:M
:Input "ITER. ",D
:For(A,Xmin,Xmax,ΔX)
:For(B,Ymin,Ymax,ΔY)
:0→X
:0→Y
:0→I
:D→M
:While X^2+Y^2≤4 and I<M
:X^2-Y^2+A→R
:2XY+B→Y
:R→X
:I+1→I
:End
:If I≠M
:Then
:I→C
:Else
:0→C
:End
:If C<1
:Pt-On(A,B)
:End
:End
:End
\$\endgroup\$
6
  • \$\begingroup\$ Source. \$\endgroup\$
    – MD XF
    Commented May 27, 2017 at 0:18
  • \$\begingroup\$ Since you've taken the code from elsewhere you should probably make this answer a Community Wiki. \$\endgroup\$
    – Wheat Wizard
    Commented May 27, 2017 at 0:37
  • 1
    \$\begingroup\$ @WheatWizard I remember Dennis saying on TNB last night that doing so is unnecessary. \$\endgroup\$
    – MD XF
    Commented May 27, 2017 at 0:38
  • 1
    \$\begingroup\$ It is not necessary. There will not probably not be any repercussions for not doing it. I'm just suggesting it because I think its the right thing to do. Its ultimately your choice. \$\endgroup\$
    – Wheat Wizard
    Commented May 27, 2017 at 0:40
  • 1
    \$\begingroup\$ @WheatWizard I guess it is a bit douchey to possibly get rep for something I didn't write. But there's a meta post by DJ talking about how CW isn't a rep waiver. \$\endgroup\$
    – MD XF
    Commented May 27, 2017 at 0:41
1
2

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