Task

Draw a Cantor set.



See details at this Wikipedia webpage:   Cantor set

100 PROGRAM "Cantor.bas"
110 GRAPHICS HIRES 2
120 SET PALETTE BLACK,WHITE
130 CALL CANTOR(28,500,1216,32)
140 DEF CANTOR(X,Y,L,HEIGHT)
150   IF L>3 THEN
160     PLOT X,Y;X+L,Y,X,Y+4;X+L,Y+4
170     CALL CANTOR(X,Y-HEIGHT,L/3,HEIGHT)
180     CALL CANTOR(X+2*L/3,Y-HEIGHT,L/3,HEIGHT)
190   END IF
200 END DEF