here is some mandelbrot code

  • 6nop6nop
    13th Oct 2019 Member 0 Permalink
    function f_iter(x,y)
        local real = ((x - 306/ 150)-0.5
        local imag = (y - 192/ 150
        local cx = real
        local cy = imag
        local newX
        local newY
        local it = 0
        while it < 61 do
            newX = (real * real - imag * imag) + cx
            newY = (2 * real * imag) + cy
            real = newX
            imag = newY
            if real * real + imag * imag > 64 then break end
            it = it + 1
        end
        return it
    end


    function fract()
        sim.createBox(4,4,607,379,125)
        pid = 1
        for px=46071 do
            for py = 43791 do
                local pid= sim.partID(px,py)
                --sim.partCreate(px,py,125)
                local its = f_iter(px,py)
                --local pid= sim.partID(px,py)
                --print(pid)
                sim.partProperty(pid,sim.FIELD_CTYPE,2^(its/2))
                pid = pid+1
            end
        end
    end


  • gamers4
    3rd Nov 2019 Member 0 Permalink

    h r r r r rr r rr  r r r r r r mm 

    interesting