;Hay que determinar el número de individuos en la población y si la temperatura los afecta y en que tasa vital con los switches de gT para crecimiento sT para supervivencia y rT para reproducción. ;Los sliders de growth son la probabilidad de que un individuo crezca, un valor de 1 provoca que todos crezcan y de 0 que ninguno ;Los sliders de surv son la probabilidad de que un individuo sobreviva, un valor de 1 provoca que ninguno muera y uno de 0 que todos mueran. ;Los sliders de Reproducción son la probabilidad de que un individuo deje descendencia, la talla 3 siempre dejara 2 individuos y la 4 dejara 3. Un valor de 1 significa que siempre dejaran descendencia y uno de 0 que no lo harán ;Las regiones determinan en que medida afecta los switches de temperatura a cierta tasa vital. La región 1 no afecta nunca nada; la región 2 afecta un 25% de manera positiva a la tasa vital afectada por la temperatura mientras que la 4 es un decremento. Las regiones 3 y 5 afectan de manera positiva y negativa respectivamente un 50% a la tasa vital. ;Le anexo el script a continuación y le ofrezco mis disculpas pues está bastante desordenado y aunque me pude ahorrar algunas líneas de código no me atreví por mi poca experiencia en programación. globals [ ; Me base en el modelo de "Many regions" para esta parte region-boundaries ] patches-own [; tuve que dividir a todos en breeds para aplicarles cosas en particular region ] breed [adultos adulto] breed [semiadultos semiadulto] breed [juveniles juvenil] breed [neonatos neonato] turtles-own[counter] ;esta variable solo sirve para que no crezca mas de un estadio a la vez o muera instantaneamente despues de haber crecido to setup clear-all setup-regions 5 color-regions setup-adultos setup-neonatos setup-semiadultos setup-juvenil reset-ticks end to go check-growth check-death check-fecundity ask turtles [move] tick end to setup-neonatos foreach (range 1 (length region-boundaries + 1)) [ region-number -> let region-patches patches with [ region = region-number ] create-neonatos población-inicial1 [ setxy random-xcor random-ycor move-to one-of region-patches] ask neonatos [set shape "rana" set size .5 set color 0] ] end to setup-juvenil foreach (range 1 (length region-boundaries + 1)) [ region-number -> let region-patches patches with [ region = region-number ] create-juveniles población-inicial2 [ setxy random-xcor random-ycor move-to one-of region-patches] ask juveniles [set shape "rana" set size .8 set color 54] ] end to setup-semiadultos foreach (range 1 (length region-boundaries + 1)) [ region-number -> let region-patches patches with [ region = region-number ] create-semiadultos población-inicial3 [ setxy random-xcor random-ycor move-to one-of region-patches ] ask semiadultos [set shape "rana" set size 1.2 set color 64] ] end to setup-adultos foreach (range 1 (length region-boundaries + 1)) [ region-number -> let region-patches patches with [ region = region-number ] create-adultos población-inicial4 [ setxy random-xcor random-ycor move-to one-of region-patches] ask adultos [set shape "rana" set size 1.5 set color 61] ] end to check-growth ask neonatos [ if region = 1 [if growth1 >= random-float 1 and counter < ticks [set breed juveniles set shape "rana" set size .8 set color 54 set counter ticks ]] if region = 2 [ifelse gT1 [if growth1 * 1.25 >= random-float 1 and counter < ticks [set breed juveniles set shape "rana" set size .8 set color 54 set counter ticks ]] [if growth1 >= random-float 1 and counter < ticks [set breed juveniles set shape "rana" set size .8 set color 54 set counter ticks ]]] if region = 3 [ifelse gT1 [if growth1 * 1.5 >= random-float 1 and counter < ticks [set breed juveniles set shape "rana" set size .8 set color 54 set counter ticks ]] [if growth1 >= random-float 1 and counter < ticks [set breed juveniles set shape "rana" set size .8 set color 54 set counter ticks ]]] if region = 4 [ifelse gT1 [if growth1 / 1.3333 >= random-float 1 and counter < ticks [set breed juveniles set shape "rana" set size .8 set color 54 set counter ticks ]] [if growth1 >= random-float 1 and counter < ticks [set breed juveniles set shape "rana" set size .8 set color 54 set counter ticks ]]] if region = 5 [ifelse gT1 [if growth1 / 2 >= random-float 1 and counter < ticks [set breed juveniles set shape "rana" set size .8 set color 54 set counter ticks ]] [if growth1 >= random-float 1 and counter < ticks [set breed juveniles set shape "rana" set size .8 set color 54 set counter ticks ]]] ] ask juveniles [ if region = 1 [if growth2 >= random-float 1 and counter < ticks [set breed semiadultos set shape "rana" set size 1.2 set color 64 set counter ticks]] if region = 2 [ifelse gT2 [if growth2 * 1.25 >= random-float 1 and counter < ticks[set breed semiadultos set shape "rana" set size 1.2 set color 64 set counter ticks ]] [if growth2 >= random-float 1 and counter < ticks [set breed semiadultos set shape "rana" set size 1.2 set color 64 set counter ticks ]]] if region = 3 [ifelse gT2 and counter < ticks [if growth2 * 1.5 >= random-float 1 and counter < ticks[set breed semiadultos set shape "rana" set size 1.2 set color 64 set counter ticks ]] [if growth2 >= random-float 1 and counter < ticks [set breed semiadultos set shape "rana" set size 1.2 set color 64 set counter ticks ]]] if region = 4 [ifelse gT2 [if growth2 / 1.3333 >= random-float 1 and counter < ticks[set breed semiadultos set shape "rana" set size 1.2 set color 64 set counter ticks ]] [if growth2 >= random-float 1 and counter < ticks [set breed semiadultos set shape "rana" set size 1.2 set color 64 set counter ticks ]]] if region = 5 [ifelse gT2 [if growth2 / 2 >= random-float 1 and counter < ticks [set breed semiadultos set shape "rana" set size 1.2 set color 64 set counter ticks ]] [if growth2 >= random-float 1 and counter < ticks [set breed semiadultos set shape "rana" set size 1.2 set color 64 set counter ticks ]]] ] ask semiadultos [ if region = 1 [if growth3 >= random-float 1 and counter < ticks [set breed adultos set shape "rana" set size 1.5 set color 61 set counter ticks]] if region = 2 [ifelse gT3 [if growth3 * 1.25 >= random-float 1 and counter < ticks[set breed adultos set shape "rana" set size 1.5 set color 61 set counter ticks ]] [if growth3 >= random-float 1 and counter < ticks [set breed adultos set shape "rana" set size 1.5 set color 61 set counter ticks ]]] if region = 3 [ifelse gT3 [if growth3 * 1.5 >= random-float 1 and counter < ticks[set breed adultos set shape "rana" set size 1.5 set color 61 set counter ticks ]] [if growth3 >= random-float 1 and counter < ticks [set breed adultos set shape "rana" set size 1.5 set color 61 set counter ticks ]]] if region = 4 [ifelse gT3 [if growth3 / 1.3333 >= random-float 1 and counter < ticks[set breed adultos set shape "rana" set size 1.5 set color 61 set counter ticks ]] [if growth3 >= random-float 1 and counter < ticks [set breed adultos set shape "rana" set size 1.5 set color 61 set counter ticks ]]] if region = 5 [ifelse gT3 [if growth3 / 2 >= random-float 1 and counter < ticks[set breed adultos set shape "rana" set size 1.5 set color 61 set counter ticks ]] [if growth3 >= random-float 1 and counter < ticks [set breed adultos set shape "rana" set size 1.5 set color 61 set counter ticks ]]] ] end to check-death ask neonatos [ if region = 1 [if surv1 <= random-float 1 and counter < ticks [die]] if region = 2 [ifelse sT1 [if surv1 * 1.25 <= random-float 1 and counter < ticks [die]] [if surv1 <= random-float 1 and counter < ticks [die]]] if region = 3 [ifelse sT1 [if surv1 * 1.5 <= random-float 1 and counter < ticks [die]] [if surv1 <= random-float 1 and counter < ticks [die]]] if region = 4 [ifelse sT1 [if surv1 / 1.3333 <= random-float 1 and counter < ticks [die]] [if surv1 <= random-float 1 and counter < ticks [die]]] if region = 5 [ifelse sT1 [if surv1 / 2 <= random-float 1 and counter < ticks [die]] [if surv1 <= random-float 1 and counter < ticks [die]]] ] ask juveniles [ if region = 1 [if surv2 <= random-float 1 and counter < ticks [die]] if region = 2 [ifelse sT2 [if surv2 * 1.25 <= random-float 1 and counter < ticks [die]] [if surv2 <= random-float 1 and counter < ticks [die]]] if region = 3 [ifelse sT2 [if surv2 * 1.5 <= random-float 1 and counter < ticks [die]] [if surv2 <= random-float 1 and counter < ticks [die]]] if region = 4 [ifelse sT2 [if surv2 / 1.3333 <= random-float 1 and counter < ticks [die]] [if surv2 <= random-float 1 and counter < ticks [die]]] if region = 5 [ifelse sT2 [if surv2 / 2 <= random-float 1 and counter < ticks [die]] [if surv2 <= random-float 1 and counter < ticks [die]]] ] ask semiadultos [ if region = 1 [if surv3 <= random-float 1 and counter < ticks [die]] if region = 2 [ifelse sT3 [if surv3 * 1.25 <= random-float 1 and counter < ticks [die]] [if surv3 <= random-float 1 and counter < ticks [die]]] if region = 3 [ifelse sT3 [if surv3 * 1.5 <= random-float 1 and counter < ticks [die]] [if surv3 <= random-float 1 and counter < ticks [die]]] if region = 4 [ifelse sT3 [if surv3 / 1.3333 <= random-float 1 and counter < ticks [die]] [if surv3 <= random-float 1 and counter < ticks [die]]] if region = 5 [ifelse sT3 [if surv3 / 2 <= random-float 1 and counter < ticks [die]] [if surv3 <= random-float 1 and counter < ticks [die]]] ] ask adultos [ if region = 1 [if surv4 <= random-float 1 and counter < ticks [die]] if region = 2 [ifelse sT4 [if surv4 * 1.25 <= random-float 1 and counter < ticks [die]] [if surv4 <= random-float 1 and counter < ticks [die]]] if region = 3 [ifelse sT4 [if surv4 * 1.5 <= random-float 1 and counter < ticks [die]] [if surv4 <= random-float 1 and counter < ticks [die]]] if region = 4 [ifelse sT4 [if surv4 / 1.3333 <= random-float 1 and counter < ticks [die]] [if surv4 <= random-float 1 and counter < ticks [die]]] if region = 5 [ifelse sT4 [if surv4 / 2 <= random-float 1 and counter < ticks [die]] [if surv4 <= random-float 1 and counter < ticks [die]]] ] end to check-fecundity ask semiadultos [ if region = 1 [if Reproducción3 >= random-float 1 and counter < ticks [hatch 2 [set breed neonatos set shape "rana" set color 0 set size .5 set counter ticks]]] if region = 2 [ifelse rT3 [if Reproducción3 * 1.25 >= random-float 1 and counter < ticks [hatch 2 [set breed neonatos set shape "rana" set color 0 set size .5 set counter ticks]]] [if Reproducción3 >= random-float 1 and counter < ticks [hatch 2 [set breed neonatos set shape "rana" set color 0 set size .5 set counter ticks]]]] if region = 3 [ifelse rT3 [if Reproducción3 * 1.5 >= random-float 1 and counter < ticks [hatch 2 [set breed neonatos set shape "rana" set color 0 set size .5 set counter ticks]]] [if Reproducción3 >= random-float 1 and counter < ticks [hatch 2 [set breed neonatos set shape "rana" set color 0 set size .5 set counter ticks]]]] if region = 4 [ifelse rT3 [if Reproducción3 / 1.3333 >= random-float 1 and counter < ticks [hatch 2 [set breed neonatos set shape "rana" set color 0 set size .5 set counter ticks]]] [if Reproducción3 >= random-float 1 and counter < ticks [hatch 2 [set breed neonatos set shape "rana" set color 0 set size .5 set counter ticks]]]] if region = 5 [ifelse rT3 [if Reproducción3 / 2 >= random-float 1 and counter < ticks [hatch 2 [set breed neonatos set shape "rana" set color 0 set size .5 set counter ticks]]] [if Reproducción3 >= random-float 1 and counter < ticks [hatch 2 [set breed neonatos set shape "rana" set color 0 set size .5 set counter ticks]]]] ] ask adultos [ if region = 1 [if Reproducción4 >= random-float 1 and counter < ticks [hatch 3 [set breed neonatos set shape "rana" set color 0 set size .5 set counter ticks]]] if region = 2 [ifelse rT4 [if Reproducción4 * 1.25 >= random-float 1 and counter < ticks [hatch 3 [set breed neonatos set shape "rana" set color 0 set size .5 set counter ticks]]] [if Reproducción4 >= random-float 1 and counter < ticks [hatch 3 [set breed neonatos set shape "rana" set color 0 set size .5 set counter ticks]]]] if region = 3 [ifelse rT4 [if Reproducción4 * 1.5 >= random-float 1 and counter < ticks [hatch 3 [set breed neonatos set shape "rana" set color 0 set size .5 set counter ticks]]] [if Reproducción4 >= random-float 1 and counter < ticks [hatch 3 [set breed neonatos set shape "rana" set color 0 set size .5 set counter ticks]]]] if region = 4 [ifelse rT4 [if Reproducción4 / 1.3333 >= random-float 1 and counter < ticks [hatch 3 [set breed neonatos set shape "rana" set color 0 set size .5 set counter ticks]]] [if Reproducción4 >= random-float 1 and counter < ticks [hatch 3 [set breed neonatos set shape "rana" set color 0 set size .5 set counter ticks]]]] if region = 5 [ifelse rT4 [if Reproducción4 / 2 >= random-float 1 and counter < ticks [hatch 3 [set breed neonatos set shape "rana" set color 0 set size .5 set counter ticks]]] [if Reproducción4 >= random-float 1 and counter < ticks [hatch 3 [set breed neonatos set shape "rana" set color 0 set size .5 set counter ticks]]]] ] end to move ;region models let current-region region right random 30 left random 30 forward 0.25 keep-in-region current-region end to color-regions; modifique el código para colorear el porcentaje en el fondo ask patches with [ region = 1 ] [ set pcolor 7 set plabel-color pcolor + 1 set plabel 0 ] ask patches with [ region = 2 ] [ set pcolor 28 set plabel-color pcolor + 1 set plabel ".25" ] ask patches with [ region = 4 ] [ set pcolor 98 set plabel-color pcolor - 4 set plabel "-.25" ] ask patches with [ region = 3] [ set pcolor 15 set plabel-color pcolor + 1 set plabel ".5" ] ask patches with [ region = 5 ] [ set pcolor 95 set plabel-color pcolor - 1 set plabel "-.5" ] end to setup-regions [ num-regions ] ;Region model foreach region-divisions num-regions draw-region-division set region-boundaries calculate-region-boundaries num-regions let region-numbers (range 1 (num-regions + 1)) (foreach region-boundaries region-numbers [ [boundaries region-number] -> ask patches with [ pxcor >= first boundaries and pxcor <= last boundaries ] [ set region region-number ] ]) end to-report calculate-region-boundaries [ num-regions ] ; Region model let divisions region-divisions num-regions report (map [ [d1 d2] -> list (d1 + 1) (d2 - 1) ] (but-last divisions) (but-first divisions)) end to-report region-divisions [ num-regions ]; region model report n-values (num-regions + 1) [ n -> [ pxcor ] of patch (min-pxcor + (n * ((max-pxcor - min-pxcor) / num-regions))) 0 ] end to draw-region-division [ x ] ;Region model ask patches with [ pxcor = x ] [ set pcolor grey + 1.5 ] create-turtles 1 [ setxy x max-pycor + 0.5 set heading 0 set color grey - 3 pen-down forward world-height set xcor xcor + 1 / patch-size right 180 set color grey + 3 forward world-height die ] end to keep-in-region [ which-region ] ;Region model if region != which-region [ let region-min-pxcor first item (which-region - 1) region-boundaries let region-max-pxcor last item (which-region - 1) region-boundaries let region-width (region-max-pxcor - region-min-pxcor) + 1 ifelse xcor < region-min-pxcor [ set xcor xcor + region-width ] [ if xcor > region-max-pxcor [ set xcor xcor - region-width ] ] ] end