RosettaCodeData/Task/Mandelbrot-set/Peri/mandelbrot-set.peri

52 lines
939 B
Plaintext

###sysinclude standard.uh
###sysinclude str.uh
###sysinclude system.uh
###sysinclude X.uh
$ff0000 sto szin
300 sto maxiter
maxypixel sto YRES
maxxpixel sto XRES
myscreen "Mandelbrot" @YRES @XRES graphic
#g
@YRES 2 / (#d) sto y2
@YRES 2 / (#d) sto x2
@XRES i: {{
@YRES {{
{{}}§i #g !(#d) 480. - @x2 - @x2 /
sto xx
{{}} #g !(#d) @y2 - @y2 /
sto yy
zero#d xa zero#d ya zero iter
#d
ciklus:
@xa dup* @ya dup* - @xx +
@xa 2. * @ya * @yy + sto ya
sto xa ++()#g iter
@xa dup* @ya dup* + 4. > @iter @maxiter >=#g |#g then §ciklusvége
goto §ciklus
ciklusvége:
@iter @maxiter ==#g {
myscreen {{}} {{}}§i @szin setpixel
}{
myscreen {{}} {{}}§i @iter 64 *#g setpixel
}
}}
}}
myscreen 10000 key?
vége: myscreen inv graphic
//."A lenyomott billentyű: " kprintnl
end
{ „xx” }
{ „x2” }
{ „yy” }
{ „y2” }
{ „xa” }
{ „ya” }
{ „iter” }
{ „maxiter” }
{ „szin” }
{ „YRES” }
{ „XRES” }
{ „myscreen” }