4jZzCzEmUX6zaeaFerY9um changeset

Changeset353536656433 (b)
ParentNone (a)
ab
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
...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
--- Revision None
+++ Revision 353536656433
@@ -0,0 +1,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