# 4.5. Coin Flip Simulation Tutorial¶

This lesson reinforces the enduring understanding that models and simulations use abstraction to generate new understanding and knowledge. The students will follow an instructor-led tutorial that shows how to build an app that simulates a coin flip using if/else and loops. The lesson asks the student to think more deeply about the concept of randomness, which was introduced in the LightsOff simulation app. Subsequent lessons in this unit will also explore randomness and how it is used in modeling and simulation.

### Professional Development

Complete the activities for Mobile CSP Unit 4 Lesson 4.5: Coin Flip Simulation Tutorial.

### Materials

• Coins (pennies, nickels, dimes, etc.) - enough for each pair of students to have one coin
• Presentation system (LCD projector/Interactive whiteboard)
• Access to computer, laptop, or Chromebook (install the Companion app on Chromebooks)
• Coin Flip Tutorial (video or handout)

## 4.5.1. Learning Activities¶

### Estimated Length: 45 minutes

• Hook/Motivation (10 minutes): Have students split into pairs. Each pair will flip a coin 20 times and record how many times the penny landed on heads and how many times the penny landed on tails.
• The kind of coin does not matter, as long as each pair is using the same type of coin. For example, your whole class can use all pennies or all nickels for this activity, but not a mixture of each.
• One person's job is to be the recorder and the other person's job is to be the coin flipper.
• The recorder should write their team's results on the classroom whiteboard.
Discussion: Based on the recorded data on the whiteboard, can we make any observations about flipping a coin? Did Heads turn up more often than Tails? If so, why might this be the case? What factors, if any, influence a coin flip?
• Web Article/Audio, "The Not So Random Coin Toss"
• "Flipping a coin may not be the fairest way to settle disputes. About a decade ago, statistician Persi Diaconis started to wonder if the outcome of a coin flip really is just a matter of chance. He had Harvard University engineers build him a mechanical coin flipper. Diaconis, now at Stanford University, found that if a coin is launched exactly the same way, it lands exactly the same way."
• Experiences and Explorations (25 minutes): To ensure that we are not influencing the toss of the coin, we are going to design a Coin Flip app that models the flipping of a coin. Lead the students through the design of the CoinFlip app. Allow faster students to follow the tutorial on their own. Identify new constructs used in this app, such as the IF/Else Block and For Each Loop. Teacher leads the students through the design of the user interface and then the students use the tutorial to complete the code on their own. Teacher answers any questions that students may have. Have students complete some of the optional mini projects if there is time. You may want to spend an extra class on the projects.
• Rethink, Reflect and/or Revise (5 minutes): Ask the class: Does the CoinFlip simulate true randomness? Why or Why not? Discuss this and then ask the students to write a reflection in their Google portfolio. If time permits, have the students try some interactive exercises. Any incomplete work should be finished for homework.

### AP Classroom

The College Board's AP Classroom provides a question bank and Topic Questions. You may create a formative assessment quiz in AP Classroom, assign the quiz (a set of questions), and then review the results in class to identify and address any student misunderstandings.The following are suggested topic questions that you could assign once students have completed this lesson.

Suggested Topic Questions:

• Topic 3.9 Developing Algorithms
• Topic 3.15 Random Values

### Assessment Opportunities

Solutions:

Assessment Opportunities

You can examine students’ work on the interactive exercise and their reflection portfolio entries to assess their progress on the following learning objectives. If students are able to do what is listed there, they are ready to move on to the next lesson.

• Interactive Exercises:
• Portfolio Reflections:
LO X.X.X - Students should be able to ...
• In the XXX App, look for:

### Differentiation: More Practice

If students are struggling with lesson concepts, have them review the following resources:

### Teaching Tips: Real World Examples

It's helpful and engaging for students to see connections to real world examples of the computer science concepts covered in the course. Here's one example related to randomness and simulation.

• This article and accompanying video from Wired magazine explains how Disney's Pixar had to create a new hair simulator for their animated film Brave in order to simulate curly hair. Randomness was used to generate this simulation of hair - and to enable creativity in other fields.

## 4.5.2. Professional Development Reflection¶

Discuss the following questions with other teachers in your professional development program.

• How does this lesson and modeling a simple coin flip help students toward the enduring understanding that the way statements are sequenced and combined in a program determines the computed result?
• How well does this lesson help students toward a deeper understanding of the if/else construct?

I am confident I can teach this lesson to my students.
• 1. Strongly Agree
• 2. Agree
• 3. Neutral
• 4. Disagree
• 5. Strongly Disagree