[2022][ruby][5.x] refactor

pull/1/head
Alpha Chen 2 years ago
parent a8f19091f7
commit c92d5a4346
Signed by: alpha
SSH Key Fingerprint: SHA256:3fOT8fiYQG/aK9ntivV3Bqtg8AYQ7q4nV6ZgihOA20g

@ -4,8 +4,8 @@ setup = setup
.lines(chomp: true)
.map(&:chars)
.transpose
.select { _1.last =~ /\d/ }
.map { _1[0..-2].join.strip.chars }
.map {|col| col.select { _1 =~ /[A-Z]/ }}
.reject(&:empty?)
moves = moves.scan(/move (\d+) from (\d+) to (\d+)/).map { _1.map(&:to_i) }
moves.each do |n,from,to|

Loading…
Cancel
Save