Courses‎ > ‎Intro to CS - Full Year‎ > ‎Fall‎ > ‎Dyrland-Weaver‎ > ‎Work‎ > ‎

Work 16: 11/26

posted Nov 26, 2019, 11:06 AM by JonAlf Dyrland-Weaver
  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 a 2x2 square of patches located near the center in the "on" state.
  4. Create a go procedure that does the following:
    1. Have every patch 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 it will do one of the following:
      1. If a patch is "off" and the number of "on" neighbors is  in the range [2,4], the patch should turn "on".
      2. If a patch is "on", it should turn "off"
      • These two options should not happen 
Thismodel works best by changed the world size. The example provided is 101x101 with a patch size of 5.

submit this as tapestry
Comments