Sierpinski triangle/Graphical: Difference between revisions
Content added Content deleted
m (improve) |
m (Obvious fix to task!) |
||
Line 1: | Line 1: | ||
{{Draft task}} |
{{Draft task}} |
||
Produce |
Produce a graphical representation of a [[wp:Sierpinski triangle|Sierpinski triangle]] of order N in any orientation. For example, the Sierpinski triangle of order 4 should look like this: |
||
=={{header|Icon}} and {{header|Unicon}}== |
=={{header|Icon}} and {{header|Unicon}}== |
||
The following code is from program by Ralph E. Griswold that demonstrates an interesting way to draw the Sierpinski Triangle. For an explanation, see |
The following code is from program by Ralph E. Griswold that demonstrates an interesting way to draw the Sierpinski Triangle. For an explanation, see |
Revision as of 07:59, 6 May 2011
Sierpinski triangle/Graphical is a draft programming task. It is not yet considered ready to be promoted as a complete task, for reasons that should be found in its talk page.
Produce a graphical representation of a Sierpinski triangle of order N in any orientation. For example, the Sierpinski triangle of order 4 should look like this:
Icon and Unicon
The following code is from program by Ralph E. Griswold that demonstrates an interesting way to draw the Sierpinski Triangle. For an explanation, see "Chaos and Fractals", Heinz-Otto Peitgen, Harmut Jurgens, and Dietmar Saupe, Springer-Verlah, 1992, pp. 132-134.
<lang Icon>link wopen
procedure main()
local width, offset, x, y
WOpen("label=sierpinski", "size=300,300") | stop("*** cannot open window")
width := 256 offset := 30
every y := 0 to width - 1 do every x := 0 to width - 1 do if iand(x, y) = 0 then DrawPoint(x + offset, y + offset)
Event()
end</lang>