every tester

No preview image

1 collaborator

Uri_dolphin3 Uri Wilensky (Author)

Tags

(This model has yet to be categorized with any tags)
Model group CCL | Visible to everyone | Changeable by group members (CCL)
Model was written in NetLogo 4.0alpha3 • Viewed 184 times • Downloaded 40 times • Run 0 times
Download the 'every tester' modelDownload this modelEmbed this model

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


add model documentation here

Comments and Questions

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

Click to Run Model

;also tested wolf-sheep predation, ants, and gas lab (box).  i also tested every in the
;command center and agent monitors, by itself and in a loop of some kind.  as far as i can see
;every works in every type of monitor except for variable monitors, which makes sense. i can't
;think of a case where every should be in a variable monitor.  i think that this covers all of
;the bases.  let me know if there are more tests that you would like to see done.

globals [ trigger ]

to setup
  ca
  cro 2
  if (not first-test-set)
  [
    ask turtles [ set color 5 ]
    if (not second-set)
    [
      set trigger 0
    ]
  ]
end 

to go
  ifelse (first-test-set)
  [
    every 2 [ show "foo" ]
    every 0.55555 [ show "bar" ]
  ]
  [
    ifelse (second-set)
    [
      ask turtles [ type "1" foo ]
      ask turtles [ type "2" foo ]

      show "first set done"

      ask turtles [ type "3" foo type "4" foo ]

      show "second set done"
    ]
    [
      ifelse trigger > 100
      [ every 1 [ ask turtles [ set color color + 1 ] ] ]
      [ every 5 [ ask turtles  [ fd 1 ] ] ]
      ask turtles [ set heading heading + 5 ]
      set trigger trigger + 1
    ]
  ]
  if (wait?)
  [ wait 3 ]
end 

to go2
  ifelse (first-test-set)
  [
    every 1 [ print "one!" ]
    every 2 [ print "two!" ]
;    print "three!"
  ]
  [
    ifelse (second-set)  ; these two should have the same effect
    [
      ifelse trigger > 100
      [ ask turtles [ every 1 [ set color color + 1 ] ] ]
      [ ask turtles [ every 5 [ fd 1 ] ] ]
      ask turtles [ set heading heading + 5 ]
      set trigger trigger + 1
    ]
    [
      ifelse trigger > 100
      [ ask turtles [ set color color + 1 ] ]
      [ ask turtles [ fd 1 ] ]
      ask turtles [ set heading heading + 5 ]
      set trigger trigger + 1
    ]
  ]
  if (wait?)
  [ wait 0.5 ]
end 

to go3
  ifelse (first-test-set)
  [
    ask turtles [ fd 1 ]
    show "a"
    every 2 [ ask turtles with [ who = 1 ] [ show "removed turtle 1" die ] ]
    every 4 [ ask turtles with [ who = 0 ] [ hatch 1 [ set heading 180 ] ] show word "created turtle 1" count turtles ]
  ]
  [
    loop
    [
      if trigger > 3
      [ stop ]
      every 3 [ show (word "every 3: add 1" " " timer) set trigger trigger + 1 ]
      every 7 [ show (word "every 7: minus 2" " " timer) set trigger trigger - 2 ]
      every 1 [ show (word trigger " " timer) ]
    ]
  ]
  if (wait?)
  [ wait 0.5 ]
end 

to turtles-go
  every 2 [ type "2" show who ]
  every 5 [ type "5" show who ]
  if (wait?)
  [ wait 3 ]
end 

to foo
  every 1 [ show who ]
end 

There are 3 versions of this model.

Uploaded by When Description Download
Uri Wilensky over 14 years ago Updated from NetLogo 4.1 Download this version
Uri Wilensky over 14 years ago every tester Download this version
Uri Wilensky over 14 years ago every tester Download this version

Attached files

No files

This model does not have any ancestors.

This model does not have any descendants.