Tuesday, March 24, 2009

Guessing Game to Learn How to Loop Results!

Last week I told you that I tasked my COP1000 - Intro to Programming class to create a guessing game to teach my students the concept of looping.

This guessing game used a random generator call that would return a value between 1 and 100. The program would prompt the user to enter a number. If the number was bigger than the correct answer, a message would display indicating the guess was too high. Likewise, if the user guessed a value lower than the correct answer, a message would display indicating the guess was too low.

The game would continue until the user guessed correctly. At that point, the program would indicate the right answer had been guessed and the number of tries it took.

I was curious if my students would enjoy programming this project more simply because it was a game. Here are a few results of this project:


  • every student in the class actually submitted this project. That's a first.
  • not all projects worked correctly. When you realize that programming a loop is probably one the hardest concepts they will learn when programming, the fact that all programs didn't work was not a surprise.
  • for those students whose project did not work correctly were very interested in getting the project to work so they could show their friends.
  • most students went above and beyond the specs of the project. Some drew funny little pictures (closely related to hangman) as the user guessed indicating that the user should guess correctly before the picture completed.
  • I asked the class if they enjoyed this project and I received a resounding YES! Here's a quote from one of my students:

"Yes I enjoyed this project a lot actually. It was very cool to program a game and then have my friends try it. They didn't even have to ask questions on how to play, it made me feel pretty good. Look forward to the next one."

I have found these results to be profound! My previous posts have been about the successes of other schools in their use of games to teach concepts so this shouldn't be such a big surprise. I'm pleased that my results were aligned with some of my research. It will take more than one project to make this a valid fact, but we are on our way.

I'm currently thinking of a game that my students could program to utilize the next concept - for loops! Previously, I had them drawing figures - such as triangles, rectangles, squares, trapazoids, you name it. Most students completed this project, but not with the enthusiasm of programming a game. Let me know if you have any great ideas!

1 comment:

  1. Hi Debbie,

    I do the same project (mine was due this week) and I did it last semester too. Everyone always likes it. I've tried to add more functionality and more options (or different options) each semester. I'm not sure if the students respond so well to this project because it's more fun than writing other looping programs or because I get all enthusiastic about it -- because I love the idea of programming games!

    But I do think students respond well to learning through gaming. The very first thing I ask them to consider now is how to write a program to generate 6 numbers to play the Lottery. [This is before they know loops or decisions.] I know they perk up when we start to talk about this -- I start with "Create a program to generate 6 numbers for the lottery" and we have to hone it down to avoid repeats, to keep the numbers in a given range, to make sure they're all integers, and so on. But even at this very basic level, I sense a greater interest and I think students are more alert.

    The thing I worry about is -- if we teach most topics through gaming, will that become boring too? I mean, is part of the thrill of programming a guessing game that it is sort of like getting ice cream one night a week after a steady diet of fruit for desert. Would ice cream get boring if it were served every day?

    I think I'm going to get some ice cream right now!

    ReplyDelete