parent
31afd41329
commit
21e4174051
@ -0,0 +1,14 @@
|
|||||||
|
patterns = ARGF.read.split("\n\n")
|
||||||
|
.map { _1.split("\n").map(&:chars) }
|
||||||
|
|
||||||
|
def find_fold(pattern)
|
||||||
|
(0.5...pattern.length-0.5).step(1).find {|fold|
|
||||||
|
a = pattern[0..fold.floor]
|
||||||
|
b = pattern[fold.ceil..]
|
||||||
|
a.reverse.zip(b).reject { _1.any?(&:nil?) }.all? { _1 == _2 }
|
||||||
|
}&.ceil
|
||||||
|
end
|
||||||
|
|
||||||
|
verts = patterns.map { find_fold(_1.transpose) }.compact
|
||||||
|
hors = patterns.map { find_fold(_1) }.compact
|
||||||
|
p verts.sum + hors.sum { _1 * 100 }
|
Loading…
Reference in new issue