Cantor set: Difference between revisions

m
→‎{{header|Wren}}: Changed to Wren S/H
m (→‎{{header|Wren}}: Changed to Wren S/H)
(4 intermediate revisions by 2 users not shown)
Line 232:
cantor(inicio, largo, índice)
seg=0
#( seg:=(int(largo/3))), no es cero?, entonces{
no es cero?, entonces #basic{
#( líneas[índice:HEIGHT, (inicio+seg):((inicio+seg*2)-1)] = " ")
#( cantor( inicio, seg, índice+1 ) )
#( cantor( (inicio+(seg*2)), seg, índice+1 ) )
siguiente}
}
retornar
Line 253 ⟶ 254:
#include <basico.h>
 
#define WIDTH 81
#define HEIGHT 5
 
Line 259:
 
decimales '0'
seg_size = 0, linescantor=5"", lj=0
iterar para (j=0, #(j<=lines), ++j)
#(seg_size i= 3^(lines-j-1))0
c="",cadenas i=0's,v'
iterar grupo ( ++i, #(i< (3^j)),\
#( cv = cat( c, occurs("1", dectobase(i,3)) ? " " : "#"; )))\
#(l s =len s $ replicate(cv, 3^(HEIGHT-j-1) )), s="")
para#(cantor cada= caracter(v,cantor $ s c,$ lNL)
mientras ' #(j<=HEIGHT); ++j '
#( s = cat(s, replicate( v, seg_size )))
imprimir (s, NLcantor)
siguiente
imprimir (s, NL)
siguiente
 
terminar
Line 1,094 ⟶ 1,092:
{{out}}
Same result of Java
 
=={{header|EasyLang}}==
 
[https://easylang.dev/show/#cod=S87PyS9SMDU15Sooyk9WSE7MKwHyKxQqFYqrFPQU9LgUFBQy00AcOwUDPUMQFwiKq4wVbEGC+grGUKHc/LJUsD5dkCxUsCg1uQSkDCGCZAFYITYpbQUjBS2wJJoiPS49LqgqAwULAwVDAwMuAA== Run it]
 
<syntaxhighlight>
color 555
proc cantor x y sz . .
if sz > 0.1
sz3 = sz / 3
move x y - sz3
rect sz sz3
cantor x y - sz3 sz3
cantor x + 2 * sz3 y - sz3 sz3
.
.
cantor 0 80 100
</syntaxhighlight>
 
=={{header|Elixir}}==
Line 4,340 ⟶ 4,356:
=={{header|Wren}}==
{{trans|Kotlin}}
<syntaxhighlight lang="ecmascriptwren">var width = 81
var height = 5
 
9,483

edits