Over the years I have used a number of projects to give students practice using if statements – especially those that involved nesting or checking lots of values. Currently I am using:
- Hurricanes – user enters a wind speed and the program reports the storm category
- Voting – User enters an age, and checks boxes to indicate citizenship and registration
- Pizza pricing – Base pizza prices plus add-ons for veggies, meats, or different cheeses.
- Movie theatre pricing – a bit easy as there is only ages to check but ranges require some thought.
- Ski tickets – prizes based on age and whether or not they are staying at the resort. I could add holiday/weekend of midweek as well.
- Jumanji – If the random number generator “rolls” two dice whose totals are a 5 or and 8 let the player out of the jungle.
These all work fairly well. Students relate to most of those. Voting gets kids thinking about their future so that is a plus. Obviously decision structures show up in other projects all semester long but these have that as a special focus.
I’m trying to think of some new ones. Projects that are relatable and that are complicated enough to make students think but not so hard that they get frustrated easily. What are you using? What works well with your students?
Of course I can't find the tweet now, but I modified this assignment: https://docs.google.com/document/d/1HsRSC3H_u6KcQhv2y9cWyrYV3xpvvBUcAvoaH-FsG0I/edit from Evan Peck for my high school intro class this year and had some awesome discussion as a result.
ReplyDeleteJust wrote a post with one (and I planned on writing it before I saw this :-) ).
ReplyDeleteif (room == "foyer"):
ReplyDeleteif (action == "back"):
room == "outside"
elif (action == "forward"):
room == "hall"
Write text adventure games, which let students choose a domain that interests them. Also a good way to motivate refactoring later in the course as they learn about other programming language elements.
I love the idea of text adventures. Choose your own story path are fun as well and I had a student do a mini version of one recently.
ReplyDeleteI'm thinking about a version of the Evan Peck project for my students. I am thinking about allocation of parking permits (a highly valued limited edition in my school). Possibly some interesting conversations.
A couple of decades ago (boy does that sound old) I used to have the kids write a text D&D game that was all nested "if" statements. The basic concept was to work through a maze and collect jewels. A bit long and tedious for now but still could be fun with the right approach. If I remember right it was arrays for the maze.
ReplyDeleteI've used the Ski Lift Ticket problem you mention. Another similar challenge that students enjoy is Cay Horstmann's "Minivan Locks" problem:
ReplyDeleteA minivan has two sliding doors, and each door can be opened by either a dashboard switch, its inside handle, or its outside handle. The inside handles won't work if a child lock switch is activated, and in order for the sliding doors to open, the gear shift must be in park and the master unlock switch must be activated. Given an input that is a sequence of values for the switches and the gear shift, identify if the left door only is unlocked, the right door only is unlocked, both doors are unlocked, or both doors are locked. Sample input would be
0 0 0 1 0 1 0 0 P
where those nine values represent respectively:
* Dashboard switches for left and right sliding door, child lock, and master unlock (0 for off or 1 for activated)
* Inside and outside handles on the left sliding door (0 or 1)
* Inside and outside handles on the right sliding door (0 or 1)
* The gear shift setting (one of P N D 1 2 3 R).
Classic!