Pop the balloons – maths game for home schooling

[This article was first published on R – scottishsnow, and kindly contributed to R-bloggers]. (You can report issue about the content on this page here)
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

I read this article on home schooling and maths last week. There are some really good new ideas – and a pat on the back for doing some already.

My son (6 yrs) and I tried out the pop the balloons game yesterday. Write the numbers 2-12, colour in some balloons next to some of the numbers and then pop them by throwing two dice that sum to the balloon number. Here are our score sheets.

Score sheets for our balloon popping by dice throw.

We then added our tallies together to see how many of each roll we got. I asked where he’d put his balloons next time to pop them faster (4, 6, 8, 10, 12), I don’t think he was making the link between what we threw and a pattern. Possibly because we talk about dice throwing being luck/chance/random.

Table of dice rolls.

Next we converted these to a bar graph. Having previously made graphs on a computer he thought drawing it out was tedious! However, he enjoying colouring the bars in – to a point. Guess where.

Bar chart of dice rolls.

Finally we tallied up the ‘number friends’ (school term to describe two numbers which add up to a given number, e.g. 6 and 4 are number friends for 10) for each possible dice total. I took an quick decision that explaining a roll of 2 and 3 wasn’t the same as a roll of 3 and 2 was a leap too far – so we ignored those. It was at this point that he decided next time we played he would put all his balloons on middle numbers.

Count of number friends for each dice total

However… I thought it would be neat to show him how to solve the problem with a computer. So I bashed out a quick function in R to simulate rolling a die. The code below samples numbers from 1 to 6, allowing replacement. The default rolls of the die are 10, but this can be changed by the user.

roll_die = function(n = 10){
  sample(1:6, size = n, replace = T)
}

Next we can roll our two dice a million times (6 yr old jaw on the floor) and sum the two numbers.

x = tibble(die_1 = roll_die(1000000),
       die_2 = roll_die(1000000)) %>% 
  mutate(total = die_1 + die_2)

We can take the output from this to see how many rolls summed to each number, and because we know the total number of rolls what the probability of scoring each total was (the latter omitted for 6 yr old).

x %>% 
  count(total) %>% 
  rename(roll_total = total) %>% 
  mutate(occurence = scales::comma(n),
         probability = n / nrow(x)) %>% 
  select(-n)
roll_totaloccurrence probability
227,9530.0280
355,2030.0552
483,3960.0834
5111,5530.112
6138,9220.139
7166,1500.166
8138,9130.139
9111,0120.111
1083,5330.0835
1155,7030.0557
1227,6620.0277

We can also graph the results from the above table:

x %>% 
  ggplot(aes(as.factor(total))) +
  geom_bar() +
  scale_y_continuous(labels = scales::comma) +
  labs(title = "What do you score if you roll two dice a million times?",
       x = "Dice roll total",
       y = "Count")

Finally, we print out all the distinct dice combinations for each total. I’ll not print the result here, but the code is below. We can also tally the number of distinct combinations (table below).

# List combinations
lapply(2:12, function(i){
  x %>% 
    filter(total == i) %>% 
    distinct()
})

# Count combinations
y = lapply(2:12, function(i){
  y = x %>% 
    filter(total == i) %>% 
    distinct()
  
  tibble(total = i,
         combinations = nrow(y))
})
do.call("rbind.data.frame", y)

Roll totalCombinations
21
32
43
54
65
76
85
94
103
112
121

It’s a fun little exercise and there are many layers of learning for children of different ages.

To leave a comment for the author, please follow the link and comment on their blog: R – scottishsnow.

R-bloggers.com offers daily e-mail updates about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

Never miss an update!
Subscribe to R-bloggers to receive
e-mails with the latest R posts.
(You will not see this message again.)

Click here to close (This popup will not appear again)