blob: 54b3bf92e726fd0970a7659371f979536e752f09 (
plain)
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
|
#!/usr/bin/env ruby
W = 25
T = 6
input = $stdin.readlines[0].strip.chars.map(&:to_i)
layers = input.each_slice(W * T).to_a
image = layers.pop
layers.reverse.each do |layer|
(W*T).times do |i|
case layer[i]
when 0
image[i] = 0
when 1
image[i] = 1
end
end
end
image.each_slice(W).each_slice(2) do |u, l|
if l.nil? then
u.each do |p|
case u
when 0
print " "
when 1
print "▀"
end
end
else
W.times do |i|
case [u[i], l[i]]
when [0,0]
print " "
when [0,1]
print "▄"
when [1,0]
print "▀"
when [1,1]
print "█"
end
end
end
puts
end
|