Last active
January 12, 2022 04:46
-
-
Save eparadis/d4a242c8cc149f3583c303efa80532c4 to your computer and use it in GitHub Desktop.
ascii art mandelbrot drawing program in BASIC
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 x1=59 | |
11 y1=21 | |
20 i1=-1.0 | |
21 i2=1.0 | |
22 r1=-2.0 | |
23 r2=1.0 | |
30 s1=(r2-r1)/x1 | |
31 s2=(i2-i1)/y1 | |
40 for y=0 to y1 | |
50 i3=i1+s2*y | |
60 for x=0 to x1 | |
70 r3=r1+s1*x | |
71 z1=r3 | |
72 z2=i3 | |
80 for n=0 to 29 | |
90 a=z1*z1 | |
91 b=z2*z2 | |
100 if a+b>4.0 goto 130 | |
110 z2=2*z1*z2+i3 | |
111 z1=a-b+r3 | |
120 next n | |
130 print chr$(62-n); | |
140 next x | |
150 print | |
160 next y | |
170 end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
A very naive re-implementation of the original version from BASIC into FORTH is:
Note that I had to use 30 instead of 29 in "line 80" aka
30 0 do
to produce the proper output.Here's another gist for the refactor of this into something that's more idiomatic FORTH. I'm interested to find a FORTH for my Z80 retrocomputer to compare speed!