Cantor set: Difference between revisions
Content deleted Content added
Added solution for Action! |
|||
Line 40: | Line 40: | ||
* * * * * * * * * * * * * * * * |
* * * * * * * * * * * * * * * * |
||
</pre> |
</pre> |
||
=={{header|Action!}}== |
|||
<lang Action!>PROC FillRect(INT x,y,w,h) |
|||
INT i |
|||
FOR i=y TO y+h-1 |
|||
DO |
|||
Plot(x,i) |
|||
DrawTo(x+w-1,i) |
|||
OD |
|||
RETURN |
|||
PROC DrawCantor(INT x0,y0,h,level) |
|||
INT x,y,i,j,w,w2,h2 |
|||
w=1 |
|||
FOR i=0 TO level-1 |
|||
DO w==*3 OD |
|||
Color=1 |
|||
y=y0 |
|||
FOR i=0 TO level |
|||
DO |
|||
FillRect(x0,y,w,h) |
|||
y==+h*2 |
|||
OD |
|||
Color=0 |
|||
w2=1 h2=h*2 |
|||
FOR i=0 TO level-1 |
|||
DO |
|||
x=w2 y=(level-i)*(h*2) |
|||
WHILE x<w |
|||
DO |
|||
FillRect(x0+x,y0+y,w2,h2) |
|||
x==+w2*2 |
|||
OD |
|||
w2==*3 |
|||
h2==+h*2 |
|||
OD |
|||
RETURN |
|||
PROC Main() |
|||
BYTE CH=$02FC,COLOR1=$02C5,COLOR2=$02C6 |
|||
Graphics(8+16) |
|||
COLOR1=$0C |
|||
COLOR2=$02 |
|||
DrawCantor(38,48,8,5) |
|||
DO UNTIL CH#$FF OD |
|||
CH=$FF |
|||
RETURN</lang> |
|||
{{out}} |
|||
[https://gitlab.com/amarok8bit/action-rosetta-code/-/raw/master/images/Cantor_set.png Screenshot from Atari 8-bit computer] |
|||
=={{header|Ada}}== |
=={{header|Ada}}== |