Author Topic: Mandelbrot Set by qbguy  (Read 17269 times)

0 Members and 1 Guest are viewing this topic.

Offline The Librarian

  • Moderator
  • Newbie
  • Posts: 39
Mandelbrot Set by qbguy
« on: March 17, 2018, 09:43:35 am »
Mandelbrot Set

Author: @qbguy
Source: [abandoned, outdated and now likely malicious qb64 dot net website - don’t go there] Forum
URL: /forum/index.php?topic=121.0]http://www.[abandoned, outdated and now likely malicious qb64 dot net website - don’t go there]/forum/index.php?topic=121.0
Version: 2008
Tags: [2d], [fractal]

Description:
'public domain, uses qb64's 2d prototype

Source Code:
Code: QB64: [Select]
  1. 'public domain
  2. 'uses qb64's 2d prototype
  3. DEFDBL A-Z
  4. SCREEN _NEWIMAGE(640, 480, 32)
  5. DIM R(15) AS INTEGER, G(15) AS INTEGER, B(15) AS INTEGER
  6. FOR i = 0 TO 15: READ R(i): NEXT
  7. FOR i = 0 TO 15: READ G(i): NEXT
  8. FOR i = 0 TO 15: READ B(i): NEXT
  9. DATA 0,63,63,63,63,63,31,0,0,31,31,31,47,63,63,63
  10. DATA 0,0,15,31,47,63,63,63,63,31,15,0,0,0,0,0
  11. DATA 0,0,0,0,0,0,0,0,31,63,63,63,63,63,42,21
  12.  
  13. real = -2.2: imag = -1.2
  14. incr = 0.005
  15. FOR y = 0 TO 479
  16.     r = real
  17.     FOR x = 0 TO 639
  18.         colour = (64 - mandel(r, imag, 64)) MOD 16
  19.         colour = _RGB32(R(colour) * 4, G(colour) * 4, B(colour) * 4)
  20.         PSET (x, y), colour
  21.         r = r + incr
  22.     NEXT
  23.     imag = imag + incr
  24.  
  25. FUNCTION mandel% (ox, oy, limit)
  26.     x = ox: y = oy
  27.     FOR c% = limit TO 1 STEP -1
  28.         xx = x * x: yy = y * y
  29.         IF xx + yy >= 4 THEN EXIT FOR
  30.         y = x * y * 2 + oy
  31.         x = xx - yy + ox
  32.     NEXT
  33.     mandel = c%
  34.  

qbguyMandel.png
* qbguyMandel.bas (Filesize: 0.95 KB, Downloads: 662)
« Last Edit: March 07, 2020, 04:58:10 am by Qwerkey »