Turtles trapped by letters
Do you have questions or comments about this model? Ask them here! (You'll first need to log in.)
Purpose
The purpose of this model to simulate the trap model, in this model the turtles move randomly and move gradually toward red letter patch and when they reached at red letter patch they will trappped there
State Variable
In this model agents are breed type nidas and there variable are trapped? ( the agent is trapped or not ) and birth-ticks and count down.
Process Overview
the Setup button create twenty four turtles on random positions and these turtles will move toward red letter patch near to them and trapped there.
Design Concepts
observation: The visualization window of model show Name of the author of this code in Red colours and model monitor the trapped and not trapped turtles in author name letter.
Initalization
the simulation start with Name N I D A on visualization window with color red and twenty four turtles on random position.
Input Data
The model did not include any input from external sources
Submodels
setupname : the will set the name N I D A on visualization window wander: this will move the turtles trap: this will trap the turtls on letters
CREDITS AND REFERENCES
Author: Nida Fatima email : jaffrinida@yahoo.com
Comments and Questions
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 about 7 years ago by Nida Fatima.
Attached files
File | Type | Description | Last updated | |
---|---|---|---|---|
Turtles trapped by letters.png | preview | Preview for 'Turtles trapped by letters' | about 7 years ago, by Nida Fatima | Download |
This model does not have any ancestors.
This model does not have any descendants.