Squeak
  links to this page:    
View this PageEdit this PageUploads to this PageHistory of this PageTop of the SwikiRecent ChangesSearch the SwikiHelp Guide
ASCII Mandelbrot
Last updated at 4:19 am UTC on 28 October 2005
"Generate a MandelBrot image using only ASCII characters."
    | d r n h |
    Transcript show: Character cr.
    1.1
        to: -1.1001
        by: -0.1
        do: [:e | 
            -2.0
                to: 0.9601
                by: 0.04
                do: [:b |
                    r := 0.0.
                    n := 0.0.
                    h := 127.
                    [r * r + (n * n) < 4.0
                        and: [h > 32]]
                        whileTrue: [h := h - 1.
                            d := r.
                            r := r * r - (n * n) + b.
                            n := 2 * d * n + e].
                    Transcript
                        nextPut: (Character
                                value: (b > 1
                                        ifTrue: [13]
                                        ifFalse: [h]))].
            Transcript show: Character cr]