15 lines
293 B
Ruby
15 lines
293 B
Ruby
def wall?(x, y, input)
|
|
num = input + ((x*x) + (3*x) + (2*x*y) + y + (y*y))
|
|
num.to_s(2).split("").map(&:to_i).reject(&:zero?).count.odd?
|
|
end
|
|
|
|
input = STDIN.read.chomp.to_i
|
|
|
|
x = (0..80).map do |y|
|
|
(0..80).map do |x|
|
|
wall?(x, y, input) ? "#" : "."
|
|
end.join("")
|
|
end.join("\n")
|
|
|
|
puts x
|