[2016][ruby][11.0] solution!

profile
Alpha Chen 8 years ago
parent 3c1f21c490
commit e8bd4f505e

@ -83,10 +83,10 @@ end
if __FILE__ == $0 if __FILE__ == $0
INPUT = <<-INPUT INPUT = <<-INPUT
F4 . . . . . F4 .
F3 . . . LG . F3 . CoM CuM RM PlM
F2 . HG . . . F2 . CoG CuG RG PlG
F1 E . HM . LM F1 E PrG PrM
INPUT INPUT
Step = Struct.new(:state, :count) Step = Struct.new(:state, :count)
@ -96,11 +96,14 @@ F1 E . HM . LM
until steps.empty? do until steps.empty? do
step = steps.shift step = steps.shift
puts # puts
puts "Steps: #{step.count}" # puts "Steps: #{step.count}"
puts step.state # puts step.state
if step.state.floors[0..-2].all?(&:empty?) if step.state.floors[0..-2].all?(&:empty?)
puts
puts "Steps: #{step.count}"
puts step.state
exit exit
end end

Loading…
Cancel
Save