Below I will examine a slightly simpler solution, that still produces pretty good results.Īndy Restrepo's code is a random generation scheme. used a backtracking search, verifying that a solution is still possible as each ticket is added. Brian's own solution generates bit map patterns representing blanks and non-blanks in a ticket, then uses those patterns to construct books filling in numbers as it works. There are many ways to approach this quiz. The more he generated, the more I realized how much I liked the problem.
When I say discussed, I mean that Brian generated a nearly endless stream of excellent ideas while I watched it all happen. When Brian first suggested the quiz, we discussed the possible solutions. This is the realization I came to as well. On the surface it seems relatively simple.
said it best in a note attached to his solution: Write a Ruby program which generates random complete books of ticketsĮric I. Write a Ruby program which generates random individual ticketsĢ. Given the above rules for the validity of tickets and books, then:ġ. There are two levels of quiz difficulty to choose from. Each row contains exactly 5 numbers (and hence 4 blanks). The first column contains numbers from 1 to 9 the second column numbers from 10 to 19 the third 20 to 29 and so on up until the last column, which contains numbers from 80 to 90.Įach column contains one, two or three numbers, in increasing order downwards. Each ticket shows exactly 15 numbers, and in each book every number from 1 to 90 is used exactly once.Ī ticket is a grid of 3 rows by 9 columns. A version of Bingo played in the UK and some other countries is called "Housie".