NetLogo banner
 Home Page
 Download
 Models
 Community Models
 Extensions
 User Manual:
  Web version
  Printable version
 FAQ
 Resources
 Contact Us

NetLogo Models Library:
Sample Models/Mathematics/Probability/ProbLab/Unverified

Note: This model is unverified. It has not yet been tested and polished as thoroughly as our other models.

(back to the library)

Dice

[screen shot] Run Dice in your browser
uses NetLogo 4.0.3
requires Java 1.4.1+
(system requirements)

Note: If you download the NetLogo application, every model in the Models Library (besides the Community Models) is included. If you have trouble running this model in your browser, you may wish to download the application instead.

WHAT IS IT?

"Dice" is a virtual laboratory for learning about probability through conducting and analyzing experiments. You use two dice in the view to perform the experiments. You set up an experiment by choosing a combination consisting of a face for each die, for instance 3 and 4 (we will use this example throughout). Then you "roll" these dice repeatedly and study how often the dice match your chosen combination.

The dice can match your initial combination in several different ways: they can show the same numbers in the same order; they can show the same numbers regardless of order; or the sum of both dice can match. The model collects statistics on all of these kinds of matches. It also keeps track of how often you get each of the 11 possible dice sums. The different plots and monitors in the model give you different perspectives on the accumulated data.

This model is a part of the ProbLab curriculum. The ProbLab curriculum is currently under development at the CCL. For more information about the ProbLab Curriculum please refer to http://ccl.northwestern.edu/curriculum/ProbLab/.

PEDAGOGICAL NOTE

This model introduces tools, concepts, representations, and vocabulary for describing random events. Among the concepts introduced are "sampling" and "distribution".

The various ProbLab models use virtual computer-based "objects" to teach probability. In this model, the computer-based objects are "virtual" dice, modeled on the familiar physical ones. By using familiar objects, we hope to help learners form a "bridge" from their everyday experience to more abstract concepts. Other ProbLab models use virtual "objects" that are less familiar. Using dice first helps prepare students for that.

Facilitators are encouraged to introduce this model as an enhancement of experiments with real dice. The model has several advantages over real dice. Virtual dice roll faster, and the computer can record the results instantly and accurately from multiple perspectives simultaneously.

The model attempts to involve the learner by allowing them to choose a combination before running the experiment.

HOW TO USE IT

Press SETUP, then press PICK DICE. By clicking on the green squares, you set a pair, for instance [3; 4]. Press SEARCH to begin the experiment, in which the computer generates random dice faces. If you set the SINGLE-SUCCESS? switch to 'On,' the experiment will stop the moment the combination you had created is discovered. If this switch is set to 'Off,' the experiment will keep running as many times as you have set the values of the SAMPLE-SIZE and TOTAL-SAMPLES sliders. In the plot window, one or two histograms start stacking up, showing how many times the model has discovered your pair in its original order ("Combinations") and how many times it has discovered you pair in any order ("Permutation"). Are there always more permutations than combinations?

Buttons:
SETUP -- begins new experiment
PICK DICE -- allows you to use the mouse to click on squares so as to pick dice for. Clicking repeatedly on the same square loops the die-faces / colors through an option cycle that has as many options as the value you set for the HOW-MANY-CHOICES slider. For instance, if the slider is set to '3' and you are working with colors, clicking repeatedly on a single square will give the colors green, blue, pink, green, blue, pink, green, etc.
HIDE/REVEAL -- toggles between hiding and revealing the dice you picked. This function is useful when you pose a riddle to a friend and you do not want them to know what dice you chose.
SEARCH - activates the random search. The program generates random dice-faces and matches the outcome against the combination you had created.

Switches:
SINGLE-SUCCESS? -- stops the search after the combination has been matched once.
BARS? -- toggles between two graphing options: "On" is a histogram, and "Off" gives a line graph.

Choices:
Analysis-Type --
- "Permutations" - That is, order does not matter, so '1 2 3' is considered the same as its permutation '3 2 1' (it is registered as a favored event)
- "Combination" - That is, order matters, so '1 2 3' is not accepted as the same as its permutation '3 2 1' (it is not registered as a favored event)
- "Both" - That is, the experiment will analyze outcomes from both the "Permutations" and "Combination" perspectives, and each will be represented in the plot.

Sliders:
SAMPLE-SIZE -- the number of dice rolls in a sample
TOTAL-SAMPLES -- the number of sample you are taking all in all in an experiment.

Monitors:
#SAMPLES -- shows how many samples have been taken up to this point in this experiment
+ OUTCOMES -- shows how many single outcomes have occurred within the current sample.
COMBINATION -- shows how many successes (hit guesses) the program has performed in this sample according to the conditions that order matters
PERMUTATIONS -- shows how many successes (hit guesses) the program has performed in this sample according to the conditions that order does not matter
MEAN-COMBINATIONS -- the sample mean of favored events according to the 'combination' interpretation, by which a favored event is only the exact combination you created.
MEAN-PERMUTATIONS -- the sample mean of favored events according to the 'permutations' interpretation, by which a favored event is either the exact combination you created or its reverse
COMBI : PERMIS -- shows the ratio between the mean values of the sample outcome distributions corresponding to the conditions 'combination' and 'permutation,' respectively. This monitor updates each time a sample has been completed.

Plots:
SUCCESSES-PER-SAMPLE DISTRIBUTION -- displays the count of the number of favored events (successes) per sample over all samples you have taken. For instance, if on the first five samples you have taken, the combination was matched 3 times, 2 times, 4 times, 7 times, and 4 times, then the "Combinations" histogram will be the same height over 2, 3, and 7, but it will be twice as higher over the 4, because 4 occurred twice.

THINGS TO NOTICE

As the experiment runs, the distributions of outcomes in the plots gradually take on a bell-shaped curve.

As the search procedure is running, look at the monitor #STEPS IN THIS SAMPLES. See how it is updating much faster than the monitor to its left, #SAMPLES. The number in #SAMPLES increases by 1 each time #STEPS IN THIS SAMPLES reaches the number that is set in the slider SAMPLE SIZE.

As the search procedure is running, watch the monitors COMBINATION and PERMUTATIONS. Note whether or not they are updating their values at the same pace. For most combinations that you set, PERMUTATIONS updates much faster. This is because PERMUTATIONS registers a success each time the model hits on the set of colors / dice-faces you selected even if they appear in a different order form what you had selected.

As the search procedure is running, watch the monitor COMBI : PERMI ratio. At first, it changes rapidly, and then it changes less and less. Eventually, it seems to stabilize on some value. Why is this so?

Unless the red histogram ('Permutations') covers the black histogram ('Combination') entirely, you will see that the 'Permutations' histogram always becomes both wider and shorter than the 'combinations' histogram. Also, the 'Permutations' histogram (red) typically stretches over a greater range of values as compared to the 'combination' histogram (black). We say of the wider histogram that it has a greater 'variance' as compared to the narrower histogram. Try to explain why the Permutations distribution has greater variance than the Combinations distribution.

Also, you may notice that the 'permutations' and 'combinations' histograms cover the same area. That is because the total area of each histogram, irrespective of their location along the horizontal axis and irrespective of their shape, indicates the number of samples they represent. We know that the two histograms represent the same number of samples. Therefore, they have the same area.

THINGS TO TRY

Run an experiment with a sample size of 20 and then run it with the same settings but with a sample size of 100 or more. In each case, look at the distribution of the SUCCESSES-PER-SAMPLE DISTRIBUTIONN. See how the experiment with the small sample resulted in half-a-bell curve, whereas the experiment with the larger sample results in a whole-bell curve. Why is this so?

Pressing HIDE/REVEAL after you create a combination allows you to setup an experiment for a friend to run. Your friend will not know what the combination is and will have to analyze the graphs and monitors to make an informed guess. You may find that some combinations are harder to guess than others. Why is this so? For instance, compare the case of the combination [1; 1] and [3; 4]. Is there any good way to figure out if we are dealing with a double or not? This question is also related to the following thing to try.

For certain dice you pick, if you run the search under the "Both" option of the ANALYSIS-TYPE choice, you will see only a single histogram in the SUCCESSES-PER-SAMPLE DISTRIBUTION plot. Try to pick dice that produce a single histogram, then try to find others. What do these dice pairs have in common? Why do you think you observe only a single histogram? Where is the other histogram? How do the monitors behave when you have a single histogram?

When the Combination and Permutations histograms do not overlap, we can speak of the distance between their means along the x-axis. Which element in the model can affect this distance between them? For instance, what should you do in order to get a bigger distance between these histograms? What makes for narrow histograms? Are they really narrower, or is it just because the maximum x-axis value is greater and so the histograms are "crowded?"

Set the SAMPLE-SIZE at 360 and TOTAL-SAMPLES at its maximum value. Pick the dice [3; 4], and run the experiment. You will get a mean of about 10 for the Combination condition (in which order matters, so only [3; 4] is considered a favored event), and you will get a mean of about 20 for the Permutations condition (where the order does not matter, so both [3; 4] and [4; 3] are considered favored events). Why 10 and 20? There are 6*6=36 different dice pairs when we care for the order: [1; 1] [1; 2] [1; 3] [1; 4] [1; 5] ... [6; 4] [6; 5] [6; 6]. So samples of 36 rolls have on average a single occurrence of [3; 4] and a single occurrence of [4; 3]. Thus, samples of 360 have 10 times that: 10 occurrences of [3; 4] and 10 of [4; 3], on average.

EXTENDING THE MODEL

A challenge: Add a 7th die face. Then you can run experiments with 7-sided dice!

Add a plot of the ratio between Combinations and Permutations.

Is the program searching for the dice you picked in the most efficient way? Think of more efficient search procedures and implement them in this model.

It should be interesting to track how long it takes the model from one success to another. Add code, monitors, and a plot to do so.

Following is an extension idea for applying this model towards thinking about search algorithms. Currently, the program guesses combinations randomly. This could be improved upon so that the program finds the combination in less guesses. For instance, the moment one of the squares has the correct die face, the program would continue guessing only the other die. Another idea might be to create a systematic search procedure.

RELATED MODELS

The ProbLab model Random Combinations and Permutations builds on Dice. There, you can work with more than just 2 dice at a time. Also, you can work with colors instead of dice faces.

NETLOGO FEATURES

An interesting feature of "Dice," that does not appear in many other models, is the procedure for selecting a die's face value. To you, it is obvious that three dots means "3," but the program doesn't "know" this unless you "tell" it. Each time you click on a die, Look in the Shapes Editor that is in the Tools dropdown menu. You will find six die shapes: 1, 2, 3, 4, 5, and 6. The names of these shapes form a list: ["one" "two" "three" "four" "five" "six"]. Each time you click on a die, a procedure maps between each name and the numerical value corresponding to it.

CREDITS AND REFERENCES

This model is a part of the ProbLab curriculum. The ProbLab Curriculum is currently under development at Northwestern's Center for Connected Learning and Computer-Based Modeling. . For more information about the ProbLab Curriculum please refer to http://ccl.northwestern.edu/curriculum/ProbLab/.

To refer to this model in academic publications, please use: Abrahamson, D. and Wilensky, U. (2004). NetLogo Dice model. http://ccl.northwestern.edu/netlogo/models/Dice. Center for Connected Learning and Computer-Based Modeling, Northwestern University, Evanston, IL.

In other publications, please use: Copyright 2004 Uri Wilensky. All rights reserved. See http://ccl.northwestern.edu/netlogo/models/Dice for terms of use.

(back to the NetLogo Models Library)