Coding an Unfair Coin With MicroBit

0
Coding an Unfair Coin With MicroBit
Tweet about this on TwitterShare on FacebookPin on PinterestShare on LinkedInShare on Google+Share on TumblrEmail this to someoneShare on StumbleUponShare on RedditDigg this

In this activity we will code an unfair coin to demonstrate probability with the MicroBit.





It was announced this morning that MicroBit is launching an educational foundation and educators across the globe will be able to get their hands on this gadget. As such, we will build a quick app to demonstrate an unfair coin.

In theory, flipping a coin yields a 50/50 chance of returning heads or tails. We can simulate this by using the Random function found inside coding languages. Here’s how it works.

If (Pick Random Number Between 0 and 1) Returns 1 Then Show “Tails”
Else Show “Heads”

However, because we want to make an unfair coin, we will make our range larger.

If (Pick Random Number Between 0 and 2) Returns 1 Then Show “Tails”
Else If (Pick Random Number Between 0 and 2) Returns 2 Then Show “Tails”
Else Show “Heads”

You’ll notice from the above example we have changed the theoretical probability of this similar to be 66/33. This means for every Heads, we should have two tails.

Let’s run the experiment:




If you would like to see more activities like this, check out http://www.hourofcuriosity.com.

If you would like to bring MicroBit to your classroom, contact us over at http://www.fairchancelearning.com.

Tweet about this on TwitterShare on FacebookPin on PinterestShare on LinkedInShare on Google+Share on TumblrEmail this to someoneShare on StumbleUponShare on RedditDigg this
(Visited 118 times, 1 visits today)

Leave a Reply

Name
Name*
Email
Email *
Website
Website