What should the punishment be for students playing poker during class? Well, for my recent "Foundations of Object Oriented Programming" class, there was no punishment -- rather, playing poker was required.
Each time I teach this class, I let the students select their final programming project. Of course, I give them suggestions and reserve the final decision for myself, but I think overall this works well since they get to work on something that matters to them.
One requirement of the project is that it must be divisible into groups and the groups must be able to work independently. Since this is an object oriented class, this usually involves interfaces and mock objects, etc. In my most recent class, we designed an interface for poker playing and each group was required to implement a "poker bot".
Once all was said and done, we had a tournament and it was a lot of fun. Below is a video of (the rudimentary graphical interface I made of) one instance of our playoff.
There are quite a few reasons I think this makes an especially good project for this class. For one, the students are introduced to a number of important programming principles. All of their submissions must conform to the interface we design over the course of our discussions about the project (which usually span the entire second half of the semester). Second, the way our implementation was designed introduced students to event driven programming since basically each action by any player generates an event to all the other player bots. Also, given the nature of the problem, students are given a crash course in machine learning (if only to make it painfully clear that teaching computers to make "think" like humans is difficult).
Lastly, congratulations to everyone who participated in this project, I know it was a lot of work and all your bots competed admirably.