aboutsummaryrefslogtreecommitdiff
path: root/mandelbrot.py
diff options
context:
space:
mode:
authorCody <cody@codyq.dev>2023-07-20 18:07:48 -0500
committerCody <cody@codyq.dev>2023-07-20 18:07:48 -0500
commit7c53e65cad365ec112d2ec1bd9c3091dbed05720 (patch)
treedbcac7754608949e6f454726d56b9cea427468d8 /mandelbrot.py
parentee2133a13d61b3b3fb8fcf88f9c9781debd77d9e (diff)
downloadsloth-7c53e65cad365ec112d2ec1bd9c3091dbed05720.tar.gz
Changes
Diffstat (limited to 'mandelbrot.py')
-rw-r--r--mandelbrot.py23
1 files changed, 23 insertions, 0 deletions
diff --git a/mandelbrot.py b/mandelbrot.py
new file mode 100644
index 0000000..234beb4
--- /dev/null
+++ b/mandelbrot.py
@@ -0,0 +1,23 @@
+size = 800.0
+maxVal = 4.0
+maxIter = 50.0
+plane = 4.0
+x = 0;
+while x < size:
+ y = 0;
+ while y < size:
+ cReal = (x * plane / size) - 2.0
+ cImg = (y * plane / size) - 2.0
+ zReal = 0.0
+ zImg = 0.0
+ count = 0.0
+ while (zReal * zReal + zImg * zImg) <= maxVal and count < maxIter:
+ temp = (zReal * zReal) - (zImg * zImg) + cReal
+ zImg = 2.0 * zReal * zImg + cImg
+ zReal = temp
+ count = count + 1.0
+ if count == maxIter:
+ print(f"\x1b[{x};{y}H", end="")
+ print("█", end="")
+ y = y + 1
+ x = x + 1