2017-11-18

posted Nov 17, 2017, 6:10 AM by Konstantinovich Samuel
ALL Work today is on paper. DO NOT log into the computers.

You should be able to articulate the following: (Write your answers on paper, discuss with neighbors as needed)

1-How do you make an agentset complete a task before any of them start a different task?
    Write the code to turn all patches green, and after that completes, turn all patches blue.
2-How does this concept relate to cellular automata?
3-How do you organize your code in cellular automata so that you do not encounter problems due to changes in properties of an agent?




Goal: Modular design of Conway's game of life.
 
Groups of 3:

Write Conway's game of life on paper. 
-Start with the go procedure. 
-In your go, call other procedure(s) that do whatever you want!  Use names that accurately describe what the procedure does.
-If any procedure that you used does not exist, write the procedure you called next. (If your go calls 2 procedures, write both of them in the same manner)
-label the context of each procedure you write

Artificial restrictions:
    1. You are always permitted to add let statements to create local variables and make your code more readable. The restrictions do not limit this.
    2. Each if/ifelse/ask statement can contain a SINGLE command inside each command block. This can be a call to any procedure either built-in or user created.
    3. The every command is not needed for work on paper, but can be added on the computer to smooth the animation.
    4. Each of your procedures can contain one of the following:    
       -A single ask statement
       -Two ask statements
       -An if/else statement
       -Two if statements

e.g.

to go ;observer context
 ask turtles [ do-turtle-stuff ] ;this is a single procedure inside the []
end

since do-turtle-stuff does not exist, You must write that next.

to do-turtle-stuff  ;turtle context
    ifelse isHappy ;procedure 1 (this could have been a boolean expression too)
    [dance] ;procedure 2
    [wiggle] ;procedure 3
end

Now you must write all new procedures (isHappy/dance/wiggle) before you write the newer procedures that they will call.




Comments