Sugarscape Sexual Reproduction
Model was written in NetLogo 6.3.0
•
Viewed 139 times
•
Downloaded 7 times
•
Run 0 times
Do you have questions or comments about this model? Ask them here! (You'll first need to log in.)
Info tab cannot be displayed because of an encoding error
Comments and Questions
Please start the discussion about this model!
(You'll first need to log in.)
Click to Run Model
extensions [matrix] turtles-own [ sugar ;; the amount of sugar this turtle has metabolism ;; the amount of sugar that each turtles loses each tick vision ;; the distance that this turtle can see in the horizontal and vertical directions vision-points ;; the points that this turtle can see in relative to it's current position (based on vision) ;culture ;; a list containing cultural tags ;culturecolor ;; sum of culture list tags sexo ;; set agent sex 1 male 0 female edad ;; set agent age muerte ;; set agent age death fertilidadc ;; set agent age fertility start fertilidadf ;; set agent age fertility end dotacion ;; set agent sugar amount at birth (or creation in the setup routine) ] patches-own [ psugar ;; the amount of sugar on this patch max-psugar ;; the maximum amount of sugar that can be on this patch ] ;; ;; Setup Procedures ;; to setup clear-all create-turtles initial-population [ turtle-setup ] setup-patches reset-ticks end to turtle-setup ;; turtle procedure set color red set shape "person" move-to one-of patches with [not any? other turtles-here] set sugar random-in-range 50 100 ;;guardo la dotacion inicial de azucar set dotacion sugar set metabolism random-in-range 1 4 set vision random-in-range 1 6 ;; turtles can look horizontally and vertically up to vision patches ;; but cannot look diagonally at all set vision-points [] foreach (range 1 (vision + 1)) [ n -> set vision-points sentence vision-points (list (list 0 n) (list n 0) (list 0 (- n)) (list (- n) 0)) ] ;set culture n-values 11 [random 2] ; edad de muerte set muerte 60 + random 40 ; sexo if 1 = male, 0 = female set sexo random 2 set edad 0 set fertilidadc 12 + random 3 ifelse sexo = 1 [set fertilidadf 50 + random 10] [set fertilidadf 40 + random 10] run visualization end to setup-patches let m matrix:from-row-list [[0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 3 3 3 3 3 3 2 2 2 2 2 2 2 2] [0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1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 0 0 0] [2 2 2 2 2 2 2 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 2 2 2 2 2 2 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0] [1 2 2 2 2 2 2 2 3 3 3 3 3 3 3 3 3 3 3 3 3 3 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0] [1 2 2 2 2 2 2 2 2 2 3 3 3 3 3 3 3 3 3 3 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0] [1 1 2 2 2 2 2 2 2 2 2 2 3 3 3 3 3 3 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0] [1 1 1 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0] [1 1 1 1 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0] [1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0] [1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0]] let i 0 let j 0 ;let m1 matrix:transpose m ;; let row-i matrix:get-row m i ask patches with [pxcor = i and pycor = j] ;[set max-psugar item rowx row-i let rowx 49 repeat 50 [ repeat 50 [let row-i matrix:get-row m i ask patches with [pxcor = i and pycor = j] [set max-psugar item rowx row-i ;ask patches with [pxcor = i and pycor = j] [set max-psugar item rowx (matrix:get-row m i) set psugar max-psugar patch-recolor ] set rowx rowx - 1 set j j + 1 ] set i i + 1 set j 0 set rowx 49] end ;; ;; Runtime Procedures ;; to go if not any? turtles [ stop ] ask patches [ patch-growback patch-recolor ] ask turtles [ ;turtle-culture turtle-move turtle-eat if sugar <= 0 [ die ] if edad = muerte [die] set edad edad + 1 if (edad >= fertilidadc) and (edad <= fertilidadf) and (sugar >= dotacion) [sexear] run visualization ] tick end to parir [metaP visionP metaM visionM dotacionP dotacionM] hatch 1 [ move-to patch-ahead 1 set color green ifelse (random 2 = 0) [set metabolism metaM] [set metabolism metaP] ifelse (random 2 = 0) [set vision visionM] [set vision visionP] set vision-points [] foreach (range 1 (vision + 1)) [ n -> set vision-points sentence vision-points (list (list 0 n) (list n 0) (list 0 (- n)) (list (- n) 0)) ] ifelse (random 2 = 0) [set sexo 0] [set sexo 1] set muerte 60 + random 40 set edad 0 set fertilidadc 12 + random 3 ifelse sexo = 1 [set fertilidadf 50 + random 10] [set fertilidadf 40 + random 10] let sugarH (dotacionP / 2) + (dotacionM / 2) set sugar sugarH set dotacion sugar ] end to sexear let sexoc sexo let metaP metabolism let visionP vision let bnacio false let dotacionP dotacion let bvacio false let metaM 0 let visionM 0 let dotacionM 0 let vecindario turtles-on neighbors4 if (count(vecindario) > 0) [ask vecindario [ set metaM metabolism set visionM vision set dotacionM dotacion repeat 4 [ if (sexoc != sexo) and (edad >= fertilidadc) and (edad <= fertilidadf) and (sugar >= dotacion) and (not any? turtles-on patch-ahead 1) [ parir metaP visionP metaM visionM dotacionP dotacionM set sugar sugar - (dotacionM / 2) set bNacio true ] set heading heading + 90 ] ;si la pareja no tiene lugar fijarse si hay lugar en el llamador if (sexoc != sexo) and (edad >= fertilidadc) and (edad <= fertilidadf) and (sugar >= dotacion) and (bNacio = false) [set bvacio true ] ] if bvacio = true [repeat 4 [if (not any? turtles-on patch-ahead 1) [parir metaP visionP metaM visionM dotacionP dotacionM set bNacio true ] set heading heading + 90 ] ] ] if bNacio = true [set sugar sugar - (dotacionP / 2)] end ;to turtle-culture ; let vecindario turtles-on neighbors4 ; ;; me fijo si hay alguna tortuga en su vecindario ; if (count(vecindario) > 0) ; [;; selecciono un tag cultural al azar ; let rndvalue random 11 ; let culturetag item rndvalue culture ; ask vecindario [let culturetagV item rndvalue culture ; if culturetag != culturetagV ; [set culture replace-item rndvalue culture culturetag] ; ] ; ] ;end to turtle-move ;; turtle procedure ;; consider moving to unoccupied patches in our vision, as well as staying at the current patch let move-candidates (patch-set patch-here (patches at-points vision-points) with [not any? turtles-here]) let possible-winners move-candidates with-max [psugar] if any? possible-winners [ ;; if there are any such patches move to one of the patches that is closest move-to min-one-of possible-winners [distance myself] ] end to turtle-eat ;; turtle procedure ;; metabolize some sugar, and eat all the sugar on the current patch set sugar (sugar - metabolism + psugar) set psugar 0 end to patch-recolor ;; patch procedure ;; color patches based on the amount of sugar they have set pcolor (yellow + 4.9 - psugar) end to patch-growback ;; patch procedure ;; gradually grow back all of the sugar for the patch ;set psugar min (list max-psugar (psugar + 1)) ;set psugar max-psugar if psugar < max-psugar [set psugar psugar + 1] end ;; ;; Utilities ;; to-report random-in-range [low high] report low + random (high - low + 1) end ;; ;; Visualization Procedures ;; to no-visualization ;; turtle procedure set color red end to color-agents-by-vision ;; turtle procedure set color red - (vision - 3.5) end to color-agents-by-metabolism ;; turtle procedure set color red + (metabolism - 2.5) end to color-agents-by-culture set color red ; set culturecolor reduce + culture ; ifelse culturecolor > 5 ; [set color red] ; [set color blue] ; ;[set color scale-color red culturecolor 0 10 ] ; ;[set color scale-color blue culturecolor 0 10] end ; Copyright 2009 Uri Wilensky. ; See Info tab for full copyright and license.
There is only one version of this model, created almost 2 years ago by Diego Díaz Córdova.
Attached files
File | Type | Description | Last updated | |
---|---|---|---|---|
Sugarscape Sexual Reproduction.png | preview | Preview for 'Sugarscape Sexual Reproduction' | almost 2 years ago, by Diego Díaz Córdova | Download |
This model does not have any ancestors.
This model does not have any descendants.