Lecture: 12-14-2012

posted Dec 14, 2012, 6:26 AM by Samuel Konstantinovich   [ updated Dec 14, 2012, 6:26 AM ]

Goal: Understanding the sequence that multiple agents run commands.


HW: Project proposals!

-Decide who you want to partner up with. You should partner up with someone that would ant to do the same kind of project as you. Most people make a game, but some make very nice simulations or animations.

-Your project goal is to make something that can keep someones attention for at least 5 minutes. Your must write a proposal. It must be typed with your names and brought in by Wednesday. It must include:

1. Basic description of what you want to make.

2. How you want the user to interact with it.

3. Minimum feature you want to implement.

4. How you want to break up the work for two people.

5. Ways to expand it if you reach your goals.


-We will learn many more things before you work on that project.

-Proposals can/should be modified when you have better ideas.

-Animations are the most difficult.

-Simulations can model anything you want. You must define the behavior before you make the model.


When you ask patches [command], all patches execute the entire command block one patch at a time.


The patches do this in a random order, so patch 0 0 may go first, then after 0 0 runs ALL the commands, patch 5 4 may go next, then when 5 4 finishes ALL of the commands, patch 3 3 may go next.


This repeats until all of the patches have had a turn. Keep this behavior in mind when discussing the next sequence.



Here is a new Command : myself

myself refers to the agent that is doing the asking.

when a turtle issues a command:
ask patch 0 0 [ set pcolor [color] of myself]

myself is the turtle, so the patch looks at the color of that turtle, and uses that


;lets say a single patch wants to make some turtles change color like this:

ask turtles [ set color [pcolor] of myself ]

or, the turtles would look

at the pcolor on the ground.


Lets look at a netlogo model that

;Make 0 0 a dark reddish color

to setup

ca

ask patch 0 0

[ set pcolor 11 ]

end


;What would happen if you ran this command? Sketch the results.

to go

ask patches with [pcolor != black]

[

ask neighbors with [pcolor = black]

[

set pcolor [pcolor] of myself + .5 ;a little brighter than myself

;myself is the command that refers to the

;agent doing the asking, if a turtle asks a patch,

;the myself refers to that specific turtle

]

]


;what would happen if you ran this command? Sketch the results.

to go

ask patches

[

if pcolor != black

[

ask neighbors with [pcolor = black]

[

set pcolor [pcolor] of myself + .5 ;a little brighter than myself

]

]

]

end



Comments