@name MandelbrotSetByGobo @inputs Screen:wirelink @persist Cell Color Height Width Count interval(1) if (first()) { Screen:writeCell(1048574, 1) # Clear Screen:writeCell(1048569, 1) # RGB Mode Cell = -1 Height = 512 Width = 512 } while (maxquota() > opcounter() & Cell <= Height * Width + 1) { XZ = 2 # Zoom Level (Low numbers are more zoomed in) YZ = 2 XA = 0 # Adjustment (View a different area of the set) YA = 0 X0 = (Cell % Width) * XZ/512 - (XZ/2) + (XA/XZ) Y0 = ((Cell - X0) / Width) * YZ/512 - (YZ/2) + (YA/YZ) X = 0 Y = 0 Iteration = 0 # Don't put this too high, or you will reach Tick Quota. # 10 for a quick render, 100 for detail. MaxIteration = 10 while (X*X + Y*Y <= (2*2) & Iteration < MaxIteration) { TempX = X*X - Y*Y + X0 Y = 2 * X * Y + Y0 X = TempX Iteration++ } if (Iteration == MaxIteration) { # The colour of points inside the set R = 255 G = 255 B = 255 } else { # The colour of points outside the set, # scaled with the number of Iterations R = floor(Iteration/MaxIteration * 255) G = floor(Iteration/MaxIteration * 255) B = 0 } Cell++ Count++ Screen:writeCell(Cell * 3, R) Screen:writeCell(Cell * 3 + 1, G) Screen:writeCell(Cell * 3 + 2, B) # Every 8192 Pixels, refresh the screen if (Count >= (8192 - 1)) { Screen:writeCell(1048575, 1) Count = 0 } }