# 9-Blocks

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

## WHAT IS IT?

9-Blocks accompanies classroom work on the Combinations Tower, the giant bell-shaped histogram of all the 512 different green/blue combinations of the 3-by-3 array. Whereas building the Combinations Tower is a form of theoretical probability --- combinatorial analysis --- the 9-Block model complements with empirical probability of the same 3-by-3 object. In the plot window, a tall histogram grows that has the same shape as the Combinations Tower. How can that be? That is the theme question of this model.

To better see the resemblance between the Combinations Tower and 9-Blocks histogram, you can either open another NetLogo window in the 9-Block Stalagmite model or open a JPEG of the 9-Block Stalagmite model as it looks when the entire sample space has been found. (This JPEG will be available with ProbLab curricular material.) Place this JPEG alongside the 9-Blocks histogram, to its right, editing the .jpg's dimensions as necessary to maximize the resemblance between the histogram and the .jpg.

The 9-Blocks model is a simplified version of the Stochastic Patchwork model. Here, your green/blue combinations are always of size 3 by 3. Also, the probability of a patch being either green or blue is always .5 in this model. Finally, the plot shows the number of green squares and not the percentage of green squares out of all the squares.

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

At every iteration through Go, each patch "flips a coin" to decide whether it should be green or blue. This "coin" works as follows: The patch chooses randomly between "0" and "1." If it got "1," it becomes green on this run, but if it got "0," it becomes blue on this run. At every run through Go, the number of green patches in the block is counted up. This number is added to a list that grows in length from run to run. The entire list is plotted as a histogram at each run. The columns or bars in this histogram represent how many 9-blocks have occurred with 0 green squares, 1 green square, 2 green squares, ..., 8 green squares, and 9 green squares (for a total of 10 possible columns).

Over many runs, the histogram begins to look bell-shaped, just like the Combinations Tower that you may have built in your classroom and just like the tower in the 9-Block Stalagmite model.

## HOW TO USE IT

Buttons:

'Setup; - initializes the variables and erases the plot.

'Go' - activates the procedures just once. So you will get a single 9-block and a short column in the histogram.

'Go' - activates the procedures. It is set to work "forever," that is, it will repeat until you press it again.

Switches:

'one-by-one-choices?' - when On, each square will settle on its color at a different moment. Also, there will be a pause between 9-blocks, as though the lights were switched off for a moment. This is meant to remind us that even though we are looking at 9-blocks, actually each square chooses its color independently of other squares. Notice how the monitor '# target color' updates per each target color that is added.

Monitors:

'# target color' - shows how many patches are green.

'how many trials' - shows how many times the model has chosen random 9-blocks in this experiment (so it's also showing how many items we have in the list that is being plotted every run).

## THINGS TO NOTICE

As you run this model, the histogram grows. Pretty soon, the central columns grow taller than other columns. This shows us that there is a higher chance of getting 9-blocks that have 4 or 5 green squares as compared to 9-blocks that have 3 or 6 green squares. Likewise, there is a higher chance of getting 9-blocks that have 3 or 6 green squares as compared to 9-blocks that have 2 or 7 green squares. Also, there is a higher chance of getting 9-blocks that have 2 or 7 green squares as compared to 9-blocks that have 1 or 8 green squares. Finally, there is a higher chance of getting 9-blocks that have 1 or 8 green squares as compared to 9-blocks that have 0 or 9 green squares.

## THINGS TO TRY

Compare between the histogram you are getting and the Combinations Tower. Why is it that they are the same shape?

How many 9-blocks do you need to sample before the histogram begins to look like the Combinations Tower?

## NETLOGO FEATURES

Look at the histogram as it grows. What happens when it reaches the top? More and more combinations are coming but there is no room to count them. Instead of leaping out of the box, the number at the top-left corner of the plot --- the value of the y-axis --- updates and the histogram is redrawn for a larger scale. This helps us attend to whether and how the shape of the histogram changes after the number of combinations exceeds the range of values on the original histogram.

## EXTENDING THE MODEL

In many ways, the Stochastic Patchwork model extends this model. However, there are other ways of extending this model. For instance, you may want to plot different aspects of the probabilistic experiment, to answer such questions as:

- how often do we get the same combinations twice one after the other?
- are there particular combinations you like? You could add code to see how long it takes the model to find these combinations (as in the Random Combinations and Permutations model).

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

## 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. (2004). NetLogo 9-Blocks model. http://ccl.northwestern.edu/netlogo/models/9-Blocks. 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 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 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.

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.

## Comments and Questions

globals [results] ;; accumulates values from repeated runs; these are histogrammed patches-own [my-color] breed [frames frame] ;; frames are black frames around each patch; they help count the colored patches to setup clear-all set results [] ask patches [ set pcolor white ] setup-frames reset-ticks end to setup-frames ;; each individual patch in the block is framed, creating an overall effect ;; of a grid that helps distinguish individual patches in the block set-default-shape frames "frame" ask patches [ sprout 1 [ set breed frames set color black ] ] end to go ask patches [ set pcolor gray - 2 ] ask patches [ set pcolor one-of [green blue] if one-by-one-choices? [ display wait 0.1 ] ] tick let result count patches with [pcolor = green] set results fput result results histogram results let maxbar modes results let maxrange length ( filter [ ? = item 0 maxbar ] results ) set-plot-y-range 0 max list 100 maxrange if one-by-one-choices? [ wait 0.5 ] end ; Copyright 2004 Uri Wilensky. ; See Info tab for full copyright and license.

There are 15 versions of this model.

## Attached files

File | Type | Description | Last updated | |
---|---|---|---|---|

9-Blocks.png | preview | Preview for '9-Blocks' | about 7 years ago, by Uri Wilensky | Download |

This model does not have any ancestors.

This model does not have any descendants.