Friday, January 15, 2016

Lottery Inspired Projects

This week’s monstrous PowerBall lottery jackpot (1.6 million US dollars) had a lot of people talking. I bought a ticket but didn’t win. On the other hand discussion brought up several good ideas for projects.
One of my friends built a spreadsheet that uses conditional formatting to let her know at a glance if one of her tickets is a winner. I may have students do something like that. When you add money to a project, even as abstract values, students tend to like it. And they might actually be able to use this to look at tickets their parents might buy. It’s always a struggle to find cool spreadsheet projects so this may be a good one.
I spent some time thinking about what the database used to store the lottery information looks like. A friend in the gaming industry told me it used to be an ISAM (Indexed Sequential Access Method) file. I didn’t get more details so I wonder what the key looks like. I don’t teach database these days but if I did this would make for a good design question.
Of course there is the obvious project of creating a simulator of the actual number selection. Various lotteries have various sets of numbers. PowerBall picks 5 of 69 numbers on white balls and one out of 26 red balls. The hard part is making sure there are no duplicates among the white balls. This one may be fun for students. It would be interesting to talk about various solutions that may or may not involve arrays. Students do not always see how much easier a good array can make things.
I think I’ve got one new project for each of my current courses. So while I may not have won any money I think I have won in other ways from all the hoopla.

Doug Peterson takes on lottery inspired programming projects in a post at In praise of lotteries I use some of these ideas already.


Sigmund Linden said...

I also had a ticket for that historic draw; bought online, Icelotto review. Mine won nothing as well. It's really cool it inspired you start the project, which surely make you a winner in the mentioned respect. Carry on!

Hall Gordy said...

Excellent implementation of the idea! Very interesting piece of programming.