posted Nov 30, 2017, 6:23 AM by Konstantinovich Samuel   [ updated Nov 30, 2017, 6:24 AM ]
Goal: Breeds, in-cone, in-radius

You MUST import the cat shape using the netlogo shapes editor.

Take the sample code and modify it as follows:
Add Sliders:
 cat-vision-radius (1-10)
 dog-vision-radius (1-10)
 dog-vision-angle  (1-360)

Add a switch for:
view-cones?   -Viewing dog cones
view-circles?  -Viewing cat circles
Only display the patch color changes when the switches are ON.

Add behavior to the cats/dogs:
Cats should be pink.
Dogs should be brown.
Standard size of cats and dogs is 4.

Phase 1:
When they are inside of the cat-radius they turn red, otherwise they stay normal color.

Phase 2:
Dogs:  When they see another dog in their field of vision, they increase their own size to 8. (They get brave)
                -when this happens set their cone of vision to red instead of yellow.
           When they see a cat in their field of vision, they decrease their size to 3. (they get scared)
           When they see both a cat and a dog, count both breeds, whichever has more takes priority. 
            In the case of a tie, or when there are no cats or dogs: their size should be reset to defaults.
            e.g.   3 cats, and 2 dogs, the dog will be scared.
                     2 cats and 2 dogs, the dog is normal (size 4).
Cats:  Cats cannot change a larger dog to red. This only works on small dogs. 

Phase 3:
Cats:   When cats see other cats, they get really distracted. They ignore dogs when another cat is in their radius.
           When this happens, they change patches to blue instead of white. 

Sample code:

breed [ dogs dog]
breed [ cats cat]
to setup
  set-default-shape dogs "wolf"
  set-default-shape cats "cat"

  create-dogs 10[set size 4 fd 4]
  create-cats 10[set size 4 fd 4]

to go
  every 1 / 30[
    ask patches[set pcolor black]
    ask cats[
    ask dogs[

to do-cat-stuff
  ask patches in-radius 6 [ set pcolor white]

to do-dog-stuff
  if view-cones?
  [ask patches in-cone 8 60 
    [ set pcolor yellow]

to wiggle
  fd .1
  rt random 10
  lt random 10