RosettaCodeData/Task/Cantor-set/BASIC256/cantor-set.basic
2023-12-16 21:33:55 -08:00

33 lines
702 B
Text

global ancho, alto, intervalo
ancho = 81 : alto = 5
dim intervalo(alto, ancho)
subroutine Cantor()
for i = 0 to alto - 1
for j = 0 to ancho - 1
intervalo[i, j] = "■"
next j
next i
end subroutine
subroutine ConjCantor(inicio, longitud, indice)
segmento = longitud / 3
if segmento = 0 then return
for i = indice to alto - 1
for j = inicio + segmento to inicio + segmento * 2 - 1
intervalo[i, j] = " "
next j
next i
call ConjCantor(inicio, segmento, indice + 1)
call ConjCantor(inicio + segmento * 2, segmento, indice + 1)
end subroutine
call Cantor()
call ConjCantor(0, ancho, 1)
for i = 0 to alto - 1
for j = 0 to ancho - 1
print intervalo[i, j];
next j
print
next i
end