Lotto checking script

Feb 12
2008

The idea comes from http://www.waider.ie/hacks/workshop/perl/lotto.pl script.

Should I be so wasteful? No:

irb

my_numbers       = [1,2,3,4,5,6]
winning_numbers = [1,2,3,41,42,43]
 
result = 6 - (winning_numbers - my_numbers).size
 
puts "#{result} " +
  if not result.eql? 0
    "hits"
  else
    "hit"
  end

Comments are closed.

Calendar

February 2008
M T W T F S S
« Jan   Mar »
 123
45678910
11121314151617
18192021222324
2526272829  

Tags