ForeverDev

Untitled

Oct 7th, 2014
210
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.34 KB | None | 0 0
  1. local grid = 500
  2. local size = 2
  3. local maxIter = 150
  4. local threeD = false
  5.  
  6. local ticks = 0
  7. local totalIter = 0
  8. local parts = {}
  9.  
  10. function f(c, z) return z^2 + c end
  11.  
  12. local set = Instance.new("Model", Workspace)
  13.  
  14. for length = -grid/2, grid/2, size do
  15.     for width = -grid/2, grid/2, size do
  16.         ticks = ticks + 1
  17.         if ticks % 250 == 0 then
  18.             wait()
  19.         end
  20.         local iterations, z, c = 0, 0, 0
  21.         local real = length * 4 / grid
  22.         local imaginary = width * 4 / grid
  23.         while f(c, z) <= 4 and iterations < maxIter do
  24.             totalIter = totalIter + 1
  25.             iterations = iterations + 1
  26.             local new = z^2 - c^2 + real
  27.             c = 2*z*c + imaginary
  28.             z = new    
  29.         end
  30.         local part = Instance.new("Part", set)
  31.         part.FormFactor = Enum.FormFactor.Custom
  32.         part.TopSurface = Enum.SurfaceType.Smooth
  33.         part.Anchored = true
  34.         part.Locked = true
  35.         part.Size = Vector3.new(size, (threeD and (iterations < maxIter and iterations*2 or 1) or 1), size)
  36.         part.CFrame = CFrame.new(length, 0, width)
  37.         part.BrickColor = BrickColor.new(Color3.new(0, 0, ((iterations < maxIter and ((255 / maxIter*10) * iterations) / 255) or 0)))
  38.     end
  39. end
  40.  
  41. print(("Complete\nPixles: %s\nIterations: %s"):format(tostring(#set:GetChildren()), tostring(totalIter)))
  42.  
  43. game.Players.CharacterAutoLoads = true
  44. for _, player in ipairs(game.Players:GetPlayers()) do
  45.     player:LoadCharacter()
  46. end
Advertisement
Add Comment
Please, Sign In to add comment