NetLogo banner

NetLogo Publications
Contact Us

Modeling Commons

Beginners Interactive NetLogo Dictionary (BIND)
NetLogo Dictionary

User Manuals:
Farsi / Persian


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)

Shuffle Board

[screen shot]

If you download the NetLogo application, this model is included. You can also Try running it in NetLogo Web


Shuffle Board investigates distributions of favored events in a series of outcomes. The basic analogy is that there are a lot of candy boxes, but only some have prizes in them. You are buying one candy box after another, waiting for prizes, and keeping track of two things: how many boxes do you need to buy until you get a prize? When you had lucky streaks, how long were they?

A possibly counter-intuitive result in this simulation is that the shorter the "waiting time," the more frequently it occurs. Another result is that the shorter the "lucky streak," the more frequently it occurs.

Shuffle Board explores the relation between the length of the "waiting time" and its frequency, and between the length of a lucky streak and its frequency. This exploration is designed to help learners understand the mathematical functions associated with these distributions.

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


The basic analogy underlying Shuffle Board is that there are a lot of candy boxes, but only some of them have prizes in them (like a blue teddy bear). You know how long it should take you, on average, to get a prize, because this information is announced by the candy manufacturer. You are buying one candy box after another and keeping track of two things: - How many boxes did you need to buy since last prize until you got the next prize? - When you had lucky streaks, how long were they?

Both are plotted automatically in the "Frequency of Distances to Prizes" and "Frequency of Streaks by Length" graphs.

The view features yellow lines that are broken by blue dots (candy boxes without prizes) and colored squares (candy boxes with prizes). Each blue dot or colored square is an "outcome". So think of a very long string with 121 outcomes that has been chopped up into 11 shorter strings, each with 11 outcomes, so as to fit into the View. The string runs from the top left spot on the board (the first outcome) towards the right. When it gets to the end of the top row, it skips to the left-most spot on the second row from top, and so on. When it gets to the bottom-right corner, it counts on to the top left corner, as though the string is closed in a necklace.

When you first open the model and whenever you press Setup, prizes are distributed uniformly across the View according to the settings of the slider 'average-distance'. For instance, if this slider is set to '5', then literally every 5th outcome will be a prize. Next, the prizes shuffle randomly to new locations on the board, so this initial uniform distribution is upset.

Why do we shuffle? We are exploring for hidden distribution patterns. Sometimes it takes a lot of data to find hidden patterns. If we had space in the view for thousands of boxes, we would have enough data to find any patterns that might be there. But there is not enough room in the view to make the boxes big enough so you can see the prizes. So, instead, we shuffle. It is as though each time we get another bit out of a larger population -- it is as though each shuffle gives us a new sample. After each shuffle, you can track individual prizes as they move from one location to another.

Note that the string of outcomes is forms a loop. So if at the tail end of the string -- towards the bottom-right corner -- there are 4 boxes without prizes, these will count towards the first prize in the top row.


Sliders: AVERAGE-DISTANCE -- If set at, say, 5, then every 5th square will bear a prize, when you press Setup. TRUNCATE-AFTER-COLUMN -- determines how many of the "Distances to Prizes" histogram columns, beginning from left, will be included in the calculation of the mean ratio between consecutive columns. For instance, if this slider is set at "4", then the program will calculate the quotients of Column 2 divided by Column 1, Column 3 divided by Column 2, and Column 4 divided by Column 3. Next, the program will determine the mean of these three quotients and report them in the "Columns-Factor" monitor.

Switches: PRIZE-SHAPES? -- if set to 'On', you will see what prize is waiting for you in each candy box. When set to 'Off', you will know that there is a prize in the box, but you will not know what it is. LABELS? -- if set to 'On', each prize box will show how many boxes had to be bought since the previous box so as to get this prize.

Buttons: SETUP -- initializes variables, creates a collection of prizes in accordance with the value of 'average-distance', and represents the distances to prizes and the lucky streaks in their respective plots. GO ONCE -- Runs the program through a single 'Go' procedure, in which prizes are shuffled and their distances and streaks are calculated and plotted. GO -- Runs the program over and over.

Monitors: Columns Factor -- the height of each column in the histogram is divided by the height of the column immediately to its left. The monitor shows the mean of all these quotients. The total number of columns included in this calculation is determined by the slider 'truncate-after-column'.

Plots: FREQUENCY OF DISTANCES TO PRIZES -- shows the accumulating distribution of distances between prizes in repeated samples. FREQUENCY OF STREAKS BY LENGTH -- shows the accumulating distribution of streaks of consecutive successes Note that after you press Setup, when you first click on 'Go' or 'Go Once', the plots initialize, but later they accumulate information from previous runs.

Set the 'average-distance' slider and press 'Setup'. Now press 'Go Once' and watch the histograms appear in the plots. If you press 'Go', the program will run indefinitely, until you press 'Go' again.


When you press 'Go Once' the prizes rearrange on the board. Choose your favorite prize and track it. This way, you'll be sure that no prizes vanish!

After a single shuffle, what is the most common distance between every two consecutive prizes? You can see this in the View -- the number labels show these distances, and so you can count up how many "1"s you see, and how many "2"s, "3"s, etc. Also, look at the plot to see which bar is the highest. Keep looking at the plot over more runs. See the typical graph shape that forms.

As the program runs over and over, the value in the Column Factor monitor gradually converges.


When you press Setup, you get a uniform distribution of prizes. After you shuffle the prizes, the distribution is not uniform. But what is the average distance between prizes now? In the Command Center, type

show precision mean target-color-differences-list 2

Now press Enter. This code calculates for you the mean distance between each two consecutive white patches. Can you explain the value you received?

Watch the value in the 'Column Factor' monitor. Can you find a relation between these relative heights and the 'average-distance' setting?

Play with the 'truncate-columns' slider. What does including more columns do as compared to including fewer columns? What, if any, is the relation of these actions to the value in the 'Columns Factor' monitor?

What is the relation between the value of average-distance and the curves you get in the plot 'Frequency of Streaks by Length'? Does this make sense to you?

Here is an experiment you can try without NetLogo that might shed more light on the model: Set up a deck of cards that has 13 face cards and 39 number cards. That is a 1:3 ratio of faces to numbers. One fourth of the cards are faces. Thus, the probability that any random card drawn from this deck is a face is 1 out of 4 -- that is, a 25% chance. Now distribute the face cards uniformly in the deck so that literally every fourth card is a face. Next, shuffle the cards thoroughly. Still, every fourth card on average will be a face. But what is hiding behind this sense of "average" in "every fourth card on average is a face"? Count up to each face card and create a histogram of the frequencies of each number of attempts until success. What have you learned? Can you explain this? Note that two decks put together with the same "number:face" ratio (for a total of 26:78) will bring quicker results.

Shuffle Board is a NetLogo analogy to shuffling a deck of cards and then going through the cards one by one and counting how long it takes to find each face. To be precise, the shuffling procedure in this model is less rule governed than standard shuffling of cards (see for example [


Add a plot to show how the Columns Factor value changes over time.

Add pens to the plots to represent the averages of the outcomes.

Add a switch that flips the orientation of the shuffle board so that distances to prizes are counted vertically instead of horizontally.

Choose a specific location on the View (one of the "patches") and monitor how often that location gets a prize over repeated shuffles. Design an experiment to determine any possible relationships between the frequency of getting a prize in that location and the setting of the 'average-distance' slider.


The model is closely related to Prob Graphs Basic, and especially to the middle graph in that model. That middle graph looks at distances or 'attempt-until-success' ("waiting time") between consecutive "hits" that are determined randomly according to a sample-space setting. Shuffle Board shows the same idea, but it does so using a more visible analogy that allows you to scan for yourself the distances between all of the favored events. This helps us understand that the shorter distances are more ubiquitous as compared to the longer distances. In particular, we see that the distance "1" is relatively dominant.


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

Thanks to Ethan Bakshy for his extensive work on this model.


If you mention this model or the NetLogo software in a publication, we ask that you include the citations below.

For the model itself:

Please cite the NetLogo software as:


Copyright 2004 Uri Wilensky.


This work is licensed under the Creative Commons Attribution-NonCommercial-ShareAlike 3.0 License. To view a copy of this license, visit 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

This model was created as part of the projects: PARTICIPATORY SIMULATIONS: NETWORK-BASED DESIGN FOR SYSTEMS LEARNING IN CLASSROOMS and/or INTEGRATED SIMULATION AND MODELING ENVIRONMENT. The project gratefully acknowledges the support of the National Science Foundation (REPP & ROLE programs) -- grant numbers REC #9814682 and REC-0126227.

(back to the NetLogo Models Library)