Dice Stalagmite

Dice Stalagmite preview image

3 collaborators

Uri_dolphin3 Uri Wilensky (Author)
Josh3 Josh Unterman (Author)
Dor Abrahamson (Author)

Tags

mathematics 

Tagged by Reuven M. Lerner about 9 years ago

Model group CCL | Visible to everyone | Changeable by group members (CCL)
Model was written in NetLogo 5.0.4 • Viewed 345 times • Downloaded 30 times • Run 1 time
Download the 'Dice Stalagmite' modelDownload this modelEmbed this model

Do you have questions or comments about this model? Ask them here! (You'll first need to log in.)


WHAT IS IT?

Dice Stalagmite is a model for thinking about the relations between independent and dependent random events. Pairs of dice are rolled, then the dice fall into columns in two bar charts. One of these charts records the dice as two independent outcomes, and the other, as a single compound event (sum) of these two outcomes. Because the columns grow from the bottom up, we call this a "stalagmite."

Different distributions emerge: the independent-event bar chart is flat (equally distributed) whereas the dependent-event bar chart is peaked. (It does not quite approach a normal distribution, because there are only two compound outcomes.)

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/.

HOW IT WORKS

The outcomes from rolling the two dice are represented in two different ways.

On the left, they are plotted as individual events. This representation treats the dice individually, not as pairs. Each die is stacked in its respective column, one through six, in the resulting histogram.

On the right, you see a second histogram with the same dice stacked in pairs according to their sum. There are eleven columns, 2 through 12, since those are the possible sums of two dice.

When the model is run, the right chart never reaches the top before the left chart. (Why?) The left bar chart is "bumped" down by one row so as to leave more room for the bars to grow. This allows for the bar chart on the right to grow further and take on its typical (peaked) shape.

HOW TO USE IT

Switches:
STOP-AT-TOP? -- if 'On', stops the model when the right side of the display bar chart (the dice totals) has reached the top. If 'Off', then both stacks "bump" down one row when a column hits the top. (The plots on either side of the view are always scaled to show all of the data, even if the view is only showing the top portion.)

Buttons:
SETUP -- prepares the model for running.

GO -- runs the model. In a single run of GO, a random pair of dice appears, is copied, and then the copies fall into their stacks. Also, the plots are updated.

Plots:
SINGLE DICE -- plots the number of occurrences of each die-number (1-6).
PAIR SUMS -- plots the number of occurrences of each die-total (2-12).
The plots show the same information as the view, except that the plots always show all of the data, while if the STOP-AT-TOP? switch is off, the view only shows the tops of the stacks.

PEDAGOGICAL NOTE

As in other ProbLab activities, here we are interested in exploring relations between the anticipated frequency distribution (the relative probabilities), which we determine through combinatorial analysis, and the outcome distribution we receive in computer-based simulations of probability experiments. To facilitate the exploration of the relationship between such theoretical and empirical work, we build tools that bridge between them. These bridging tools have characteristics of both the theoretical and empirical work. Specifically, we structure our combinatorial spaces in formats that resemble outcome distributions, and structure our experiments so as to sustain the raw data (not just graphs representing the data). The "picture bar chart" of the combinatorial space of dice-pair totals can be found with the ProbLab materials.

Beside each bar chart -- the 'dependent' and the 'independent' -- there is a histogram that represents the data correspondingly. Whereas the bar charts stack the outcomes so as to sustain the images of the discrete events (the "raw data" themselves), the histograms grow in continuous columns (without partition lines). Twinning each picture bar chart with its respective histogram may help students both to understand the histograms and to shift from additive interpretation of the columns in the picture bar chart (focusing on differences between heights of columns) to a multiplicative interpretation of the bar chart (focusing on the proportions of the column heights).

In a classroom, students should work with the triangular combinatorial space they created (not the one from the model, but one with all 36 different possible outcomes of a dice pair that are arranged in a bar chart). Discussion should focus on the relation between the theoretical and empirical distribution, that is, between the combinatorial space and the distribution of random outcomes. Why is it that they are similar?

THINGS TO NOTICE

Note the shape of the outcomes in the right-hand bar chart. The top is triangular. What does this mean? Specifically, if each event is random and independent, why are we getting a shape that is not random (always the same shape)? How can randomness and determinism coexist like this? The bar chart on the left hones this discussion, because, from run to run, it is basically a "flat" distribution -- for instance, you can never predict, with certainty, which die column will be first to reach the top.

If the model runs long enough and if STOP-AT-TOP? is set to 'Off,' you will notice that some columns in the picture bar chart on the left vanish. That is, you will see a die descending to the bottom of its column and "going below sea level" so it is no longer visible. What happens is that this die's column is now too short to appear in the display. It might grow tall enough later to come back in, or it might not. Meanwhile, the histogram in the plot keeps all of its columns, so you can keep comparing between them.

THINGS TO TRY

How many pairs are needed until the dice-pair bar chart reaches the top? Is this number constant? How much does it vary?

What is the biggest vertical gap between columns in the single-die bar chart? Does the gap get larger or smaller the more you run the model? Does any particular column win more often than others?

Which column in the dice-pair bar chart gets to the top first most often?

EXTENDING THE MODEL

Currently, the model sums two dice. An interesting idea would be to extend this model to have a sum of three or more dice. There would be more columns for the different dice-totals. How many? How would this change affect the dice-total distribution?

Currently the model puts all pairs of dice that sum to the same number in the same column. What would happen if you added additional columns so that different combinations were in different columns, for example, so that 2+5 and 5+2 were considered different? Would this change the shape of the dice-total distribution?

NETLOGO FEATURES

In this model, the origin (patch 0,0) is placed between the single and pair bar charts rather than in the center, which makes computations simpler and extending the model easier.

RELATED MODELS

Dice Stalagmite uses the same basic metaphor as the ProbLab model 9-Block Stalagmite. In that model, a random 9-block or 4-block is selected from a sample space. Then, the block finds is correct column, according to the number of green squares in the block, and stacks up in that column.

The idea of juxtaposing two or more different representations of the same running data is used in several ProbLab models, such as Prob Graphs Basic or Random Combinations and Permutations.

Dice are also used in the ProbLab model Dice for generating a distribution of random outcomes.

The Galton Box model also features raw data that descend and stack up in columns.

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/.

Thanks to Josh Unterman for building the original version of this model. Thanks to Steve Gorodetskiy for his contribution to the design of this model.

HOW TO CITE

If you mention this model in a publication, we ask that you include these citations for the model itself and for the NetLogo software:

  • Abrahamson, D. and Wilensky, U. (2005). NetLogo Dice Stalagmite model. http://ccl.northwestern.edu/netlogo/models/DiceStalagmite. Center for Connected Learning and Computer-Based Modeling, Northwestern Institute on Complex Systems, Northwestern University, Evanston, IL.
  • Wilensky, U. (1999). NetLogo. http://ccl.northwestern.edu/netlogo/. Center for Connected Learning and Computer-Based Modeling, Northwestern Institute on Complex Systems, Northwestern University, Evanston, IL.

COPYRIGHT AND LICENSE

Copyright 2005 Uri Wilensky.

CC BY-NC-SA 3.0

This work is licensed under the Creative Commons Attribution-NonCommercial-ShareAlike 3.0 License. To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-sa/3.0/ or send a letter to Creative Commons, 559 Nathan Abbott Way, Stanford, California 94305, USA.

Commercial licenses are also available. To inquire about commercial licenses, please contact Uri Wilensky at uri@northwestern.edu.

Comments and Questions

Click to Run Model

globals [
  generators        ;; agentset of two patches where the dice first appear
  top-row           ;; agentset of just the top row of patches
  single-outcomes   ;; list of single dice values
  pair-outcomes     ;; list of dice pair sums
]

patches-own [
  column            ;; what number (single die or sum of pair) this column of patches is for
]

breed [paired-dice paired-die]   ;; dice considered as part of pairs
breed [single-dice single-die]   ;; dice considered singly
breed [stacked-dice stacked-die] ;; dice that have stopped moving

;; all three breeds have this variable
turtles-own [
  die-value        ;; 1 through 6
]

paired-dice-own [
  pair-sum         ;; 2 through 12
]

to setup
  clear-all
  set single-outcomes []
  set pair-outcomes []
  ;; assign outcomes to columns
  ask patches with [pxcor > 4] [
    set column floor ((pxcor - 1) / 2)
  ]
  ask patches with [pxcor < -4] [
    set column pxcor - min-pxcor  + 1
  ]
  ;; color patches
  ask patches [ set pcolor gray + 3 ]
  ask patches with [column != 0] [
    ifelse column mod 2 = 0
      [ set pcolor gray ]
      [ set pcolor brown - 1 ]
  ]
  ;; set up agentsets
  set top-row patches with [pycor = max-pycor]
  set generators top-row with [pxcor = -1 or pxcor = 0]
  ;; start clock and plot initial state
  reset-ticks
end 

to go
  if stop-at-top? and any? turtles-on top-row [
    user-message "The top has been reached. Turn STOP-AT-TOP? off to keep going."
    stop
  ]
  if not stop-at-top? [
    bump-down stacked-dice with [pxcor < 0]
    bump-down stacked-dice with [pxcor > 0]
  ]
  roll-dice
  while [any? single-dice or any? paired-dice] [
    move-paired-dice
    move-single-dice
    display    ;; force the view to update, so we see the dice move smoothly
  ]
  tick
end 

;; creates a new pair of dice (both singles and pairs)

to roll-dice
  ;; ask each generator patch to create two paired dice
  ask generators [
    sprout-paired-dice 1 [
      set color white
      set die-value 1 + random 6
      set shape word "die " die-value
      set heading 90
    ]
  ]
  ;; clone the paired dice to make the single dice
  ask paired-dice [
    hatch-single-dice 1 [
      set heading 270
      ;; changing breeds resets our shape, so we must explicitly adopt
      ;; our parent's shape
      set shape [shape] of myself
    ]
  ]
  ;; set the sum variable of the pairs
  let total sum [die-value] of paired-dice
  ask paired-dice [ set pair-sum total ]
  ;; add to outcomes lists
  set pair-outcomes lput total pair-outcomes
  ask single-dice [ set single-outcomes lput die-value single-outcomes ]
end 

to move-paired-dice
  ;; if either of the two dice isn't at the right column yet,
  ;; both dice move
  ifelse any? paired-dice with [pair-sum != column]
    [ ask paired-dice [ fd 1 ] ]
    ;; otherwise both dice fall
    [ ask paired-dice [
        ;; if at the bottom of the view, check if we should go "underwater"
        if pycor = min-pycor [ paired-die-check-visible ]
        fall
      ]
    ]
end 

to move-single-dice
  ;; two single dice may be falling in the same column, so we have
  ;; to make sure that the bottom one moves before the top one,
  ;; otherwise they could get confused
  let how-many count single-dice
  if how-many > 0 [
    ask min-one-of single-dice [pycor] [ move-single-die ]
  ]
  if how-many > 1 [
    ask max-one-of single-dice [pycor] [ move-single-die ]
  ]
end 

to move-single-die  ;; single-die procedure
  ifelse die-value != column
    [ fd 1 ]
    [ ;; if at the bottom of the view, check if we should go "underwater"
      if pycor = min-pycor [ single-die-check-visible ]
      fall
    ]
end 

to fall  ;; single-die or paired-die procedure
  set heading 180
  ifelse (pycor > min-pycor) and (not any? stacked-dice-on patch-ahead 1)
    [ fd 1 ]
    ;; stop falling
    [ ;; changing breeds resets our shape, so we have to remember our old shape
      let old-shape shape
      set breed stacked-dice
      set shape old-shape
    ]
end 

;; determines if my column is tall enough to be seen

to single-die-check-visible  ;; single-die procedure
  if single-outcomes = [] [ stop ]
  let mode first modes single-outcomes
  let height-of-tallest-column length filter [? = mode] single-outcomes
  let height-of-my-column length filter [? = die-value] single-outcomes
  if (height-of-tallest-column - height-of-my-column) >= world-height - 2 [ die ]
end 

;; determines if my column is tall enough to be seen

to paired-die-check-visible  ;; paired-die procedure
  if pair-outcomes = [] [ stop ]
  let mode first modes pair-outcomes
  let height-of-tallest-column length filter [? = mode] pair-outcomes
  let height-of-my-column length filter [? = pair-sum] pair-outcomes
  if (height-of-tallest-column - height-of-my-column) >= world-height - 2 [ die ]
end 

to bump-down [candidates]
  while [any? candidates with [pycor = max-pycor - 2]] [
    ask candidates [
      if pycor = min-pycor [ die ]
      fd 1
    ]
  ]
end 


; Copyright 2005 Uri Wilensky.
; See Info tab for full copyright and license.

There are 15 versions of this model.

Uploaded by When Description Download
Uri Wilensky over 9 years ago Updated to NetLogo 5.0.4 Download this version
Uri Wilensky almost 10 years ago Updated version tag Download this version
Uri Wilensky almost 10 years ago Updated to version from NetLogo 5.0.3 distribution Download this version
Uri Wilensky over 10 years ago Updated to NetLogo 5.0 Download this version
Uri Wilensky over 12 years ago Updated from NetLogo 4.1 Download this version
Uri Wilensky over 12 years ago Updated from NetLogo 4.1 Download this version
Uri Wilensky over 12 years ago Updated from NetLogo 4.1 Download this version
Uri Wilensky over 12 years ago Updated from NetLogo 4.1 Download this version
Uri Wilensky over 12 years ago Updated from NetLogo 4.1 Download this version
Uri Wilensky over 12 years ago Updated from NetLogo 4.1 Download this version
Uri Wilensky over 12 years ago Updated from NetLogo 4.1 Download this version
Uri Wilensky over 12 years ago Updated from NetLogo 4.1 Download this version
Uri Wilensky over 12 years ago Model from NetLogo distribution Download this version
Uri Wilensky over 12 years ago Model from NetLogo distribution Download this version
Uri Wilensky over 12 years ago Dice Stalagmite Download this version

Attached files

File Type Description Last updated
Dice Stalagmite.png preview Preview for 'Dice Stalagmite' over 9 years ago, by Uri Wilensky Download

This model does not have any ancestors.

This model does not have any descendants.