2015-12-23 Breeds in-cone in-radius

posted Dec 23, 2015, 4:45 AM by Samuel Konstantinovich   [ updated Dec 23, 2015, 6:52 AM ]
IF YOU DID NOT SUBMIT YOUR LABS ON HW SERVER YOU MUST DO SO!
1,2,4,5,7,8 were due already, 9 is due Tuesday after break (7am)

Take this code and see how it works:

breed [mice mouse]
breed [frogs frog]
turtles-own [ t ]
frogs-own [ f ]
mice-own [ m ]

to setup
  clear-all
  create-mice 5
  ask mice [ 
    set color white
    setxy random-xcor random-ycor
  ]
  create-frogs 5
  ask frogs [ 
    set color green 
    setxy random-xcor random-ycor
  ]
end

to go
  every .05
  [ 
    ask mice [ 
      fd .1 
      rt random 10 
      lt random 10
    ]
    ask frogs [
      if random 10 = 1
      [
        fd 1
        rt random 20
        lt random 20 
      ]
    ]
  ]
end

On the computer:
Look at how this code works.
View the property sheet of a frog and a mouse, what is different?
On Paper:
Name 3 things about breeds that you think would be usefukl



AGENTSET in-radius R   
    will give you all agents of the AGENTSET, that are R units around the asking agent. Make each mouse paint all patches red in a 3 unit radius around them as they move. 


AGENTSET in-cone R ANGLE  
    will give you all agents of the AGENTSET, that are R units ahead of the asking agent in an ANGLE wide cone. Make each frog paint some patches blue, the patches ahead of them in a 4 unit cone, that is 30 degrees wide them as they move. Do this even if the frog does not move. (This will stop the cone flicker)

---NOW!---
-Stop the trails: You should have all patches paint black in the start of your go, otherwise the whole world will turn colors in the next part.

-You should change your world size, and make the patches smaller. Then increase the radius of your cone/circle.

-You should use ticks to stop the flickering of individual patches
Comments