Probability:
Rolling six-sided dice using a Python program and five human rollers
Yasiris Ortiz, 10/23/2019
ABSTRACT
In this paper, the author describes how rolling dice in two different methods can lead to obtained different results. Rolling dice have been used to teach probability ever since. Nowadays, rolling dice can be effectively simulated using technology; however, doing this task manually to just study probability might become a too time-consuming task. In this experiment, dice were rolled 100 times in two different ways. First, using a computer program written in Python and second with the participation of five human rollers. In these two ways, results were reported and recorded to get the most and least common combinations, frequent sum and frequent number along with the explanation of several differences that might affect the results.
I. INTRODUCTION
What is probability? According to The Free Dictionary probability is “A number expressing the likelihood of the occurrence of a given event, especially a fraction expressing how many times the event will have in a given number of tests or experiment.” They provided the example of rolling a six-sided die, the probability of rolling a particular side is 1 in 6 or 1/6.
Rolling dice manually just to study probability might become a tedious task to do depending on the way it is done. If we roll dice while playing a game or gambling, we may not even notice what we are doing. In “Roll: An Introduction to Probability”, Freda (1998) implements and teaches probability by playing a game that seems to look fair and provides the same chances of winning for both participants but is decidedly unfair. He says, “Initially, students think that the game is fair…because the only possible difference of the two dice is 0, 1, 2, 3, 4 and 5 and half of the six possible outcomes are given to each student.” In the article, students notice the game is unfair by calculating the positive difference to obtain zero, one and two from any combination from 1 to 6.
In this experiment, a pair of six-sided dice were rolled 100 times in two different ways. First, a Python program was used which displayed the results automatically when the user clicks a button. Second, five human rollers who rolled dice 20 times to complete 100 manually rolls. The study is done to record and report the results of the combinations and their frequencies along with the comparison of the two methods and how they might differ. One of the differences in the two methods is that rolling dice from a computer program is much easier than to do it, especially when we have to roll many times. Here is shown how the following differ: the most common pair of numbers, the most frequent sum, and the most frequent single number. In a six-sided die, the probability is 1/6 so, the probability when rolling two dice is 1/36 combinations.
Another difference is that using a computer program might not affect the result of the roll since we simply use a random function from 1 to 6 but when rolling manually things like the type of surface used to roll the dice may affect the results. Imagine rolling dice on the grass, they might never roll. The five human rollers used a regular surface, a table, where dice can roll normally. Human dice rolling and computer-simulated dice rolling yields to have certain differences that may affect the results.
II. MATERIALS AND METHODS
- Computer
- Human rollers
- Five pairs of dice
- Tables
- Paper/pen
Dice were rolled in two different ways. The first used a Python program shown in Fig.1. written by Uma Iyer, a computer science professor from Bronx Community College and edited by Yasiris Ortiz, a computer science student. The second way used five human rollers between ages 8 and 11 from an elementary school. In the first method, the python program contains the Graphics library to draw objects visually. Two classes created for the program were DieView, a widget to display a graphical representation of a standard six-sided die, and Button, a labeled rectangle in a window that activates and deactivates the methods to click and to quit the program. The figure below shows the code for the program roller.py and the graphic interface which is where the view of the dice is displayed.
Fig.1. Python program to roll dice (Roller.py)
Fig.2. Graphic user interface where users can directly interact Fig.3. Combinations showed in the Python Shell
During the second method, each of the participants rolls the dice 20 times and keep track of the time and trails’ results. The task was divided into five students since rolling dice 100 times for one person is too time-consuming and tedious. Rolling dice may have different results depending on the surface dice are rolled. For instance, a pair of dice on the grass might not even roll or on the floor, dice might roll too much. The activity was done to decide to do it on a table where dice can roll normally.
Fig .4. Participants rolling dice and recording data
Another reason why each participant rolled only 20 times was to keep them engaged on the activity from the beginning until the end. Fig.3. shows participants rolling the dice and recording data and time of the task. The average in time of rolling dice 20 times was 1:35 min/sec.
III. RESULTS
Results from the Python program shown in Table.1. with 10 rows and 10 columns displaying the output from each trail. It took me 56 seconds to finish using this method. The most frequent pair of numbers were (1/3, 3/1) with an orange circle and the least was (1/1) with the green circle. The most frequent sum were the combinations equaling 6 (3/3, 4/2, 5/1). To see more of the results, go to Table 1 and Table 2.
When rolling the dice manually the most frequent pair of numbers were (5/4, 4/5) Fig.5. It was displayed 8/100 times. The most frequent sum were the combinations equaling 7 (5/2, 4/3, 6/1) and the sum appeared 16/100. More of the results are explained in Table.2
Table 1. Results from Python program.
Fig.5. Results from rolling dice manually
Comparisons were made after getting both results by showing the following table.
Method | Most frequent number | Most frequent pair
|
Most frequent sum |
Computer | 3 43/100 | (3/1, 1/3) 10/100 | 6 20/100 |
Human | 5 46/100 | (5/4, 4/5) 8/100 | 7 16/100 |
IV. ANALYSIS
The results supported my hypothesis by showing differences when rolling from the computer and manually. In our results, for the most frequent sum the number seven was expected for both cases since this number has 6 possible chances of being returned; however, the computer returned 6 has the most common sum. Something that was not expected got the number one so many times running the program from the computer. One was displayed 35/100 versus 20/100 by rolling dice manually. So, rolling dice on a computer program tends to return more ones than doing it manually. Something that might affect the results is the rolling techniques of the participants and as mention before the surface where dice are rolled.
V. CONCLUSION
There are several dynamic interactive simulations for learning the ideas and techniques of probability. Rolling a six-sided is one of them. In this study, a pair of dice is rolled 100 times in two different ways, a Python program and five human rollers. The result of both methods is compared by getting the most and least frequent pair of numbers, and the most frequent sum. It was not anticipated to see a difference in the results from the computer and human rollers.
REFERENCES
Freda, A. (1998). Roll the Dice–an Introduction to Probability. Mathematics Teaching in the Middle School, 4(2), 85. Retrieved from https://search-ebscohost-com.ccny-proxy1.libr.ccny.cuny.edu/login.aspx?direct=true&db=a9h&AN=1209554&site=ehost-live
probability. (n.d.) American Heritage® Dictionary of the English Language, Fifth Edition. (2011). Retrieved October 23 2019 from https://www.thefreedictionary.com/probability