Skip to content

Commit 1553b61

Browse files
committed
Improved feedback during multi-run
1 parent acea680 commit 1553b61

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

multi_run.rb

+6-2
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,14 @@
1616

1717
last_line = []
1818

19-
options[:runs].times do
19+
options[:runs].times do |i|
2020
output = `ruby ./engine.rb -r #{options[:rounds]}`
2121
last_line.push output.split("\n").last
22+
round = i+1
23+
print "\rRound #{round} finished".rjust(30, ' ')
24+
STDOUT.flush
2225
end
26+
puts ''
2327

2428
winners = Hash.new(0)
2529

@@ -28,5 +32,5 @@
2832
end
2933

3034
winners.sort_by{|winner, times| -times}.each do |winner, times|
31-
puts "#{winner.gsub(' is the winner!', '')} won #{times} times"
35+
puts "#{winner.to_s.gsub(' is the winner!', '')} won #{times} times"
3236
end

0 commit comments

Comments
 (0)