Introduction to Complex Systems


Practical Problem 4: Percolation

In this example you will implement a simulation for the process of percolation, see for example the Explorable Barista’s Secret

All we need to do is use patches as agents in netlogo.

To do:

  • write a netlogo program in which all patches can have one of three states: “empty”, “coffee” and “water”

  • make the world 64x64 in size

  • the setup function should initialize all the patches in the following way

    1. patches should either be empty (white) or coffee (brown).

    2. With a probability P they should be empty

    3. A small disk of patches in the middle should all be water (blue). You can filter the patches according to their x and y coordinates. Check the manual for the variables that store these values. You can also use the netlogo function distancexy 0 0 that returns the distance to the origin.

    4. The probability P should be adjustable with a slider

  • define a “paint” function that colors the patches accordingly

  • The go function should carry out the following algorithm

    1. every water patch should turn all the neighboring empty patches into water.

    2. you can have use a construct like this

    ask patches with [state = "water"] [
		ask neighbors with [state = "empty"][
			...
		]
	]

Observations

Using this simulation, try to find the critical concentration of white patches necessary for the water to reach the boundaries of the system.