Work 29: 12/04

posted Dec 4, 2018, 6:39 AM by JonAlf Dyrland-Weaver
This program will be similar to Friday's "tapestry" assignment. You will also want to change the size of the world to accommodate more (but smaller) patches.
You can find a working version here: http://homer.stuy.edu/~dw/netlogo/on_off.html
  1. Pick 2 colors you like, call one of those colors "on" and the other "off".
  2. Give patches a property, we will use it later on to keep track of how many neighbors are "on".
  3. Create a setup procedure that:
    1. Clears everything
    2. Sets all patches to the "off" state.
    3. Puts patch 0 0 in the "on" state.
  4. Create a setup_random that:
    1. Clears everyone.
    2. Gives each patch a 7% chance of being in the "on" state, otherwise they should be "off"
  5. Create a go0 procedure that does the following:
    1. Every patch should keep track of the number of neighbors that are "on" in the property declared in step 2.
    2. After every patch has completed step 1:
      1. If a patch is "off" and the number of "on" neighbors is 1 the patch should turn "on".
      2. If a patch is "on", and the number of "on" neighbors is greater than 1, it should turn "off".
        1. This should not include patches that have been turned on just before.
  6. Create a go1 procedure that does the following:
    1. Every patch should keep track of the number of neighbors that are "on" in the property declared in step 2.
    2. After every patch has completed step 1:
      1. If a patch is "off" and the number of "on" neighbors is  in the range [5, 8], the patch should turn "on".
      2. If a patch is "on", and the number of "on" neighbors is not in the range [4, 8], the patch should turn "off"
        1. Like go0, this should not include patches that have just turned "on".
  7. Create a go2 procedure that does the following:
    1. Every patch should keep track of the number of neighbors that are "on" in the property declared in step 2.
    2. After every patch has completed step 1:
      1. If a patch is "off" and the number of "on" neighbors is 3, the patch should turn "on".
      2. If a patch is "on", and the number of "on" neighbors is not 2 or 3, the patch should turn "off"
        1. Like go0, this should not include patches that have just turned "on".
  8. Hopefully you are noticing a pattern to the code you are writing. Create your own version, try out different values of the amount of "on" neighbors that triggers a switch. Maybe even look at values that are not in the same range.
submit this as on_off
Comments