Cantor set: Difference between revisions

Content deleted Content added
Jjuanhdez (talk | contribs)
Cantor set en FreeBASIC
Jjuanhdez (talk | contribs)
Cantor set en BASIC256
Line 324: Line 324:
*** *** *** *** *** *** *** ***
*** *** *** *** *** *** *** ***
* * * * * * * * * * * * * * * *
* * * * * * * * * * * * * * * *
</pre>

=={{header|BASIC256}}==
{{trans|FreeBASIC}}
<lang BASIC256>
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] = chr(254)
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] = chr(32)
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
</lang>
{{out}}
<pre>
Igual que la entrada de FreeBASIC.
</pre>
</pre>