1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
|
############################################################################
#
# File: sier1.icn
#
# Subject: Program to draw the Sierpinski triangle
#
# Author: Ralph E. Griswold
#
# Date: May 2, 2001
#
############################################################################
#
# This file is in the public domain.
#
############################################################################
#
# This program 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.
#
############################################################################
#
# Requires: Version 9 graphics
#
############################################################################
#
# Links: wopen
#
############################################################################
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
|