Turtles trapped by letters

Turtles trapped by letters preview image

1 collaborator

Default-person Nida Fatima (Author)

Tags

(This model has yet to be categorized with any tags)
Visible to everyone | Changeable by the author
Model was written in NetLogo 6.0.2 • Viewed 79 times • Downloaded 1 time • Run 0 times
Download the 'Turtles trapped by letters' 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 [nidas nida]
nidas-own[ trapped? count-down
 birth-tick
]

to setup
  clear-all
  ask patches
  [set pcolor white]
  create-nidas 24
  [set color green
  set  trapped? false
  setxy random-xcor random-ycor
  set size 10]
  setupname
  reset-ticks
  go
end 

to setupname
 setN
  setI
  setD
  setA
end 

to setN

 let x  -105
  let y   50
   ask patches with [pxcor > x - 10 and pxcor < x + 10 and pycor > y - 20 and pycor < y + 20]
  [
    set pcolor red
  ]
  let xi  -105
  let yi  0
  ask patches with [pxcor > xi - 10 and pxcor < xi + 10 and pycor > yi - 25 and pycor < yi + 25]
  [
    set pcolor red
  ]
  let xiiii  -190
  let yiiii  50
   ask patches with [pxcor > xiiii - 10 and pxcor < xiiii + 10 and pycor > yiiii - 20 and pycor < yiiii + 20]
  [
    set pcolor red
  ]
  let xiiiii  -190
  let yiiiii 0
  ask patches with [pxcor > xiiiii - 10 and pxcor < xiiiii + 10 and pycor > yiiiii - 25 and pycor < yiiiii + 25]
  [
    set pcolor red
  ]

  let a  -150
  let b   20
   ask patches with [pxcor > a - 10 and pxcor < a + 10 and pycor > b - 13 and pycor < b + 13]
  [
   set pcolor red
  ]

 let ai  -165
  let bi   55
   ask patches with [pxcor > ai - 10 and pxcor < ai + 10 and pycor > bi - 12 and pycor < bi + 12]
  [
   set pcolor red
  ]
 let aii  -135
  let bii   -10
   ask patches with [pxcor > aii - 10 and pxcor < aii + 10 and pycor > bii - 13 and pycor < bii + 13]
  [
  set pcolor red
  ]
end 

to setI

 let x  -55
  let y   40
   ask patches with [pxcor > x - 10 and pxcor < x + 10 and pycor > y - 20 and pycor < y + 20]
  [
    set pcolor red
  ]
  let xi  -55
  let yi  0
  ask patches with [pxcor > xi - 10 and pxcor < xi + 10 and pycor > yi - 20 and pycor < yi + 20]
  [
    set pcolor red
  ]
  let xii -55
  let yii  65
  ask patches with [pxcor > xii - 30 and pxcor < xii + 30 and pycor > yii - 5 and pycor < yii + 5]
  [
    set pcolor red
  ]
  let xiii -55
  let yiii  -25
  ask patches with [pxcor > xiii - 30 and pxcor < xiii + 30 and pycor > yiii - 5 and pycor < yiii + 5]
  [
    set pcolor red
  ]
end 

to setD

 let x  30
  let y   40
   ask patches with [pxcor > x - 10 and pxcor < x + 10 and pycor > y - 20 and pycor < y + 20]
  [
    set pcolor red
  ]
  let xi  30
  let yi  0
  ask patches with [pxcor > xi - 10 and pxcor < xi + 10 and pycor > yi - 20 and pycor < yi + 20]
  [
    set pcolor red
  ]
  let xii 30
  let yii  65
  ask patches with [pxcor > xii - 30 and pxcor < xii + 40 and pycor > yii - 5 and pycor < yii + 5]
  [
    set pcolor red
  ]
  let xiii 30
  let yiii  -25
  ask patches with [pxcor > xiii - 30 and pxcor < xiii + 40 and pycor > yiii - 5 and pycor < yiii + 5]
  [
    set pcolor red
  ]
  let xiiii  65
  let yiiii  40
   ask patches with [pxcor > xiiii - 10 and pxcor < xiiii + 10 and pycor > yiiii - 20 and pycor < yiiii + 20]
  [
    set pcolor red
  ]
  let xiiiii  65
  let yiiiii  0
  ask patches with [pxcor > xiiiii - 10 and pxcor < xiiiii + 10 and pycor > yiiiii - 20 and pycor < yiiiii + 20]
  [
    set pcolor red
  ]
end 

to setA

 let x  100
  let y   40
   ask patches with [pxcor > x - 10 and pxcor < x + 10 and pycor > y - 20 and pycor < y + 20]
  [
    set pcolor red
  ]
  let xi  100
  let yi  -10
  ask patches with [pxcor > xi - 10 and pxcor < xi + 10 and pycor > yi - 20 and pycor < yi + 20]
  [
    set pcolor red
  ]
  let xii 100
  let yii  65
  ask patches with [pxcor > xii - 10 and pxcor < xii + 55 and pycor > yii - 5 and pycor < yii + 5]
  [
    set pcolor red
  ]
  let xiii 100
  let yiii  15
  ask patches with [pxcor > xiii - 10 and pxcor < xiii + 55 and pycor > yiii - 5 and pycor < yiii + 5]
  [
    set pcolor red
  ]
  let xiiii  145
  let yiiii   40
   ask patches with [pxcor > xiiii - 10 and pxcor < xiiii + 10 and pycor > yiiii - 20 and pycor < yiiii + 20]
  [
    set pcolor red
  ]
  let xiiiii  145
  let yiiiii  -10
  ask patches with [pxcor > xiiiii - 10 and pxcor < xiiiii + 10 and pycor > yiiiii - 20 and pycor < yiiiii + 20]
  [
    set pcolor red
  ]
end 

to go
  ask nidas
  [
  ifelse pcolor != red
    [wander]
    [trap]
  ]
  tick
end 
 To wander

  lt random 10
  rt random 10
  fd 2
  ask patches   in-cone  20 5
    [
      set pcolor yellow
    ]
end 

to trap
  set count-down count-down - 1   ;decrement-timer
  set label "trapped"
  set trapped? true
  ;lt random 360
  ;rt random 360
  move-random-insideletter



  if count-down = 0
    [
      wander
      set label ""
      reset-count-down
    ]
end 

to reset-count-down
  set count-down ticks
end 

to move-random-insideletter ;So, from there onwards the turtles are now going to remain within the letter they are in.
                            ;they MUST not move out of the letter. They should move randomly within the letter ONLY.

    set heading random 360
  fd 2
  fd -2
end 

to-report get-trapped

report  count nidas with [ trapped? = true]
end 

to-report get-untrapped

report  count nidas with [ trapped? = false]
end 

There is only one version of this model, created 12 months ago by Nida Fatima.

Attached files

File Type Description Last updated
Turtles trapped by letters.png preview Preview for 'Turtles trapped by letters' 12 months ago, by Nida Fatima Download

This model does not have any ancestors.

This model does not have any descendants.