A2osX/EXAMPLES/MANDELBROT.F.txt

54 lines
779 B
Plaintext
Raw Permalink Normal View History

2020-11-26 19:47:57 +00:00
NEW
AUTO 3,1
2020-11-29 13:16:39 +00:00
#!/bin/forth
2020-11-26 19:47:57 +00:00
2020-12-17 20:23:54 +00:00
140 CONSTANT MAXX
2020-12-23 14:54:57 +00:00
110 CONSTANT CENTERX
2020-12-17 20:23:54 +00:00
192 CONSTANT MAXY
2020-12-23 14:54:57 +00:00
96 CONSTANT CENTERY
2020-12-17 20:23:54 +00:00
16 CONSTANT MAXITER
2020-11-26 19:47:57 +00:00
2020-12-17 20:23:54 +00:00
0 VARIABLE X
0 VARIABLE Y
2020-12-23 14:54:57 +00:00
0 VARIABLE CX
0 VARIABLE CY
2020-12-17 20:23:54 +00:00
0 VARIABLE ZX
0 VARIABLE ZY
0 VARIABLE ZX2
0 VARIABLE ZY2
2020-12-23 14:54:57 +00:00
0 VARIABLE COLOR
2020-11-26 19:47:57 +00:00
2020-12-17 20:23:54 +00:00
: CELL
0 ZX !
0 ZY !
2020-12-23 14:54:57 +00:00
X @ CENTERX - CX !
Y @ CENTERY - CY !
0 COLOR !
2020-12-17 20:23:54 +00:00
MAXITER 0 DO
2020-12-23 14:54:57 +00:00
ZX @ ZX @ * 50 / ZX2 !
ZY @ ZY @ * 100 / ZY2 !
2021-04-29 11:56:34 +00:00
ZX2 @ ZY2 @ + 1000 > IF I COLOR ! LEAVE THEN
2020-12-23 14:54:57 +00:00
ZX @ ZY @ * 25 / CY @ + ZY !
ZX2 @ ZY2 @ - CX @ + ZX !
2020-12-17 20:23:54 +00:00
LOOP
2020-12-23 14:54:57 +00:00
Y @ X @ 4 * COLOR @ PLOT ;
2020-11-26 19:47:57 +00:00
: MANDELBROT
2021-06-05 15:48:54 +00:00
." Press a key to start..."
KEY GR
2020-12-23 14:54:57 +00:00
MAXY 0 DO
I Y !
MAXX 0 DO
I X !
CELL
LOOP
2021-06-05 15:48:54 +00:00
LOOP
2021-07-28 16:50:59 +00:00
KEY TEXT
2021-06-05 15:48:54 +00:00
." All done." ;
2020-11-26 19:47:57 +00:00
MANDELBROT
MAN
TEXT root/mandelbrot.f