Coin Flip Simulation Projects: In this lesson you will complete several small programming projects that add enhancements to the CoinFlip app.
- Add additional features to an existing mobile app.
- Modify some of the code of an existing app.
- Improve coding skills by solving simple and challenging programming problems.
- Use Math random number blocks to generate a random value.
Here are some creative projects to enhance the CoinFlip app and help build your programming skills
- Modify the app so that the user can also shake the phone to flip the coin. (HINT: Use the Accelerometer Sensor.) NOTE: Instead of copying and pasting the coin-flip algorithm, you'll want to use a procedure to reduce complexity in your code.
- Modify your app so that “heads” or “tails” is spoken when the coin is flipped. (HINT: Use the TextToSpeech component.)
- Modify the event handler in the Coin Flip app to use random fraction instead of random integer. (HINT: A random fraction is a decimal number between 0 and 1, not including 1. Some examples: 0, 0.25, 0.33, 0.5, 0.66, 0,75, 0.99.)
- If/else Algorithm: You now have an app that can flip a two-sided coin. Modify your app that so that it can flip a three-sided coin. (Hint: You will need an if/else block with three conditions. You’ll need a third image for this problem; Retrieve the image for the Coin on Edge from the box on the right.
- According to this report, if you stand a bunch of Lincoln pennies on their edge and then bang the table, they have a strong bias toward coming up heads. Let’s suppose the coin has a 70% chance of coming up heads (30% tails) in this experiment. Create a model to simulate this biased coin. (HINT: Create a separate project for this problem.)
- Be Creative. Come up with your own ideas to enhance your app.
Make sure that you do the Self-check at this link and that you update your Google Site Portfolio