by Bogdan Soban (2 Submissions)
Category: Graphics
Compatability: VB 6.0
Difficulty: Unknown Difficulty
Originally Published: Mon 22nd November 2004
Date Added: Mon 8th February 2021
Rating: (1 Votes)
Mandelbrot fractal - 10 lines of code
Form1.Show: Randomize Timer: dn = Int(1 + Rnd * 16)
For i = 0 To 400: x = i / 100 - 2
For j = 0 To 300: y = 2 - j / 75
zr = 0: zi = 0: zr2 = 0: zi2 = 0: cr = x: ci = y: n = 1
Do While n < 80 And zr2 + zi2 < 4
zr2 = zr * zr: zi2 = zi * zi
zi = 2 * zi * zr + ci: zr = zr2 - zi2 + cr: n = n + 1
Loop: PSet (i, j), QBColor((n + dn) Mod 16): Next j: Next i
End Sub