mirror of
https://github.com/A2osX/A2osX.git
synced 2024-11-28 10:52:33 +00:00
54 lines
779 B
Plaintext
54 lines
779 B
Plaintext
NEW
|
||
AUTO 3,1
|
||
#!/bin/forth
|
||
|
||
140 CONSTANT MAXX
|
||
110 CONSTANT CENTERX
|
||
192 CONSTANT MAXY
|
||
96 CONSTANT CENTERY
|
||
16 CONSTANT MAXITER
|
||
|
||
0 VARIABLE X
|
||
0 VARIABLE Y
|
||
0 VARIABLE CX
|
||
0 VARIABLE CY
|
||
|
||
0 VARIABLE ZX
|
||
0 VARIABLE ZY
|
||
0 VARIABLE ZX2
|
||
0 VARIABLE ZY2
|
||
|
||
0 VARIABLE COLOR
|
||
|
||
: CELL
|
||
0 ZX !
|
||
0 ZY !
|
||
X @ CENTERX - CX !
|
||
Y @ CENTERY - CY !
|
||
0 COLOR !
|
||
MAXITER 0 DO
|
||
ZX @ ZX @ * 50 / ZX2 !
|
||
ZY @ ZY @ * 100 / ZY2 !
|
||
ZX2 @ ZY2 @ + 1000 > IF I COLOR ! LEAVE THEN
|
||
ZX @ ZY @ * 25 / CY @ + ZY !
|
||
ZX2 @ ZY2 @ - CX @ + ZX !
|
||
LOOP
|
||
Y @ X @ 4 * COLOR @ PLOT ;
|
||
|
||
: MANDELBROT
|
||
." Press a key to start..."
|
||
KEY GR
|
||
MAXY 0 DO
|
||
I Y !
|
||
MAXX 0 DO
|
||
I X !
|
||
CELL
|
||
LOOP
|
||
LOOP
|
||
KEY TEXT
|
||
." All done." ;
|
||
|
||
MANDELBROT
|
||
MAN
|
||
TEXT root/mandelbrot.f
|