Skip to content

Instantly share code, notes, and snippets.

@panchew
Created September 14, 2010 16:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save panchew/579328 to your computer and use it in GitHub Desktop.
Save panchew/579328 to your computer and use it in GitHub Desktop.

Imagine a lotto contest with 48 numbers; you can buy tickets with a 6 number combination. To win the lotto contest, your combination must match the 6 numbers of the winning combination.

You have to write a ruby program (of course observing BDD) that will randomly generate 8 combinations with 6 numbers each. The numbers from 1 to 48 can not be repeated among combinations.

After the tickets generator is finished, you will have to add the ability to enter a winning combination and the program will must respond with the number of winning numbers matches in each ticket.

Extra point if you extend the array class to achieve the goal instead of using ruby's built in methods...

Good luck!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment