forked from reedlaw/ruby-mmo
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Reed Law
committed
Apr 12, 2012
1 parent
2f24b4c
commit 085f657
Showing
3 changed files
with
43 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
#!/usr/bin/env ruby | ||
|
||
last_line = [] | ||
|
||
1000.times do | ||
output = `ruby ./engine.rb` | ||
last_line.push output.split("\n").last | ||
end | ||
|
||
winners = Hash.new(0) | ||
|
||
last_line.each do |val| | ||
winners[val] += 1 | ||
end | ||
|
||
winners.sort_by{|winner, times| -times}.each do |winner, times| | ||
puts "#{winner.gsub(' is the winner!', '')} won #{times} times" | ||
end |