Novice Programmers Working on a Probability Problem

BACK: Navigation

How novice programmers (high school students in an introductory programming course) react to probability-based simulations that they themselves coded?


Through software like NetLogo, students are able to create hypotheses, run models of real-world situations, and use the results of those simulations in order to build evidence for their original theories (Wilensky). I propose this question in attempt to establish a relationship between the way that a pair might code and how they engage with results from the RC Cola Problem. I mention four different pairs who were all surprised at their results, but engaged with the meta-ideas of the problem in various ways. I find that pairs which write code with good software practices had more meaningful engagements with the mathematics of the problem.  


This project was created for UC Berkeley’s EDUC 130 (Knowing and Learning in Mathematics and Science) as part of the school’s CalTeach program. The course, instructed by Dor Abrahamson and Leela Velautham, aims to develop pedagogical disciplines, dispositions, knowledge, tools, and skills for the classroom through facilitation of collaborative problem-solving and reflection activities.

RC Cola Problem

RC Cola is having a promotional contest in order to make a comeback in the soda industry! They label numbers on the bottom of each soda cap from 1-6.If you happen to get a bottle with the number ‘1’ on it, you win the prize!

This is a prize you NEED: Guaranteed admission to your dream college, all the skins in Fortnite, your chance to meet any celebrity.. You’ve completely lost your mind and you won’t stop buying sodas until you’ve bought a soda with a ‘1’ on the cap. You go up to an infinite RC Cola machine and do just that. Now suppose 10,000 people line up behind you because they also want this prize. Every one is waiting in this line so that they can do the exact same thing: Buy a soda, check the number.. 3? Buy a soda, check the cap to see if it’s a 1– 6? Buy a soda, check the cap to see if it’s a 1–yes! Out of excitement, people scream how many bottles they bought in total.

Researcher Helen Chen (thanks Helen) is curious to see which number was most likely to be shouted. She stands next to the RC Cola machine with a clipboard and makes a list of the numbers that people are shouting. Every time somebody shouts a number, she appends it to her list. Print out this list that Helen has on her clipboard.

An outputting graph (if coded correctly) should look like:

Many people think that the graph should be like a hill/normal distribution centered around 3/4/5/6. When asked to explain why they think this, there is often conflict in the logic and how the student thinks about the problem. My research question formed out of curiosity about how students could turn it instead into a logic problem–breaking down the individual steps and creating a simulation. After coding the simulation of the situation, students could receive some feedback (graph). How would they react to that graph? Would they also try to explain the mathematical relationship of the graph? Would they doubt their code? Would they doubt the software that they are coding on?


Video data was collected across five different pairs in the class, but only one of these five pairs finished. I used the video data from this one pair. I also collected students code periodically every 10 seconds and conducted post-activity interviews with the pairs which finished the activity.

Results and Discussion

I discuss the stories of four different pairs–which had varying levels of ‘good software practices,’ and the noted the idea of ‘coding iteratively.’ I found that groups that coded more iteratively or those who thought about their code before any typing tended to engage more with trying to understand the mathematics of the problem.

In the end, I propose that coding lessons should be a way of teaching students how to think, rather than a lesson about syntax or doing ‘fun’ projects. I discuss the project in much further detail (mathematics of the RC Cola Problem, lesson plan, more details about the methods, more specificity about results,…) in the paper. A poster version can also be found here.