try

try preview image

1 collaborator

Z_ch z ch (Author)

Tags

(This model has yet to be categorized with any tags)
Visible to everyone | Changeable by everyone
Model was written in NetLogo 6.2.0 • Viewed 33 times • Downloaded 3 times • Run 0 times
Download the 'try' modelDownload this modelEmbed this model

Do you have questions or comments about this model? Ask them here! (You'll first need to log in.)


Comments and Questions

Please start the discussion about this model! (You'll first need to log in.)

Click to Run Model

breed [trackers tracker]
breed [people person]
patches-own [
  road
  density
]
globals[
  tx
  ty
]

to startup
  ;; read the elevations from an external file
  ;; note that the file is formatted as a list
  ;; so we only have to read once into a local variable.
  file-open "try.txt"
  let patch-roads file-read
  file-close

  ;; transfer the data from the file into the sorted patches
  (foreach sort patches patch-roads [ [the-patch the-road] ->
    ask the-patch [ set road the-road ]
  ])
  set-default-shape turtles "circle"
  setup
end 

to setup
  clear-drawing
  clear-turtles
  create-trackers 1 [ setxy -71 96       ;;lxxx
                    set color green
                    set size 4]  ;;lxxx

  create-people 1 [ setxy -21 -25       ;;lxxx
                    set color red
                    set size 4]  ;;lxxx
  ask patches with [ road = 1] [set pcolor white
  ;;set people count turtles in-radius 30
    ;;set dist distance turtle 0

  ]

  reset-ticks
end 

to goonce
  ask patches[
   set density count people in-radius 5
   ;;set pcolor density
  ]
   ask trackers[
    let target max-one-of patches in-radius 10 [density]
    face target
    if any? people-here [  ;; if there are sheep here then eat one
      ask one-of people-here
         [die]
     ]
    fd 1
  ]
end 

to go
  ask patches with [pcolor =  white]
  [ set density count people in-radius 5]

     ask trackers[
    let target max-one-of patches in-radius 10 [density]
    face target
    if any? people-here [  ;; if there are sheep here then eat one
      ask one-of people-here
         [die]
     ]
    fd 1
  ]




 ; ask turtle 0 [
   ;; move-to one-of neighbors4 with [pcolor = white]
    ;;ask turtles [ show max-one-of turtles [distance myself] ]
   ;; let p max-one-of neighbors [patch-variable]
    ;;if [patch-variable] of p > patch-variable [
    ;;face p
;;move-to p
;;]
    ;; uphill patch-variable uphill4 patch-variable
 ;   move-to one-of neighbors4  with [pcolor = white]

 ; ]
end 

There is only one version of this model, created 3 months ago by z ch.

Attached files

File Type Description Last updated
try.png preview Preview for 'try' 3 months ago, by z ch Download

This model does not have any ancestors.

This model does not have any descendants.