aboutsummaryrefslogtreecommitdiff
path: root/examples/mandelbrot.sloth
diff options
context:
space:
mode:
authornic-gaffney <gaffney_nic@protonmail.com>2023-07-31 00:08:04 -0500
committernic-gaffney <gaffney_nic@protonmail.com>2023-07-31 00:08:04 -0500
commit7275a607d45d7e4f206f005584eef9ea5e331044 (patch)
tree1dc6d8ad482ed85787feccebbdbbb1aaf54bb98c /examples/mandelbrot.sloth
parent9b2fe27e03ae1962305f9032823e9984b2cf503c (diff)
parent7cd943581febdf20f4f0590907cfc05986453f53 (diff)
downloadsloth-7275a607d45d7e4f206f005584eef9ea5e331044.tar.gz
Merge branch 'master' of github.com-Nic:slothlang/sloth
Diffstat (limited to 'examples/mandelbrot.sloth')
-rw-r--r--examples/mandelbrot.sloth24
1 files changed, 12 insertions, 12 deletions
diff --git a/examples/mandelbrot.sloth b/examples/mandelbrot.sloth
index c7c559a..275d32b 100644
--- a/examples/mandelbrot.sloth
+++ b/examples/mandelbrot.sloth
@@ -1,25 +1,25 @@
fn main() Int {
# Configure
- var size: Float = 1000.0;
- var maxVal: Float = 4.0;
- var maxIter: Float = 50.0;
- var plane: Float = 4.0;
+ var size = 1000.0;
+ var maxVal = 4.0;
+ var maxIter = 50.0;
+ var plane = 4.0;
# loop over coordinates
- var x: Float = 0.0;
+ var x = 0.0;
while x < size {
- var y: Float = 0.0;
+ var y = 0.0;
while y < size {
# Initialize
- var cReal: Float = (x * plane / size) - 2.0;
- var cImg: Float = (y * plane / size) - 2.0;
- var zReal: Float = 0.0;
- var zImg: Float = 0.0;
- var count: Float = 0.0;
+ var cReal = (x * plane / size) - 2.0;
+ var cImg = (y * plane / size) - 2.0;
+ var zReal = 0.0;
+ var zImg = 0.0;
+ var count = 0.0;
# Calculate
while (zReal * zReal + zImg * zImg) <= maxVal && count < maxIter {
- var temp: Float = (zReal * zReal) - (zImg * zImg) + cReal;
+ var temp = (zReal * zReal) - (zImg * zImg) + cReal;
zImg = 2.0 * zReal * zImg + cImg;
zReal = temp;
count = count + 1.0;