Sierpinski carpet: Difference between revisions
Content deleted Content added
add BQN |
No edit summary |
||
Line 2,980: | Line 2,980: | ||
@ @@ @@ @@ @@ @@ @@ @@ @@ @ |
@ @@ @@ @@ @@ @@ @@ @@ @@ @ |
||
@@@@@@@@@@@@@@@@@@@@@@@@@@@</pre> |
@@@@@@@@@@@@@@@@@@@@@@@@@@@</pre> |
||
=={{header|IS-BASIC}}== |
|||
<lang IS-BASIC>100 PROGRAM "Carpet.bas" |
|||
110 SET VIDEO MODE 5:SET VIDEO COLOR 0:SET VIDEO X 32:SET VIDEO Y 27 |
|||
120 OPEN #101:"video:" |
|||
130 DISPLAY #101:AT 1 FROM 1 TO 27 |
|||
140 CALL CARPET(30,0,1000,970,4) |
|||
150 DEF CARPET(X1,Y1,X2,Y2,LEV) |
|||
160 NUMERIC XT,XY,KX1,KX2,KY1,KY2 |
|||
170 IF LEV>0 THEN |
|||
180 LET XT=(X2-X1)/3:LET YT=(Y2-Y1)/3 |
|||
190 LET KX1=X1+XT:LET KY1=Y1+YT |
|||
200 LET KX2=X2-XT:LET KY2=Y2-YT |
|||
210 CALL CARPET(X1,Y1,KX1,KY1,LEV-1) |
|||
220 CALL CARPET(KX1,Y1,KX2,KY1,LEV-1) |
|||
230 CALL CARPET(KX2,Y1,X2,KY1,LEV-1) |
|||
240 CALL CARPET(KX2,KY1,X2,KY2,LEV-1) |
|||
250 CALL CARPET(KX2,KY2,X2,Y2,LEV-1) |
|||
260 CALL CARPET(KX1,KY2,KX2,Y2,LEV-1) |
|||
270 CALL CARPET(X1,KY2,KX1,Y2,LEV-1) |
|||
280 CALL CARPET(X1,KY1,KX1,KY2,LEV-1) |
|||
290 ELSE |
|||
300 PLOT X1,Y1;X2,Y1;X2,Y2;X1,Y2;X1,Y1 |
|||
310 PLOT X1+4,Y1+4,PAINT |
|||
320 END IF |
|||
330 END DEF</lang> |
|||
=={{header|J}}== |
=={{header|J}}== |