4jZzCzEmUX6zaeaFerY9um changeset
Changeset | 353536656433 (b) |
---|---|
Parent | None (a) |
a | b | ||
---|---|---|---|
0 | + | class << LotteryDraw | |
0 | + | def play | |
0 | + | final = LotteryTicket.new_random | |
0 | + | winners = {} | |
0 | + | @@tickets.each do |buyer, ticket_list| | |
0 | + | ticket_list.each do |ticket| | |
0 | + | score = ticket.score( final ) | |
0 | + | next if score.zero? | |
0 | + | winners[buyer] ||= [] | |
0 | + | winners[buyer] << [ ticket, score ] | |
0 | + | end | |
0 | + | end | |
0 | + | @@tickets.clear | |
0 | + | winners | |
0 | + | end | |
0 | + | end | |
... |
|
|