[2024][ruby][6.x] optimize obstacles

main
Alpha Chen 6 days ago
parent a7822ce4f1
commit d45a1cd455
Signed by: alpha
SSH Key Fingerprint: SHA256:3fOT8fiYQG/aK9ntivV3Bqtg8AYQ7q4nV6ZgihOA20g

@ -44,10 +44,11 @@ rescue Loop
true
end
pp patrol(input).map(&:first).to_set.length
path = patrol(input).map(&:first).to_set
pp path.length
pp input
.select { _2 == ?. }
.select { path.include?(_1) && _2 != ?^ }
.select {|xy, _|
# pp xy
input[xy] = ?#

Loading…
Cancel
Save