4.6. Coin Flip Experiment optional

This lesson reinforces the enduring understanding that models and simulations use abstraction to generate new understanding and knowledge. In this case students will use the coin flip model in an experiment that aims to test a hypothesis about the quality of App Inventor's random-number generator. If App Inventor's random-number generator is a good one, then if you simulate a coin flip many times and keep track of the outcomes, it should come up heads around 50% of the time. Students will use a pre-built app to run the coin-flip experiment many times and tabulate the results.

CSP Framework
Big Idea 3: Algorithms and Programming (AAP)
Enduring Understanding AAP-3: Programmers break down problems into smaller and more manageable pieces. By creating procedures and leveraging parameters, programmers generalize processes that can be reused. Procedures allow programmers to draw upon existing code that has already been tested, allowing them to write programs more quickly and with more confidence.
Learning Objective AAP-3.F.a: For simulations: a. Explain how computers can be used to represent real-world phenomena or outcomes.
Learning Objective AAP-3.F.b: For simulations: b. Compare simulations with real-world contexts.

Professional Development

Complete the activities for Mobile CSP Unit 4 Lesson 4.6: Coin Flip Experiment.

Materials

  • Access to computer, laptop, or Chromebook (install the Companion app on Chromebooks)
  • Access to mobile device with the Companion app installed or access to the emulator installed on the computer or laptop.
  • Paper and pencil to record observations or access to a spreadsheet
  • POGIL Roles
  • Pre-built Coin Flip Experiment app (QR code to download APK)
  • Optional - Source code for app - If you are using the emulator, you will need to download the source code, open it in AI2, and then run the emulator to use the app.

4.6.1. Learning Activities

Estimated Length: 45 minutes

  • Hook/Motivation (5 minutes): In the last lesson, students created the Coin Flip Simulation app. Using Think-Pair-Share technique, ask the students to think about whether or not this was a good approximation of the randomness of a coin flip and explain why or why not. Ask them how they could test whether or not it was a fair coin and how they would know that. Have the class write down a hypothesis for the experiment.
  • Experiences and Explorations (25 minutes): A fair coin is one that would flip a heads 50% of the time and tails the other 50%. So, the coin flips in the app should be 50% heads and 50% tails. However, we would need to test this with many flips to get more accurate data. Ask them how many flips do they think are needed? (Answers of 100 or less are too few. Answers above 1000 will be more accurate.) Ask them how long they think it would take them to flip a coin 1,000 times by hand and then observe how long it takes them to do in the app.
    • Optional - Source Code Review: Show the students the source code for the app. Have them explain in their own words what the algorithm does. What if the experiment was based on a faulty algorithm? Note that this app checks that the input into the text field is a valid number between 1 and 100 — otherwise, faulty user input would be able to crash the app.
    • Experiment Activity: NOTE: This activity has been recast as a POGIL activity for 2016-17. See the description of the activity on the student-facing branch. The POGIL teams will download the Coin Experiment App and run the experiment. The app lets the user flip a coin N times (N <= 100). Teams should run the experiment 10 or 20 times, generating 1000 or 2000 coin flips, and record the results in a table, as described in the lesson. The format is given in the student lesson.

      NOTE: The student lesson has a link to this Google spreadsheet. Each POGIL team should make their own copy and then use it to enter their data. It will automatically calculate percentages. Here is a classroom spreadsheet that contains the POGIL spreadsheet plus a spreadsheet that can be used to gather data from each of the POGIL teams.


      Note: If you are using emulators, use the link below the barcode to download the source code for the app. You can then run it on your emulator from App Inventor.
    • Discussion: Each group should share their results data, either on the board or through a shared Google Doc. Discuss the results and whether or not the experiment's hypothesis is true: that App Inventor’s random integer block is a good approximation of the process of randomly generating a 1 half the time and a 2 half the time. One idea for discussing the class's results as a whole might be to have the teams input their totals into a Google spread sheet, such as: Experimental results spreadsheet.
  • Rethink, Reflect and/or Revise (10 minutes): Have students complete their portfolio reflections.

4.6.2. Professional Development Reflection

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

  • How does this lesson help students toward the enduring understanding AAP-3?

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

Before you keep reading...

Runestone Academy can only continue if we get support from individuals like you. As a student you are well aware of the high cost of textbooks. Our mission is to provide great books to you for free, but we ask that you consider a $10 donation, more if you can or less if $10 is a burden.