Chips simulation

Quickstart

To directly go to the simulator click here. The code page presents a very quick guide on how to start.

To better understand the simulation, please, check out the following paragraphs.

Guide

When opening the page, you will see the following screen. While the number of sliders may be intimidating, we will break down the different components

Components

There are three main components:

  1. External parameters (model speed)
  2. Simulation parameters
  3. Output visualization

(1) The model speed slider only regulates how quick the simulation is going to run. You may want to play with this slider either if you want to see very slowly what is actually happening (shift the slider to the left) or if you want to explore some long-term behavior (shift it to the right).

(2) The simulation parameters are used to set up which type of simulation you would like to run. Specifically, the sliders have the following meaning:

  • initial-num-chips is the initial number of chips. For example, when set to 500 it will mean that the bag of chips will start with 500 chips.
  • perc-broken is the percentage of chips that will be already broken at the beginning of the simulation. For instance, when set to 30, the simulation will start with 30% of broken chips.
  • minimum-chip-size determines what is the minimum size of a potato chip that will still be counted. This means that potato chips of smaller size may exist in the simulation, but they will not contribute to the counting of chips.
  • only-non-broken is a binary variable for choosing if we want to count only full chips (i.e. non-broken) or if we want to count also the broken ones. When not selected, all chips will be counted, while when selected only full chips will be counted.
  • chosen-dynamics is used to simulate either eating or breaking chips.

Besides these variables, the same box contains also two buttons:

  • Setup is a button which initialize the variables according to the previous parameters. This means that if the slider initial-num-chips has been moved from 500 to 700, nothing will happen until we click setup. In that moment, all the variables will be defined based on the sliders.
  • go this button will start the simulation. If pressed again it will stop it.

The right handside of the page contains the visualizations of the output.

The black square with written “bag” is going to represent the bag of chips. Initially it will be empty, but later, we will see how to populate it. When populated it will be filled with colored circles. Each circle represents a chip. Full circles represent full chips, while the ones with a black center represent the broken chips.

Colors do not have any meaning and the difference of colors has been implemented only to make different chips visible.

The following two panels represent the number of counted chips in time. Meaning that the y-axis represents the number of chips and the x-axis units of time.

The box Chips dynamics (User only) shows the number of chips that can be counted in the bag according to the definitions offered by the parameters minimum-chip-size and only-non-broken.

The second box instead puts this in relation with the measurements of Alice and Bob.

How the code runs

The code is written in netlogo and it can be seen at the bottom of the page, by clicking on “NetLogo Code”

Overall the code runs in the following ways

  • When setup is pressed, all the variables are initialized according to the sliders. The size of each chip is obtained as a uniformly distributed random number in the interval [0,1]
  • If the eating chip dynamics is selected (i.e. chosen-dynamics = eating) at each time step a random chip is selected and removed from the simulation. This is to represent the chips being eaten. When the number of chips reaches 0 the simulation stops
  • If the breaking chip dynamics is selected (i.e. chosen-dynamics = breaking) at each time step a random chip is selected and replaced by two broken chips half the size of the initial one.