[2021][ruby][12.x] tweak

pull/2/head
Alpha Chen 3 years ago
parent d40179f8c1
commit 8f7c9985a5

@ -14,11 +14,11 @@ loop do
cave.fetch(path.last) cave.fetch(path.last)
# .reject { _1 =~ /^[a-z]+$/ && path.include?(_1) } # .reject { _1 =~ /^[a-z]+$/ && path.include?(_1) }
.reject { _1 == "start" } .reject { _1 == "start" }
.map { path + [_1] } .reject {|cave|
.reject {|path| smalls = path.tally.select { _1 =~ /^[a-z]+$/ }
small = path.tally.select { _1 =~ /^[a-z]+$/ } smalls.fetch(cave, 0) > (smalls.any? { _2 > 1 } ? 0 : 1)
(small.count { _2 > 1 } > 1) || small.any? { _2 > 2 }
} }
.map { path + [_1] }
} }
end end

Loading…
Cancel
Save