Revision 353536656433 () - Diff

Link to this snippet: https://friendpaste.com/4jZzCzEmUX6zaeaFerY9um
Embed:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
class << LotteryDraw
def play
final = LotteryTicket.new_random
winners = {}
@@tickets.each do |buyer, ticket_list|
ticket_list.each do |ticket|
score = ticket.score( final )
next if score.zero?
winners[buyer] ||= []
winners[buyer] << [ ticket, score ]
end
end
@@tickets.clear
winners
end
end