module SP function rule90(filename, size) height = 2 ^ size width = height * 2 - 1 x = zeros(Bool, width + 2) x[height+1] = true y = copy(x) open(filename, "w") do f println(f, "P1") println(f, "$width $height") for i in 1:height for j in 1:width println(f, y[j+1] ? "1 " : "0 ") y[j+1] = x[j] ⊻ x[j+2] end println(f, "") x, y = y, x end end end # julia> SP.rule90("/tmp/test.pbm", 9) end