Skip to content

Instantly share code, notes, and snippets.

View panchew's full-sized avatar

Francisco Guzmán panchew

View GitHub Profile
@panchew
panchew / gist:661883
Created November 3, 2010 23:15
WatermarkConsoleOutput
>> example_image_path = "#{RAILS_ROOT}/public/images/wallpaper_original.jpg"
=> "/Users/flamaspeed/creative-allies/public/images/wallpaper_original.jpg"
>> example_image_output_path = "#{RAILS_ROOT}/public/images/wallpaper_watermarked.jpg"
=> "/Users/flamaspeed/creative-allies/public/images/wallpaper_watermarked.jpg"
>> apply_watermark(example_image_path, example_image_output_path)
user system total real
0.020000 0.040000 0.060000 ( 1.123081)
user system total real
0.020000 0.010000 0.030000 ( 0.048455)
user system total real

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!