JBI_buffer_effectiveness

JBI_buffer_effectiveness preview image

1 collaborator

Default-person George Malanson (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.3.0 • Viewed 56 times • Downloaded 2 times • Run 0 times
Download the 'JBI_buffer_effectiveness' modelDownload this modelEmbed this model

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

globals [ ;THE FOLLOWING DECLARES GLOBAL VARIABLES, FOLLOWED BY THE 100 VIRTUAL SPECIES, AND
    ; THEN BY THE VARIABLES THAT ARE AGENT AND PATCH SPECIFIC ; IN NETLOGO EACH CELL IS A "PATCH"
  minergy maxergy renergy axaxis counterr counterdie10
     counter1 counter2 counter3
  counterN  counterP counterQ counterC

  direct grad limit
  mean1 mean2 median1 median2 std1 std2 max1 max2 min1 min2 maxC2 minC2 renC2
   Si Sj BCij
 smooth gamma climbase mclim addclim
     adm agedi  xrand yrand randyr
Connect1 Connect2
             year mq1 mq2 cq1 cq2
     extracount  extracountA extracountB dispB

         radi peaks seed

               ]
breed [Sp1s Sp1]

breed [Sp2s Sp2]

breed [Sp3s Sp3]

breed [Sp4s Sp4]

breed [Sp5s Sp5]
breed [Sp6s Sp6]
breed [Sp7s Sp7]
breed [Sp8s Sp8]

breed [Sp9s Sp9]

breed [Sp10s Sp10]

breed [Sp11s Sp11]

breed [sp12s Sp12]
breed [Sp13s Sp13]

breed [Sp14s Sp14]

breed [Sp15s Sp15]
breed [Sp16s Sp16]

breed [Sp17s Sp17]
breed [Sp18s Sp18]

breed [Sp19s Sp19]
breed [Sp20s Sp20]

breed [Sp21s Sp21]
breed [Sp22s Sp22]
breed [Sp23s Sp23]
breed [Sp24s Sp24]

breed [Sp25s Sp25]

breed [Sp26s Sp26]

breed [Sp27s Sp27]

breed [Sp28s Sp28]
breed [Sp29s Sp29]
breed [Sp30s Sp30]
breed [Sp31s Sp31]

breed [Sp32s Sp32]

breed [Sp33s Sp33]

breed [Sp34s Sp34]

breed [Sp35s Sp35]
breed [Sp36s Sp36]

breed [Sp37s Sp37]

breed [Sp38s Sp38]
breed [Sp39s Sp39]

breed [Sp40s Sp40]
breed [Sp41s Sp41]

breed [Sp42s Sp42]

breed [Sp43s Sp43]

breed [Sp44s Sp44]

breed [Sp45s Sp45]
breed [Sp46s Sp46]

breed [Sp47s Sp47]

breed [Sp48s Sp48]
breed [Sp49s Sp49]
breed [Sp50s Sp50]
breed [Sp51s Sp51]

breed [Sp52s Sp52]

breed [Sp53s Sp53]
breed [Sp54s Sp54]

breed [Sp55s Sp55]
breed [Sp56s Sp56]

breed [Sp57s Sp57]

breed [Sp58s Sp58]
breed [Sp59s Sp59]
breed [Sp60s Sp60]
breed [Sp61s Sp61]

breed [Sp62s Sp62]

breed [Sp63s Sp63]
breed [Sp64s Sp64]

breed [Sp65s Sp65]
breed [Sp66s Sp66]

breed [Sp67s Sp67]

breed [Sp68s Sp68]
breed [Sp69s Sp69]

breed [Sp70s Sp70]
breed [Sp71s Sp71]

breed [Sp72s Sp72]

breed [Sp73s Sp73]
breed [Sp74s Sp74]

breed [Sp75s Sp75]
breed [Sp76s Sp76]

breed [Sp77s Sp77]

breed [Sp78s Sp78]
breed [Sp79s Sp79]

breed [Sp80s Sp80]
breed [Sp81s Sp81]

breed [Sp82s Sp82]

breed [Sp83s Sp83]
breed [Sp84s Sp84]

breed [Sp85s Sp85]
breed [Sp86s Sp86]

breed [Sp87s Sp87]

breed [Sp88s Sp88]
breed [Sp89s Sp89]

breed [Sp90s Sp90]
breed [Sp91s Sp91]

breed [Sp92s Sp92]

breed [Sp93s Sp93]
breed [Sp94s Sp94]

breed [Sp95s Sp95]
breed [Sp96s Sp96]

breed [Sp97s Sp97]

breed [Sp98s Sp98]
breed [Sp99s Sp99]
breed [Sp100s Sp100]

turtles-own [ age dista3 dista4 deathv]

  patches-own [  refuge room roomA roomD roomR SorsN1   SorsT1 SorsS1 climate1 climate2 climate3 climate4
        ASq1 ASq2 ASq3 Asq4 ASq5 ASq6 ASq7 ASq8 ASq9 ASq10 ASq11 ASq12 ASq13 ASq14 ASq15 ASq16 ASq17 ASq18 ASq19 ASq20 ASq21 ASq22 ASq23
            ASq24 ASq25 ASq26 ASq27 ASq28 ASq29 ASq30 ASq31 ASq32 ASq33 ASq34 ASq35 ASq36 ASq37 ASq38 ASq39 ASq40 ASq41 ASq42 ASq43 ASq44 ASq45 ASq46 ASq47 ASq48 ASq49 ASq50
         ASq51 ASq52 ASq53 ASq54 ASq55 ASq56 ASq57 ASq58 ASq59 ASq60 ASq61 ASq62 ASq63 ASq64 ASq65 ASq66 ASq67 ASq68 ASq69 ASq70 ASq71 ASq72 ASq73
            ASq74 ASq75 ASq76 ASq77 ASq78 ASq79 ASq80 ASq81 ASq82 ASq83 ASq84 ASq85 ASq86 ASq87 ASq88 ASq89 ASq90 ASq91 ASq92 ASq93 ASq94 ASq95 ASq96 ASq97 ASq98 ASq99 ASq100


        ASQR1 ASQR2 ASQR3 ASQR4 ASQR5 ASQR6 ASQR7 ASQR8 ASQR9 ASQR10 ASQR11 ASQR12 ASQR13 ASQR14 ASQR15 ASQR16 ASQR17 ASQR18 ASQR19 ASQR20 ASQR21 ASQR22 ASQR23
            ASQR24 ASQR25 ASQR26 ASQR27 ASQR28 ASQR29 ASQR30 ASQR31 ASQR32 ASQR33 ASQR34 ASQR35 ASQR36 ASQR37 ASQR38 ASQR39 ASQR40 ASQR41 ASQR42 ASQR43 ASQR44 ASQR45 ASQR46 ASQR47 ASQR48 ASQR49 ASQR50
         ASQR51 ASQR52 ASQR53 ASQR54 ASQR55 ASQR56 ASQR57 ASQR58 ASQR59 ASQR60 ASQR61 ASQR62 ASQR63 ASQR64 ASQR65 ASQR66 ASQR67 ASQR68 ASQR69 ASQR70 ASQR71 ASQR72 ASQR73
            ASQR74 ASQR75 ASQR76 ASQR77 ASQR78 ASQR79 ASQR80 ASQR81 ASQR82 ASQR83 ASQR84 ASQR85 ASQR86 ASQR87 ASQR88 ASQR89 ASQR90 ASQR91 ASQR92 ASQR93 ASQR94 ASQR95 ASQR96 ASQR97 ASQR98 ASQR99 ASQR100

     ASqD1 ASqD2 ASqD3 ASqD4 ASqD5 ASqD6 ASqD7 ASqD8 ASqD9 ASqD10 ASqD11 ASqD12 ASqD13 ASqD14 ASqD15 ASqD16 ASqD17 ASqD18 ASqD19 ASqD20 ASqD21 ASqD22 ASqD23
            ASqD24 ASqD25 ASqD26 ASqD27 ASqD28 ASqD29 ASqD30 ASqD31 ASqD32 ASqD33 ASqD34 ASqD35 ASqD36 ASqD37 ASqD38 ASqD39 ASqD40 ASqD41 ASqD42 ASqD43 ASqD44 ASqD45 ASqD46 ASqD47 ASqD48 ASqD49 ASqD50
         ASqD51 ASqD52 ASqD53 ASqD54 ASqD55 ASqD56 ASqD57 ASqD58 ASqD59 ASqD60 ASqD61 ASqD62 ASqD63 ASqD64 ASqD65 ASqD66 ASqD67 ASqD68 ASqD69 ASqD70 ASqD71 ASqD72 ASqD73
            ASqD74 ASqD75 ASqD76 ASqD77 ASqD78 ASqD79 ASqD80 ASqD81 ASqD82 ASqD83 ASqD84 ASqD85 ASqD86 ASqD87 ASqD88 ASqD89 ASqD90 ASqD91 ASqD92 ASqD93 ASqD94 ASqD95 ASqD96 ASqD97 ASqD98 ASqD99 ASqD100

  habitat
  intercount
   order1
   energy
  alpha stones

     condi1 condi2 condi3 condi4
 ]
 ; THE GO BLOCK SETS THE PARAMETERS FOR 3 OR 5 PATTERNS AND THEN CALLS THE PRIMARY SUBROUTINES

to go
  clear-all
set counterR -1
  repeat 3 [
    set counterR counterR + 2
   if counterR = 1 [set smooth 100 set peaks 3000 set seed 550 ]
    if counterR = 2 [set smooth 25 set peaks 5000 set seed 550  ]
    if counterR = 3 [set smooth 25 set peaks 2000 set seed 550 ]
    if counterR = 4 [set smooth 10 set peaks 1000 set seed 350 ]
    if counterR = 5 [set smooth 5 set peaks 1000 set seed 950 ]



    setup1
    setup2
   progo

]
  print 99999
 ; outcount1
  stop
end 

 ; THE SETUP1 SUBROUTINE ASSIGNS A CLIMATE FROM THE GRADIENT 0-1 TO EACH PATCH
   ;THE RESPONSE OF EACH SPECIES ON EACH PATCH Rix IS ASSIGNED

to setup1

  set limit 9
random-seed seed
  set axaxis 100
 print date-and-time

  ask patches [

set pcolor 49.3


  ]
ask patches [



            set ASq1 0 set ASq2 0 set ASq3 0 set ASq4 0 set ASq5 0 set ASq6 0 set ASq7 0 set ASq8 0 set ASq9 0 set ASq10 0 set ASq11 0 set ASq12 0 set ASq13 0 set ASq14 0 set ASq15 0 set ASq16 0 set ASq17 0 set ASq18 0 set ASq19 0 set ASq20 0 set ASq21 0 set ASq22 0 set ASq23     0 set ASq24 0 set ASq25 0 set ASq26 0 set ASq27 0 set ASq28 0 set ASq29 0 set ASq30 0 set ASq31 0 set ASq32 0 set ASq33 0 set ASq34 0 set ASq35 0 set ASq36 0 set ASq37 0 set ASq38 0 set ASq39 0 set ASq40 0 set ASq41 0 set ASq42 0 set ASq43 0 set ASq44 0 set ASq45 0 set ASq46 0 set ASq47 0 set ASq48 0 set ASq49 0 set ASq50 0
        set ASq51 0 set ASq52 0 set ASq53 0 set ASq54 0 set ASq55 0 set ASq56 0 set ASq57 0 set ASq58 0 set ASq59 0 set ASq60 0 set ASq61 0 set ASq62 0 set ASq63 0 set ASq64 0 set ASq65 0 set ASq66 0 set ASq67 0 set ASq68 0 set ASq69 0 set ASq70 0 set ASq71 0 set ASq72 0 set ASq73 0 set ASq74 0 set ASq75 0 set ASq76 0 set ASq77 0 set ASq78 0 set ASq79 0 set ASq80 0 set ASq81 0 set ASq82 0 set ASq83 0 set ASq84 0 set ASq85 0 set ASq86 0 set ASq87 0 set ASq88 0 set ASq89 0 set ASq90 0 set ASq91 0 set ASq92 0 set ASq93 0 set ASq94 0 set ASq95 0 set ASq96 0 set ASq97 0 set ASq98 0 set ASq99 0 set ASq100 0


  ]
 ; clear-all

  set year 0
set counter2 0
  set counter3 0

  ask patches [set habitat 1 set refuge 0 set energy 1 set counter1 0]

repeat peaks [
    ask patch random 100 random 100
     [set energy  1000
    ]
  ]

   repeat smooth [diffuse energy 1 ]
  ;ask patches [set energy ln(energy)]
  set maxergy max [energy] of patches
;  print maxergy
  set minergy min [energy] of patches
 ; print minergy
  set renergy maxergy - minergy
  if (renergy = 0) [set renergy 1]
  ask patches [

    set climate1  ((energy - minergy) / renergy) ^ 0.5

     set climate4  (climate1 * 0.7) + 0.3
    ;set climate1 random-normal 0.5 0.2

     ;set climate4 (climate1 * 0.8) + 0.2

     set climate4 climate1
   ]

     ask patches  [
    if (pxcor mod 20 = 0 AND pycor mod 20 = 0) [
    ask patches in-radius 4.37 [
        set climate4 random-float 0.3]
        ask patch-at 1 4 [set climate4 0.3 + random-float 0.7]
    ]
  ]
    if count patches with [climate4 < 0.3] < 1500  [
    repeat (1500 - count patches with [climate4 < 0.3] ) [
      ask one-of patches with [climate4 < 0.3] [
        ask one-of neighbors [
          if climate4 > 0.3 [
          set climate4 random-float  0.3
           ; set counter1 counter1 - 1 ]


    ]
  ]
    ]
  ]
  ]
    ;THE CLIMATE IS DISTRIBUTED TO APPROXIMATE A NORMAL DISTRIBUTION BUT WITH 1500 COLD MICROREFUGIA PATCHES

;  print 7777

     ; set counter2 abs(counter1)
  if count patches with [climate4 < 0.3] > 1500  [
    repeat (count patches with [climate4 < 0.3] - 1500) [
      set counter2 0
      ask one-of patches with [climate4 < 0.3] [

          set climate4 0.3 + random-float  0.4
           ; set counter1 counter1 - 1 ]


    ]
  ]
    ]


;print count patches with [climate4 < 0.3]
  if count patches with [climate4 > 0.7] < 1500  [
    repeat (1500 - count patches with [climate4 > 0.7] ) [
      ask one-of patches with [climate4 < 0.7 AND climate4 > 0.3] [

          set climate4 0.7 + random-float  0.3
           ; set counter1 counter1 - 1 ]


    ]
  ]
    ]

    ;if counter1 < 0 [
;  print 7777

     ; set counter2 abs(counter1)
  if count patches with [climate4 > 0.7] > 1500  [
    repeat (count patches with [climate4 > 0.7] - 1500) [
      set counter2 0
      ask one-of patches with [climate4 > 0.7] [

          set climate4 0.3 + random-float  0.4
           ; set counter1 counter1 - 1 ]


    ]
  ]
    ]



 print count patches with [climate4 < 0.3]
  print count patches with [climate4 > 0.7]

 ; print count patches with [climate4 < 0.3]
 ; print min [climate4] of patches
 ; print mean [climate4] of patches
  ;print max [climate4] of patches
 ; print standard-deviation [climate4] of patches



  ask patches [
  set pcolor scale-color orange climate4 0 1

  ]



 ask patches [
    if climate4 < 0.3 [set refuge 1  set pcolor sky]
    if climate4 > 0.7 [set pcolor yellow]
  ]



   ;EACH SPECIES HAS A GAUSSIAN DISTRIBUTION ON THE CLIMATE GRADIENT FROM WHICH THE RESPONSE IS
   ; ASSIGNED TO EACH PATCH

  ask patches  [


 set   ASq1  exp ( ( (( climate4 -  0.01 ) ^ 2 )   /  0.001 ) * -.5)
    set ASq2  exp ( ( (( climate4 -  0.02 ) ^ 2 )   /  0.001 ) * -.5)
       set ASq3  exp ( ( (( climate4 -  0.03 ) ^ 2 )   /  0.001 ) * -.5)
       set ASq4  exp ( ( (( climate4 -  0.04 ) ^ 2 )   /  0.001 ) * -.5)
       set ASq5  exp ( ( (( climate4 -  0.05 ) ^ 2 )   /  0.001 ) * -.5)
       set ASq6  exp ( ( (( climate4 -  0.06 ) ^ 2 )   /  0.001 ) * -.5)
       set ASq7  exp ( ( (( climate4 -  0.07 ) ^ 2 )   /  0.001 ) * -.5)
       set ASq8  exp ( ( (( climate4 -  0.08 ) ^ 2 )   /  0.001 ) * -.5)
       set ASq9  exp ( ( (( climate4 -  0.004 ) ^ 2 )   /  0.001 ) * -.5)
       set ASq10  exp ( ( (( climate4 -  0.1 ) ^ 2 )   /  0.001 ) * -.5)

       set ASq11  exp ( ( (( climate4 -  0.11 ) ^ 2 )   /  0.001 ) * -.5)
       set ASq12  exp ( ( (( climate4 -  0.12 ) ^ 2 )   /  0.001 ) * -.5)
       set ASq13  exp ( ( (( climate4 -  0.13 ) ^ 2 )   /  0.001 ) * -.5)
        set ASq14  exp ( ( (( climate4 -  0.14 ) ^ 2 )   /  0.001 ) * -.5)
       set ASq15  exp ( ( (( climate4 -  0.15 ) ^ 2 )   /  0.001 ) * -.5)
       set ASq16  exp ( ( (( climate4 -  0.16 ) ^ 2 )   /  0.001 ) * -.5)
       set ASq17  exp ( ( (( climate4 -  0.17 ) ^ 2 )   /  0.001 ) * -.5)
       set ASq18  exp ( ( (( climate4 -  0.18 ) ^ 2 )   /  0.001 ) * -.5)
       set ASq19  exp ( ( (( climate4 -  0.19 ) ^ 2 )   /  0.001 ) * -.5)
       set ASq20  exp ( ( (( climate4 -  0.2 ) ^ 2 )   /  0.001 ) * -.5)

       set ASq21  exp ( ( (( climate4 -  0.21 ) ^ 2 )   /  0.001 ) * -.5)
       set ASq22  exp ( ( (( climate4 -  0.22 ) ^ 2 )   /  0.001 ) * -.5)
       set ASq23  exp ( ( (( climate4 -  0.23 ) ^ 2 )   /  0.001 ) * -.5)
       set ASq24  exp ( ( (( climate4 -  0.24 ) ^ 2 )   /  0.001 ) * -.5)
       set ASq25  exp ( ( (( climate4 -  0.25 ) ^ 2 )   /  0.001 ) * -.5)
       set ASq26  exp ( ( (( climate4 -  0.26 ) ^ 2 )   /  0.001 ) * -.5)
       set ASq27  exp ( ( (( climate4 -  0.27 ) ^ 2 )   /  0.001 ) * -.5)
       set ASq28  exp ( ( (( climate4 -  0.28 ) ^ 2 )   /  0.001 ) * -.5)
       set ASq29  exp ( ( (( climate4 -  0.29 ) ^ 2 )   /  0.001 ) * -.5)
       set ASq30  exp ( ( (( climate4 -  0.39 ) ^ 2 )   /  0.001 ) * -.5)

       set ASq31  exp ( ( (( climate4 -  0.31 ) ^ 2 )   /  0.001 ) * -.5)

       set ASq32  exp ( ( (( climate4 -  0.32 ) ^ 2 )   /  0.001 ) * -.5)
       set ASq33  exp ( ( (( climate4 -  0.33 ) ^ 2 )   /  0.001 ) * -.5)
       set ASq34  exp ( ( (( climate4 -  0.34 ) ^ 2 )   /  0.001 ) * -.5)
       set ASq35  exp ( ( (( climate4 -  0.35 ) ^ 2 )   /  0.001 ) * -.5)
       set ASq36    exp ( ( (( climate4 -  0.36 ) ^ 2 )   /  0.001 ) * -.5)
       set ASq37    exp ( ( (( climate4 -  0.37 ) ^ 2 )   /  0.001 ) * -.5)
       set ASq38  exp ( ( (( climate4 -  0.38 ) ^ 2 )   /  0.001 ) * -.5)
       set ASq39  exp ( ( (( climate4 -  0.39 ) ^ 2 )   /  0.001 ) * -.5)
       set ASq40  exp ( ( (( climate4 -  0.40 ) ^ 2 )   /  0.001 ) * -.5)

       set ASq41  exp ( ( (( climate4 -  0.41 ) ^ 2 )   /  0.001 ) * -.5)
       set ASq42    exp ( ( (( climate4 -  0.42 ) ^ 2 )   /  0.001 ) * -.5)
       set ASq43    exp ( ( (( climate4 -  0.43 ) ^ 2 )   /  0.001 ) * -.5)
       set ASq44    exp ( ( (( climate4 -  0.44 ) ^ 2 )   /  0.001 ) * -.5)
       set ASq45    exp ( ( (( climate4 -  0.45 ) ^ 2 )   /  0.001 ) * -.5)
       set ASq46    exp ( ( (( climate4 -  0.46 ) ^ 2 )   /  0.001 ) * -.5)
       set ASq47    exp ( ( (( climate4 -  0.47 ) ^ 2 )   /  0.001 ) * -.5)
       set ASq48  exp ( ( (( climate4 -  0.48 ) ^ 2 )   /  0.001 ) * -.5)
       set ASq49  exp ( ( (( climate4 -  0.49 ) ^ 2 )   /  0.001 ) * -.5)
       set ASq50  exp ( ( (( climate4 -  0.5 ) ^ 2 )   /  0.001 ) * -.5)

       set ASq51  exp ( ( (( climate4 -  0.51 ) ^ 2 )   /  0.001 ) * -.5)
       set ASq52    exp ( ( (( climate4 -  0.52 ) ^ 2 )   /  0.001 ) * -.5)
       set ASq53    exp ( ( (( climate4 -  0.53 ) ^ 2 )   /  0.001 ) * -.5)
       set ASq54    exp ( ( (( climate4 -  0.54 ) ^ 2 )   /  0.001 ) * -.5)
       set ASq55    exp ( ( (( climate4 -  0.55 ) ^ 2 )   /  0.001 ) * -.5)
       set ASq56    exp ( ( (( climate4 -  0.56 ) ^ 2 )   /  0.001 ) * -.5)
       set ASq57    exp ( ( (( climate4 -  0.57 ) ^ 2 )   /  0.001 ) * -.5)
       set ASq58  exp ( ( (( climate4 -  0.58 ) ^ 2 )   /  0.001 ) * -.5)
       set ASq59  exp ( ( (( climate4 -  0.59 ) ^ 2 )   /  0.001 ) * -.5)
       set ASq60  exp ( ( (( climate4 -  0.60 ) ^ 2 )   /  0.001 ) * -.5)

       set ASq61  exp ( ( (( climate4 -  0.61 ) ^ 2 )   /  0.001 ) * -.5)
       set ASq62    exp ( ( (( climate4 -  0.62 ) ^ 2 )   /  0.001 ) * -.5)
       set ASq63    exp ( ( (( climate4 -  0.63 ) ^ 2 )   /  0.001 ) * -.5)
       set ASq64    exp ( ( (( climate4 -  0.64 ) ^ 2 )   /  0.001 ) * -.5)
       set ASq65    exp ( ( (( climate4 -  0.65 ) ^ 2 )   /  0.001 ) * -.5)
       set ASq66    exp ( ( (( climate4 -  0.66 ) ^ 2 )   /  0.001 ) * -.5)
       set ASq67    exp ( ( (( climate4 -  0.67 ) ^ 2 )   /  0.001 ) * -.5)
       set ASq68  exp ( ( (( climate4 -  0.68 ) ^ 2 )   /  0.001 ) * -.5)
       set ASq69  exp ( ( (( climate4 -  0.69 ) ^ 2 )   /  0.001 ) * -.5)
       set ASq70  exp ( ( (( climate4 -  0.70 ) ^ 2 )   /  0.001 ) * -.5)

       set ASq71  exp ( ( (( climate4 -  0.71 ) ^ 2 )   /  0.001 ) * -.5)
       set ASq72  exp ( ( (( climate4 -  0.72 ) ^ 2 )   /  0.001 ) * -.5)
       set ASq73  exp ( ( (( climate4 -  0.73 ) ^ 2 )   /  0.001 ) * -.5)
        set ASq74  exp ( ( (( climate4 -  0.74 ) ^ 2 )   /  0.001 ) * -.5)
       set ASq75  exp ( ( (( climate4 -  0.75 ) ^ 2 )   /  0.001 ) * -.5)
       set ASq76  exp ( ( (( climate4 -  0.76 ) ^ 2 )   /  0.001 ) * -.5)
       set ASq77  exp ( ( (( climate4 -  0.77 ) ^ 2 )   /  0.001 ) * -.5)
       set ASq78  exp ( ( (( climate4 -  0.78 ) ^ 2 )   /  0.001 ) * -.5)
       set ASq79  exp ( ( (( climate4 -  0.79 ) ^ 2 )   /  0.001 ) * -.5)
       set ASq80  exp ( ( (( climate4 -  0.80 ) ^ 2 )   /  0.001 ) * -.5)

       set ASq81  exp ( ( (( climate4 -  0.81 ) ^ 2 )   /  0.001 ) * -.5)
       set ASq82  exp ( ( (( climate4 -  0.82 ) ^ 2 )   /  0.001 ) * -.5)
       set ASq83  exp ( ( (( climate4 -  0.83 ) ^ 2 )   /  0.001 ) * -.5)
       set ASq84  exp ( ( (( climate4 -  0.84 ) ^ 2 )   /  0.001 ) * -.5)
       set ASq85  exp ( ( (( climate4 -  0.85 ) ^ 2 )   /  0.001 ) * -.5)
       set ASq86  exp ( ( (( climate4 -  0.86 ) ^ 2 )   /  0.001 ) * -.5)
       set ASq87  exp ( ( (( climate4 -  0.87 ) ^ 2 )   /  0.001 ) * -.5)
       set ASq88  exp ( ( (( climate4 -  0.88 ) ^ 2 )   /  0.001 ) * -.5)
       set ASq89  exp ( ( (( climate4 -  0.89 ) ^ 2 )   /  0.001 ) * -.5)
       set ASq90  exp ( ( (( climate4 -  0.9 ) ^ 2 )   /  0.001 ) * -.5)

       set ASq91  exp ( ( (( climate4 -  0.91 ) ^ 2 )   /  0.001 ) * -.5)
       set ASq92  exp ( ( (( climate4 -  0.92 ) ^ 2 )   /  0.001 ) * -.5)
       set ASq93  exp ( ( (( climate4 -  0.93 ) ^ 2 )   /  0.001 ) * -.5)
       set ASq94  exp ( ( (( climate4 -  0.94 ) ^ 2 )   /  0.001 ) * -.5)
       set ASq95  exp ( ( (( climate4 -  0.95 ) ^ 2 )   /  0.001 ) * -.5)
       set ASq96    exp ( ( (( climate4 -  0.96 ) ^ 2 )   /  0.001 ) * -.5)
       set ASq97    exp ( ( (( climate4 -  0.97 ) ^ 2 )   /  0.001 ) * -.5)
       set ASq98  exp ( ( (( climate4 -  0.98 ) ^ 2 )   /  0.001 ) * -.5)
       set ASq99  exp ( ( (( climate4 -  0.99 ) ^ 2 )   /  0.001 ) * -.5)
       set ASq100  exp ( ( (( climate4 -  1) ^ 2 )   /  0.001 ) * -.5)
; if (pxcor = 99) [print ASq51]



  ]


set seed 550


 reset-ticks
end 

 ; THE SETUP2 SUBROUTINE CREATES THE INITIAL DISTRIBUTION OF SPECIES ON THE PATCHES ACCORDING TO
 ; THEIR RESPONSE TO CLIMATE

to setup2
 random-seed seed
 repeat 5 [
    ask patches   [


          if (random-float 1 < Asq1 ) [ sprout-Sp1s 1 [

             set  size 1 set deathv 0   set age random 100 + 50 set color 5
      ]]

            if (random-float 1 < Asq2 ) [ sprout-Sp2s 1 [

             set  size 1 set deathv 0   set age random 100 + 50 set color 5
           ]]

           if (random-float 1 < Asq3) [  sprout-Sp3s 1 [

             set  size 1 set deathv 0   set age random 100 + 50 set color 5
           ]]


            if (random-float 1 < Asq4) [  sprout-Sp4s 1 [

             set  size 1 set deathv 0   set age random 100 + 50 set color 5
           ]]

           if (random-float 1 < Asq5) [  sprout-Sp5s 1 [

             set  size 1 set deathv 0   set age random 100 + 50 set color 5
           ]]

          if (random-float 1 < Asq6) [   sprout-Sp6s 1 [

             set  size 1 set deathv 0   set age random 100 + 50 set color 5
           ]]

          if (random-float 1 < Asq7) [   sprout-Sp7s 1 [

             set   size 1   set deathv 0   set age random 100 + 50 set color 5
             ; print 111
           ]]


          if (random-float 1 < Asq8) [   sprout-Sp8s 1 [

             set  size 1 set deathv 0   set age random 100 + 50 set color 5
           ]]

           if (random-float 1 < Asq9) [  sprout-Sp9s 1 [

             set  size 1 set deathv 0   set age random 100 + 50 set color 5
           ]]


          if (random-float 1 < Asq10) [    sprout-Sp10s 1 [

             set  size 1 set deathv 0   set age random 100 + 50 set color 5
            ]]


          if (random-float 1 < Asq11) [    sprout-Sp11s 1 [

             set  size 1 set deathv 0   set age random 100 + 50 set color 15
            ]]

          if (random-float 1 < Asq12) [   sprout-Sp12s 1 [

             set  size 1 set deathv 0   set age random 100 + 50 set color 15
           ]]

          if (random-float 1 < Asq13) [   sprout-Sp13s 1 [

             set  size 1 set deathv 0   set age random 100 + 50 set color 15
             ]   ]

              if (random-float 1 < Asq14) [   sprout-Sp14s 1 [

             set  size 1 set deathv 0   set age random 100 + 50 set color 15
             ]   ]

                 if (random-float 1 < Asq15) [   sprout-Sp15s 1 [

             set  size 1 set deathv 0   set age random 100 + 50 set color 15
             ]   ]

                    if (random-float 1 < Asq16) [   sprout-Sp16s 1 [

             set  size 1 set deathv 0   set age random 100 + 50 set color 25
             ]   ]

                 if (random-float 1 < Asq17) [   sprout-Sp17s 1 [

             set  size 1 set deathv 0   set age random 100 + 50 set color 25
             ]   ]

                 if (random-float 1 < Asq18) [   sprout-Sp18s 1 [

             set  size 1 set deathv 0   set age random 100 + 50 set color 25
             ]   ]

                          if (random-float 1 < Asq19) [   sprout-Sp19s 1 [

             set  size 1 set deathv 0   set age random 100 + 50 set color 25
             ]   ]

                         if (random-float 1 < Asq20) [   sprout-Sp20s 1 [

             set  size 1 set deathv 0   set age random 100 + 50 set color 25
             ]   ]

                          if (random-float 1 < Asq21) [   sprout-Sp21s 1 [

             set  size 1 set deathv 0   set age random 100 + 50 set color 25
             ]   ]
                         if (random-float 1 < Asq22) [   sprout-Sp22s 1 [

             set  size 1 set deathv 0   set age random 100 + 50 set color 25
             ]   ]

       if (random-float 1 < Asq23 ) [ sprout-Sp23s 1 [

             set  size 1 set deathv 0   set age random 100 + 50 set color 25
          ]]

          if (random-float 1 < Asq24 ) [ sprout-Sp24s 1 [

             set  size 1 set deathv 0   set age random 100 + 50 set color 25
           ]]

            if (random-float 1 < Asq25 ) [ sprout-Sp25s 1 [

             set  size 1 set deathv 0   set age random 100 + 50 set color 25
           ]]

           if (random-float 1 < Asq26) [  sprout-Sp26s 1 [

             set  size 1 set deathv 0   set age random 100 + 50 set color 35
           ]]


            if (random-float 1 < Asq27) [  sprout-Sp27s 1 [

             set  size 1 set deathv 0   set age random 100 + 50 set color 35
           ]]

           if (random-float 1 < Asq28) [  sprout-Sp28s 1 [

             set  size 1 set deathv 0   set age random 100 + 50 set color 35
           ]]

          if (random-float 1 < Asq29) [   sprout-Sp29s 1 [

             set  size 1 set deathv 0   set age random 100 + 50 set color 35
           ]]

          if (random-float 1 < Asq30) [   sprout-Sp30s 1 [

             set  size 1 set deathv 0   set age random 100 + 50 set color 35
             ; print 111
           ]]


          if (random-float 1 < Asq31) [   sprout-Sp31s 1 [

             set  size 1 set deathv 0   set age random 100 + 50 set color 35
           ]]

           if (random-float 1 < Asq32) [  sprout-Sp32s 1 [

             set  size 1 set deathv 0   set age random 100 + 50 set color 35
           ]]


          if (random-float 1 < Asq33) [    sprout-Sp33s 1 [

             set  size 1 set deathv 0   set age random 100 + 50 set color 35
            ]]

          if (random-float 1 < Asq34) [    sprout-Sp34s 1 [

             set  size 1 set deathv 0   set age random 100 + 50 set color 35
            ]]

          if (random-float 1 < Asq35) [   sprout-Sp35s 1 [

             set  size 1 set deathv 0   set age random 100 + 50 set color 35
           ]]

          if (random-float 1 < Asq36) [   sprout-Sp36s 1 [

             set  size 1 set deathv 0   set age random 100 + 50 set color 45
             ]   ]

              if (random-float 1 < Asq37) [   sprout-Sp37s 1 [

             set  size 1 set deathv 0   set age random 100 + 50 set color 45
             ]   ]

                 if (random-float 1 < Asq38) [   sprout-Sp38s 1 [

             set  size 1 set deathv 0   set age random 100 + 50 set color 45
             ]   ]

                    if (random-float 1 < Asq39) [   sprout-Sp39s 1 [

             set  size 1 set deathv 0   set age random 100 + 50 set color 45
             ]   ]

          if (random-float 1 < Asq40) [   sprout-Sp40s 1 [

             set  size 1 set deathv 0   set age random 100 + 50 set color 45
             ; print 111
           ]]

          if (random-float 1 < Asq41) [   sprout-Sp41s 1 [

             set  size 1 set deathv 0   set age random 100 + 50 set color 45
           ]]

           if (random-float 1 < Asq42) [  sprout-Sp42s 1 [

             set  size 1 set deathv 0   set age random 100 + 50 set color 45
           ]]

          if (random-float 1 < Asq43) [    sprout-Sp43s 1 [

             set  size 1 set deathv 0   set age random 100 + 50 set color 45
            ]]

          if (random-float 1 < Asq44) [    sprout-Sp44s 1 [

             set  size 1 set deathv 0   set age random 100 + 50 set color 45
            ]]

          if (random-float 1 < Asq45) [   sprout-Sp45s 1 [

             set  size 1 set deathv 0   set age random 100 + 50 set color 45
           ]]

          if (random-float 1 < Asq46) [   sprout-Sp46s 1 [

             set  size 1 set deathv 0   set age random 100 + 50 set color 55
             ]   ]

              if (random-float 1 < Asq47) [   sprout-Sp47s 1 [

             set  size 1 set deathv 0   set age random 100 + 50 set color 55
             ]   ]

                 if (random-float 1 < Asq48) [   sprout-Sp48s 1 [

             set  size 1 set deathv 0   set age random 100 + 50 set color 55
             ]   ]

                    if (random-float 1 < Asq49) [   sprout-Sp49s 1 [

             set  size 1 set deathv 0   set age random 100 + 50 set color 55
             ]   ]



          if (random-float 1 < Asq50) [   sprout-Sp50s 1 [

             set  size 1 set deathv 0   set age random 100 + 50 set color 55
             ; print 111
           ]]

          if (random-float 1 < Asq51) [   sprout-Sp51s 1 [

             set  size 1 set deathv 0   set age random 100 + 50 set color 55
           ]]

           if (random-float 1 < Asq52) [  sprout-Sp52s 1 [

             set  size 1 set deathv 0   set age random 100 + 50 set color 55
           ]]

          if (random-float 1 < Asq53) [    sprout-Sp53s 1 [

             set  size 1 set deathv 0   set age random 100 + 50 set color 55
            ]]

          if (random-float 1 < Asq54) [    sprout-Sp54s 1 [

             set  size 1 set deathv 0   set age random 100 + 50 set color 55
            ]]

          if (random-float 1 < Asq55) [   sprout-Sp55s 1 [

             set  size 1 set deathv 0   set age random 100 + 50 set color 55
           ]]

          if (random-float 1 < Asq56) [   sprout-Sp56s 1 [

             set  size 1 set deathv 0   set age random 100 + 50 set color 65
             ]   ]

              if (random-float 1 < Asq57) [   sprout-Sp57s 1 [

             set  size 1 set deathv 0   set age random 100 + 50 set color 65
             ]   ]

                 if (random-float 1 < Asq58) [   sprout-Sp58s 1 [

             set  size 1 set deathv 0   set age random 100 + 50 set color 65
             ]   ]

                    if (random-float 1 < Asq59) [   sprout-Sp59s 1 [

             set  size 1 set deathv 0   set age random 100 + 50 set color 65
             ]   ]

          if (random-float 1 < Asq60) [   sprout-Sp60s 1 [

             set  size 1 set deathv 0   set age random 100 + 50 set color 65
             ; print 111
           ]]

          if (random-float 1 < Asq61) [   sprout-Sp61s 1 [

             set  size 1 set deathv 0   set age random 100 + 50 set color 65
           ]]

           if (random-float 1 < Asq62) [  sprout-Sp62s 1 [

             set  size 1 set deathv 0   set age random 100 + 50 set color 65
           ]]

          if (random-float 1 < Asq63) [    sprout-Sp63s 1 [

             set  size 1 set deathv 0   set age random 100 + 50 set color 65
            ]]

          if (random-float 1 < Asq64) [    sprout-Sp64s 1 [

             set  size 1 set deathv 0   set age random 100 + 50 set color 65
            ]]

          if (random-float 1 < Asq65) [   sprout-Sp65s 1 [

             set  size 1 set deathv 0   set age random 100 + 50 set color 65
           ]]

          if (random-float 1 < Asq66) [   sprout-Sp66s 1 [

             set  size 1 set deathv 0   set age random 100 + 50 set color 75
             ]   ]

              if (random-float 1 < Asq67) [   sprout-Sp67s 1 [

             set  size 1 set deathv 0   set age random 100 + 50 set color 75
             ]   ]

                 if (random-float 1 < Asq68) [   sprout-Sp68s 1 [

             set  size 1 set deathv 0   set age random 100 + 50 set color 75
             ]   ]

                    if (random-float 1 < Asq69) [   sprout-Sp69s 1 [

             set  size 1 set deathv 0   set age random 100 + 50 set color 75
             ]   ]

          if (random-float 1 < Asq70) [   sprout-Sp70s 1 [

             set  size 1 set deathv 0   set age random 100 + 50 set color 75
             ; print 111
           ]]

          if (random-float 1 < Asq71) [   sprout-Sp71s 1 [

             set  size 1 set deathv 0   set age random 100 + 50 set color 75
           ]]

           if (random-float 1 < Asq72) [  sprout-Sp72s 1 [

             set  size 1 set deathv 0   set age random 100 + 50 set color 75
           ]]

          if (random-float 1 < Asq73) [    sprout-Sp73s 1 [

             set  size 1 set deathv 0   set age random 100 + 50 set color 75
            ]]

          if (random-float 1 < Asq74) [    sprout-Sp74s 1 [

             set  size 1 set deathv 0   set age random 100 + 50 set color 75
            ]]

          if (random-float 1 < Asq75) [   sprout-Sp75s 1 [

             set  size 1 set deathv 0   set age random 100 + 50 set color 75
           ]]

          if (random-float 1 < Asq76) [   sprout-Sp76s 1 [

             set  size 1 set deathv 0   set age random 100 + 50 set color 85
             ]   ]

              if (random-float 1 < Asq77) [   sprout-Sp77s 1 [

             set  size 1 set deathv 0   set age random 100 + 50 set color 85
             ]   ]

                 if (random-float 1 < Asq78) [   sprout-Sp78s 1 [

             set  size 1 set deathv 0   set age random 100 + 50 set color 85
             ]   ]

                    if (random-float 1 < Asq79) [   sprout-Sp79s 1 [

             set  size 1 set deathv 0   set age random 100 + 50 set color 85
             ]   ]

          if (random-float 1 < Asq80) [   sprout-Sp80s 1 [

             set  size 1 set deathv 0   set age random 100 + 50 set color 85
           ]]

          if (random-float 1 < Asq81) [   sprout-Sp81s 1 [

             set  size 1 set deathv 0   set age random 100 + 50 set color 85
           ]]

           if (random-float 1 < Asq82) [  sprout-Sp82s 1 [

             set  size 1 set deathv 0   set age random 100 + 50 set color 85
           ]]

          if (random-float 1 < Asq83) [    sprout-Sp83s 1 [

             set  size 1 set deathv 0   set age random 100 + 50 set color 85
            ]]

          if (random-float 1 < Asq84) [    sprout-Sp84s 1 [

             set  size 1 set deathv 0   set age random 100 + 50 set color 85
            ]]

          if (random-float 1 < Asq85) [   sprout-Sp85s 1 [

             set  size 1 set deathv 0   set age random 100 + 50 set color 85
           ]]

          if (random-float 1 < Asq86) [   sprout-Sp86s 1 [

             set  size 1 set deathv 0   set age random 100 + 50 set color 95
             ]   ]

              if (random-float 1 < Asq87) [   sprout-Sp87s 1 [

             set  size 1 set deathv 0   set age random 100 + 50 set color 95
             ]   ]

                 if (random-float 1 < Asq88) [   sprout-Sp88s 1 [

             set  size 1 set deathv 0   set age random 100 + 50 set color 95
             ]   ]

                    if (random-float 1 < Asq89) [   sprout-Sp89s 1 [

             set  size 1 set deathv 0   set age random 100 + 50 set color 95
             ]   ]

          if (random-float 1 < Asq90) [   sprout-Sp90s 1 [

             set  size 1 set deathv 0   set age random 100 + 50 set color 95
             ; print 111
           ]]

          if (random-float 1 < Asq91) [   sprout-Sp91s 1 [

             set  size 1 set deathv 0   set age random 100 + 50 set color 95
           ]]

           if (random-float 1 < Asq92) [  sprout-Sp92s 1 [

             set  size 1 set deathv 0   set age random 100 + 50 set color 95
           ]]

          if (random-float 1 < Asq93) [    sprout-Sp93s 1 [

             set  size 1 set deathv 0   set age random 100 + 50 set color 95
            ]]

          if (random-float 1 < Asq94) [    sprout-Sp94s 1 [

             set  size 1 set deathv 0   set age random 100 + 50 set color 95
            ]]

          if (random-float 1 < Asq95) [   sprout-Sp95s 1 [

             set  size 1 set deathv 0   set age random 100 + 50 set color 95
           ]]

          if (random-float 1 < Asq96) [   sprout-Sp96s 1 [

             set  size 1 set deathv 0   set age random 100 + 50 set color 105
             ]   ]

              if (random-float 1 < Asq97) [   sprout-Sp97s 1 [

             set  size 1 set deathv 0   set age random 100 + 50 set color 105
             ]   ]

                 if (random-float 1 < Asq98) [   sprout-Sp98s 1 [

             set  size 1 set deathv 0   set age random 100 + 50 set color 105
             ]   ]

                    if (random-float 1 < Asq99) [   sprout-Sp99s 1 [

             set  size 1 set deathv 0   set age random 100 + 50 set color 105
             ]   ]

                    if (random-float 1 < Asq100) [   sprout-Sp100s 1 [

             set  size 1 set deathv 0   set age random 100 + 50 set color 105
             ]   ]

    ]

  ; A LIMIT OF 10 INDIVIDUALS PER PATCH IS MAINTAINED
     ask turtles [

     if (count other turtles-here > limit) [  die]


  ]



 set counterN count turtles


  ]

;outcount2

 reset-ticks
end 

 ; THE PROGO SUBROUTINE CALLS THE PROCEDURES THAT EXECUTE THE PROGRAM AND PRINTS THE RESULTS IN THE
  ; OBSERVER BLOCK OF THE gui

to progo
random-seed seed + 50
  set year  0

  repeat 200 [
    ager
    ask turtles [
      if (count other turtles-here > limit) [ die]
      ]


 if (year > 50 AND year < 151 ) [
      shrink
     ; print mean [ASQA5] of patches
    ]

   ; if year = 201 [ outcount3]

    compete
    estab

     ubi

    death




 ;if year = 200 [
    rich
    print gamma
  ;  ]

    tick
  ]
    outcount1
 ; outcount3
end 

to ager

    set year  year + 1
    ask turtles [set age age + 1]





    ask patches [
    set habitat 1
    if count turtles-here = 0 [set habitat 0]

  ]
  set counterQ count patches with [habitat = 1]
end 

 ; THE COMPETE  SUBROUTINE CREATES A MODIFIER THAT MULTIPLIES Rix BASED ON PATCH DENSITY

to compete
random-seed seed + 100
 ask patches [
    set roomA 1
    ;if (count turtles-here = 0) [set room 1]
    if (count turtles-here > 0) [
      set roomA 1 - .05 * count turtles-here
      set roomD 1 - .02 * count turtles-here
      set roomR 1 - .1 * count turtles-here


  ]
  ]
    ask patches [
 ; if (pxcor = 0) [print room]
set ASqR1  ASq1 * roomR

       set ASqR2  ASq2 * roomR
       set ASqR3  ASq3 * roomR
       set ASqR4  ASq4 * roomR
       set ASqR5  ASq5 * roomR
       set ASqR6  ASq6 * roomR
       set ASqR7  ASq7 * roomR
       set ASqR8  ASq8 * roomR
       set ASqR9  ASq9 * roomR
       set ASqR10  ASq10 * roomR

       set ASQR11  ASq11 * roomR
       set ASQR12  ASq12 * roomR
       set ASQR13  ASq13 * roomR
        set ASQR14  ASq14 * roomR
       set ASQR15  ASq15 * roomR
       set ASQR16  ASq16 * roomR
       set ASQR17  ASq17 * roomR
       set ASQR18  ASq18 * roomR
       set ASQR19  ASq19 * roomR
       set ASQR20  ASq20 * roomR

       set ASQR21  ASq21 * roomR
       set ASQR22  ASq22 * roomR
       set ASQR23  ASq23 * roomR
       set ASQR24  ASq24 * roomR
       set ASQR25  ASq25 * roomR
       set ASQR26  ASq26 * roomR
       set ASQR27  ASq27 * roomR
       set ASQR28  ASq28 * roomR
       set ASQR29  ASq29 * roomR
       set ASQR30  ASq30 * roomR

       set ASQR31  ASq31 * roomR

       set ASQR32  ASq32 * roomR
       set ASQR33  ASq33 * roomR
       set ASQR34  ASq34 * roomR
       set ASQR35  ASq35 * roomR
       set ASQR36  ASq36   * roomR
       set ASQR37  ASq37   * roomR
       set ASQR38  ASq38 * roomR
       set ASQR39  ASq39 * roomR
       set ASQR40  ASq40 * roomR

       set ASQR41  ASq41 * roomR
       set ASQR42  ASq42   * roomR
       set ASQR43  ASq43   * roomR
       set ASQR44  ASq44   * roomR
       set ASQR45  ASq45   * roomR
       set ASQR46  ASq46   * roomR
       set ASQR47  ASq47   * roomR
       set ASQR48  ASq48 * roomR
       set ASQR49  ASq49 * roomR
       set ASQR50  ASq50 * roomR

       set ASQR51  ASq51 * roomR
       set ASQR52  ASq52   * roomR
       set ASQR53  ASq53   * roomR
       set ASQR54  ASq54   * roomR
       set ASQR55  ASq55   * roomR
       set ASQR56  ASq56   * roomR
       set ASQR57  ASq57   * roomR
       set ASQR58  ASq58 * roomR
       set ASqR59 ASq59 * roomR
       set ASQR60  ASq60 * roomR

       set ASQR61  ASq61 * roomR
       set ASQR62  ASq62   * roomR
       set ASQR63  ASq63   * roomR
       set ASQR64  ASq64   * roomR
       set ASQR65  ASq65   * roomR
       set ASQR66  ASq66   * roomR
       set ASQR67  ASq67   * roomR
       set ASQR68  ASq68 * roomR
       set ASQR69  ASq69 * roomR
       set ASQR70  ASq70 * roomR

       set ASQR71  ASq71 * roomR
       set ASQR72  ASq72 * roomR
       set ASQR73  ASq73 * roomR
        set ASQR74  ASq74 * roomR
       set ASQR75 ASq75 * roomR
       set ASQR76  ASq76 * roomR
       set ASQR77  ASq77 * roomR
       set ASQR78  ASq78 * roomR
       set ASQR79  ASq79 * roomR
       set ASQR80  ASq80 * roomR

       set ASQR81  ASq81 * roomR
       set ASQR82  ASq82 * roomR
       set ASQR83  ASq83 * roomR
       set ASQR84  ASq84 * roomR
       set ASQR85  ASq85 * roomR
       set ASQR86  ASq86 * roomR
       set ASQR87  ASq87 * roomR
       set ASQR88  ASq88 * roomR
       set ASQR89  ASq89 * roomR
       set ASQR90  ASq90 * roomR

       set ASQR91  ASq91 * roomR
       set ASQR92  ASq92 * roomR
       set ASQR93  ASq93 * roomR
       set ASQR94  ASq94 * roomR
       set ASQR95  ASq95 * roomR
       set ASQR96  ASq96   * roomR
       set ASQR97  ASq97   * roomR
       set ASQR98  ASq98 * roomR
       set ASQR99  ASq99 * roomR
       set ASqR100  ASq100 * roomR



set ASqD1  ASq1 * roomD

       set ASqD2  ASq2 * roomD
       set ASqD3  ASq3 * roomD
       set ASqD4  ASq4 * roomD
       set ASqD5  ASq5 * roomD
       set ASqD6  ASq6 * roomD
       set ASqD7  ASq7 * roomD
       set ASqD8  ASq8 * roomD
       set ASqD9  ASq9 * roomD
       set ASqD10  ASq10 * roomD

       set ASqD11  ASq11 * roomD
       set ASqD12  ASq12 * roomD
       set ASqD13  ASq13 * roomD
        set ASqD14  ASq14 * roomD
       set ASqD15  ASq15 * roomD
       set ASqD16  ASq16 * roomD
       set ASqD17  ASq17 * roomD
       set ASqD18  ASq18 * roomD
       set ASqD19  ASq19 * roomD
       set ASqD20  ASq20 * roomD

       set ASqD21  ASq21 * roomD
       set ASqD22  ASq22 * roomD
       set ASqD23  ASq23 * roomD
       set ASqD24  ASq24 * roomD
       set ASqD25  ASq25 * roomD
       set ASqD26  ASq26 * roomD
       set ASqD27  ASq27 * roomD
       set ASqD28  ASq28 * roomD
       set ASqD29  ASq29 * roomD
       set ASqD30  ASq30 * roomD

       set ASqD31  ASq31 * roomD

       set ASqD32  ASq32 * roomD
       set ASqD33  ASq33 * roomD
       set ASqD34  ASq34 * roomD
       set ASqD35  ASq35 * roomD
       set ASqD36  ASq36   * roomD
       set ASqD37  ASq37   * roomD
       set ASqD38  ASq38 * roomD
       set ASqD39  ASq39 * roomD
       set ASqD40  ASq40 * roomD

       set ASqD41  ASq41 * roomD
       set ASqD42  ASq42   * roomD
       set ASqD43  ASq43   * roomD
       set ASqD44  ASq44   * roomD
       set ASqD45  ASq45   * roomD
       set ASqD46  ASq46   * roomD
       set ASqD47  ASq47   * roomD
       set ASqD48  ASq48 * roomD
       set ASqD49  ASq49 * roomD
       set ASqD50  ASq50 * roomD

       set ASqD51  ASq51 * roomD
       set ASqD52  ASq52   * roomD
       set ASqD53  ASq53   * roomD
       set ASqD54  ASq54   * roomD
       set ASqD55  ASq55   * roomD
       set ASqD56  ASq56   * roomD
       set ASqD57  ASq57   * roomD
       set ASqD58  ASq58 * roomD
       set ASqD59 ASq59 * roomD
       set ASqD60  ASq60 * roomD

       set ASqD61  ASq61 * roomD
       set ASqD62  ASq62   * roomD
       set ASqD63  ASq63   * roomD
       set ASqD64  ASq64   * roomD
       set ASqD65  ASq65   * roomD
       set ASqD66  ASq66   * roomD
       set ASqD67  ASq67   * roomD
       set ASqD68  ASq68 * roomD
       set ASqD69  ASq69 * roomD
       set ASqD70  ASq70 * roomD

       set ASqD71  ASq71 * roomD
       set ASqD72  ASq72 * roomD
       set ASqD73  ASq73 * roomD
        set ASqD74  ASq74 * roomD
       set ASqD75 ASq75 * roomD
       set ASqD76  ASq76 * roomD
       set ASqD77  ASq77 * roomD
       set ASqD78  ASq78 * roomD
       set ASqD79  ASq79 * roomD
       set ASqD80  ASq80 * roomD

       set ASqD81  ASq81 * roomD
       set ASqD82  ASq82 * roomD
       set ASqD83  ASq83 * roomD
       set ASqD84  ASq84 * roomD
       set ASqD85  ASq85 * roomD
       set ASqD86  ASq86 * roomD
       set ASqD87  ASq87 * roomD
       set ASqD88  ASq88 * roomD
       set ASqD89  ASq89 * roomD
       set ASqD90  ASq90 * roomD

       set ASqD91  ASq91 * roomD
       set ASqD92  ASq92 * roomD
       set ASqD93  ASq93 * roomD
       set ASqD94  ASq94 * roomD
       set ASqD95  ASq95 * roomD
       set ASqD96  ASq96   * roomD
       set ASqD97  ASq97   * roomD
       set ASqD98  ASq98 * roomD
       set ASqD99  ASq99 * roomD
       set ASqD100  ASq100 * roomD

  ]
end 


 ; THE SHRINK SUBROUTINE RESETS Rix AS CLIMATE CHANGES
  ; IF REFUGE !=O THE VALUE USED DETERMINES THE BUFFER EFFECTIVENESS

to shrink

  ; THE CHANGE FOR THE SLOPE IS 0.005 / YR
  ; THE CHANGES TO ADD TO THE REFUGIA DEPEND ON BUFFER EFFECTIVENESS:
  ; 100%  0
  ;  90%  0.0005
  ;  80%  0.001
  ;  70%  0.0015
  ;  60%  0.002
  ;  50%  0.0025
  ;  40%  0.003
  ;  30%  0.0035
  ;  20%  0.004
  ;  10%  0.0045
  ;   0%  0.005

    ask patches [
     ; print climate1
    ifelse (refuge = 0) [set climate4 climate4 + 0.005]
    [set climate4 climate4 + 0.0025] ;.5b

  ; [set climate4 climate4 + 0.00125]
    ;set climate4 climate4 + 0.005
  ]
      ;print climate1
        ;set habitat

    ask patches [

   set ASq1  exp ( ( (( climate4 -  0.01 ) ^ 2 )   /  0.001 ) * -.5)
       set ASq2  exp ( ( (( climate4 -  0.02 ) ^ 2 )   /  0.001 ) * -.5)

       set ASq3  exp ( ( (( climate4 -  0.03 ) ^ 2 )   /  0.001 ) * -.5)
       set ASq4  exp ( ( (( climate4 -  0.04 ) ^ 2 )   /  0.001 ) * -.5)
       set ASq5  exp ( ( (( climate4 -  0.05 ) ^ 2 )   /  0.001 ) * -.5)
       set ASq6  exp ( ( (( climate4 -  0.06 ) ^ 2 )   /  0.001 ) * -.5)
       set ASq7  exp ( ( (( climate4 -  0.07 ) ^ 2 )   /  0.001 ) * -.5)
       set ASq8  exp ( ( (( climate4 -  0.08 ) ^ 2 )   /  0.001 ) * -.5)
       set ASq9  exp ( ( (( climate4 -  0.09 ) ^ 2 )   /  0.001 ) * -.5)
       set ASq10  exp ( ( (( climate4 -  0.1 ) ^ 2 )   /  0.001 ) * -.5)

       set ASq11  exp ( ( (( climate4 -  0.11 ) ^ 2 )   /  0.001 ) * -.5)
       set ASq12  exp ( ( (( climate4 -  0.12 ) ^ 2 )   /  0.001 ) * -.5)
       set ASq13  exp ( ( (( climate4 -  0.13 ) ^ 2 )   /  0.001 ) * -.5)
        set ASq14  exp ( ( (( climate4 -  0.14 ) ^ 2 )   /  0.001 ) * -.5)
       set ASq15  exp ( ( (( climate4 -  0.15 ) ^ 2 )   /  0.001 ) * -.5)
       set ASq16  exp ( ( (( climate4 -  0.16 ) ^ 2 )   /  0.001 ) * -.5)
       set ASq17  exp ( ( (( climate4 -  0.17 ) ^ 2 )   /  0.001 ) * -.5)
       set ASq18  exp ( ( (( climate4 -  0.18 ) ^ 2 )   /  0.001 ) * -.5)
       set ASq19  exp ( ( (( climate4 -  0.19 ) ^ 2 )   /  0.001 ) * -.5)
       set ASq20  exp ( ( (( climate4 -  0.2 ) ^ 2 )   /  0.001 ) * -.5)

       set ASq21  exp ( ( (( climate4 -  0.21 ) ^ 2 )   /  0.001 ) * -.5)
       set ASq22  exp ( ( (( climate4 -  0.22 ) ^ 2 )   /  0.001 ) * -.5)
       set ASq23  exp ( ( (( climate4 -  0.23 ) ^ 2 )   /  0.001 ) * -.5)
       set ASq24  exp ( ( (( climate4 -  0.24 ) ^ 2 )   /  0.001 ) * -.5)
       set ASq25  exp ( ( (( climate4 -  0.25 ) ^ 2 )   /  0.001 ) * -.5)
       set ASq26  exp ( ( (( climate4 -  0.26 ) ^ 2 )   /  0.001 ) * -.5)
       set ASq27  exp ( ( (( climate4 -  0.27 ) ^ 2 )   /  0.001 ) * -.5)
       set ASq28  exp ( ( (( climate4 -  0.28 ) ^ 2 )   /  0.001 ) * -.5)
       set ASq29  exp ( ( (( climate4 -  0.29 ) ^ 2 )   /  0.001 ) * -.5)
       set ASq30  exp ( ( (( climate4 -  0.39 ) ^ 2 )   /  0.001 ) * -.5)

       set ASq31  exp ( ( (( climate4 -  0.31 ) ^ 2 )   /  0.001 ) * -.5)

       set ASq32  exp ( ( (( climate4 -  0.32 ) ^ 2 )   /  0.001 ) * -.5)
       set ASq33  exp ( ( (( climate4 -  0.33 ) ^ 2 )   /  0.001 ) * -.5)
       set ASq34  exp ( ( (( climate4 -  0.34 ) ^ 2 )   /  0.001 ) * -.5)
       set ASq35  exp ( ( (( climate4 -  0.35 ) ^ 2 )   /  0.001 ) * -.5)
       set ASq36    exp ( ( (( climate4 -  0.36 ) ^ 2 )   /  0.001 ) * -.5)
       set ASq37    exp ( ( (( climate4 -  0.37 ) ^ 2 )   /  0.001 ) * -.5)
       set ASq38  exp ( ( (( climate4 -  0.38 ) ^ 2 )   /  0.001 ) * -.5)
       set ASq39  exp ( ( (( climate4 -  0.39 ) ^ 2 )   /  0.001 ) * -.5)
       set ASq40  exp ( ( (( climate4 -  0.40 ) ^ 2 )   /  0.001 ) * -.5)

       set ASq41  exp ( ( (( climate4 -  0.41 ) ^ 2 )   /  0.001 ) * -.5)
       set ASq42    exp ( ( (( climate4 -  0.42 ) ^ 2 )   /  0.001 ) * -.5)
       set ASq43    exp ( ( (( climate4 -  0.43 ) ^ 2 )   /  0.001 ) * -.5)
       set ASq44    exp ( ( (( climate4 -  0.44 ) ^ 2 )   /  0.001 ) * -.5)
       set ASq45    exp ( ( (( climate4 -  0.45 ) ^ 2 )   /  0.001 ) * -.5)
       set ASq46    exp ( ( (( climate4 -  0.46 ) ^ 2 )   /  0.001 ) * -.5)
       set ASq47    exp ( ( (( climate4 -  0.47 ) ^ 2 )   /  0.001 ) * -.5)
       set ASq48    exp ( ( (( climate4 -  0.48 ) ^ 2 )   /  0.001 ) * -.5 )
       set ASq49    exp ( ( (( climate4 -  0.49 ) ^ 2 )   /  0.001 ) * -.5 )
       set ASq50    exp ( ( (( climate4 -  0.5 ) ^ 2 )   /  0.001 ) * -.5 )
       set ASq51    exp ( ( (( climate4 -  0.51 ) ^ 2 )   /  0.001 ) * -.5 )
       set ASq52    exp ( ( (( climate4 -  0.52 ) ^ 2 )   /  0.001 ) * -.5 )
       set ASq53    exp ( ( (( climate4 -  0.53 ) ^ 2 )   /  0.001 ) * -.5)
       set ASq54    exp ( ( (( climate4 -  0.54 ) ^ 2 )   /  0.001 ) * -.5)
       set ASq55    exp ( ( (( climate4 -  0.55 ) ^ 2 )   /  0.001 ) * -.5)
       set ASq56    exp ( ( (( climate4 -  0.56 ) ^ 2 )   /  0.001 ) * -.5)
       set ASq57    exp ( ( (( climate4 -  0.57 ) ^ 2 )   /  0.001 ) * -.5)
       set ASq58  exp ( ( (( climate4 -  0.58 ) ^ 2 )   /  0.001 ) * -.5)
       set ASq59  exp ( ( (( climate4 -  0.59 ) ^ 2 )   /  0.001 ) * -.5)
       set ASq60  exp ( ( (( climate4 -  0.60 ) ^ 2 )   /  0.001 ) * -.5)

       set ASq61  exp ( ( (( climate4 -  0.61 ) ^ 2 )   /  0.001 ) * -.5)
       set ASq62    exp ( ( (( climate4 -  0.62 ) ^ 2 )   /  0.001 ) * -.5)
       set ASq63    exp ( ( (( climate4 -  0.63 ) ^ 2 )   /  0.001 ) * -.5)
       set ASq64    exp ( ( (( climate4 -  0.64 ) ^ 2 )   /  0.001 ) * -.5)
       set ASq65    exp ( ( (( climate4 -  0.65 ) ^ 2 )   /  0.001 ) * -.5)
       set ASq66    exp ( ( (( climate4 -  0.66 ) ^ 2 )   /  0.001 ) * -.5)
       set ASq67    exp ( ( (( climate4 -  0.67 ) ^ 2 )   /  0.001 ) * -.5)
       set ASq68  exp ( ( (( climate4 -  0.68 ) ^ 2 )   /  0.001 ) * -.5)
       set ASq69  exp ( ( (( climate4 -  0.69 ) ^ 2 )   /  0.001 ) * -.5)
       set ASq70  exp ( ( (( climate4 -  0.70 ) ^ 2 )   /  0.001 ) * -.5)

       set ASq71  exp ( ( (( climate4 -  0.71 ) ^ 2 )   /  0.001 ) * -.5)
       set ASq72  exp ( ( (( climate4 -  0.72 ) ^ 2 )   /  0.001 ) * -.5)
       set ASq73  exp ( ( (( climate4 -  0.73 ) ^ 2 )   /  0.001 ) * -.5)
        set ASq74  exp ( ( (( climate4 -  0.74 ) ^ 2 )   /  0.001 ) * -.5)
       set ASq75  exp ( ( (( climate4 -  0.75 ) ^ 2 )   /  0.001 ) * -.5)
       set ASq76  exp ( ( (( climate4 -  0.76 ) ^ 2 )   /  0.001 ) * -.5)
       set ASq77  exp ( ( (( climate4 -  0.77 ) ^ 2 )   /  0.001 ) * -.5)
       set ASq78  exp ( ( (( climate4 -  0.78 ) ^ 2 )   /  0.001 ) * -.5)
       set ASq79  exp ( ( (( climate4 -  0.79 ) ^ 2 )   /  0.001 ) * -.5)
       set ASq80  exp ( ( (( climate4 -  0.80 ) ^ 2 )   /  0.001 ) * -.5)

       set ASq81  exp ( ( (( climate4 -  0.81 ) ^ 2 )   /  0.001 ) * -.5)
       set ASq82  exp ( ( (( climate4 -  0.82 ) ^ 2 )   /  0.001 ) * -.5)
       set ASq83  exp ( ( (( climate4 -  0.83 ) ^ 2 )   /  0.001 ) * -.5)
       set ASq84  exp ( ( (( climate4 -  0.84 ) ^ 2 )   /  0.001 ) * -.5)
       set ASq85  exp ( ( (( climate4 -  0.85 ) ^ 2 )   /  0.001 ) * -.5)
       set ASq86  exp ( ( (( climate4 -  0.86 ) ^ 2 )   /  0.001 ) * -.5)
       set ASq87  exp ( ( (( climate4 -  0.87 ) ^ 2 )   /  0.001 ) * -.5)
       set ASq88  exp ( ( (( climate4 -  0.88 ) ^ 2 )   /  0.001 ) * -.5)
       set ASq89  exp ( ( (( climate4 -  0.89 ) ^ 2 )   /  0.001 ) * -.5)
       set ASq90  exp ( ( (( climate4 -  0.9 ) ^ 2 )   /  0.001 ) * -.5)

       set ASq91  exp ( ( (( climate4 -  0.91 ) ^ 2 )   /  0.001 ) * -.5)
       set ASq92  exp ( ( (( climate4 -  0.92 ) ^ 2 )   /  0.001 ) * -.5)
       set ASq93  exp ( ( (( climate4 -  0.93 ) ^ 2 )   /  0.001 ) * -.5)
       set ASq94  exp ( ( (( climate4 -  0.94 ) ^ 2 )   /  0.001 ) * -.5)
       set ASq95  exp ( ( (( climate4 -  0.95 ) ^ 2 )   /  0.001 ) * -.5)
       set ASq96    exp ( ( (( climate4 -  0.96 ) ^ 2 )   /  0.001 ) * -.5)
       set ASq97    exp ( ( (( climate4 -  0.97 ) ^ 2 )   /  0.001 ) * -.5)
       set ASq98  exp ( ( (( climate4 -  0.98 ) ^ 2 )   /  0.001 ) * -.5)
       set ASq99  exp ( ( (( climate4 -  0.99 ) ^ 2 )   /  0.001 ) * -.5)
       set ASq100  exp ( ( (( climate4 -  1) ^ 2 )   /  0.001 ) * -.5)

  ]

   ; set counterQ count patches with [climate1 > 0 AND climate1 < 1]
   ; set HRange max [climate1] of patches - min [climate1] of patches
    ;    set HVar standard-deviation [climate1] of patches with [clim
;    ask patches [
 ;  set pcolor scale-color orange climate4 0 100
  ; climate1
 ; ]
end 


 ; THE ESTAB SUBROUTINE SPROUTS AN INDIVIDUAL OF A DISPERSAL LIMITED SPECIES ON A NEARBY PATCH
  ; IF IT HAS A SUITABLE CLIMATE. UBIQUITOUS DISPERSING SPECIES SPROUT EVERYWHERE IF ONE IS AT LEAST 6 YR OLD
 ; THESE NEW SEEDLINGS DIE AT A HIGH RATE BY CALLING A DEATH3 SUBROUTINE

to estab
  random-seed seed + 150
 set randyr 0.8
  ask patches [
     if (count turtles-here < limit) [
      if (count Sp1s in-radius 3.19 > 0) [sprout-Sp1s 1 [set size 1 set deathv 1  set age 0 set color pink ]]
        if (count Sp3s in-radius 3.19 > 0) [sprout-Sp3s 1 [set size 1 set deathv 1  set age 0 set color pink ]]
      if (count Sp5s in-radius 3.19 > 0) [sprout-Sp5s 1 [set size 1 set deathv 1  set age 0 set color pink ]]
       if (count Sp7s in-radius 3.19 > 0) [sprout-Sp7s 1 [set size 1 set deathv 1  set age 0 set color pink ]]
          if (count Sp9s in-radius 3.19 > 0) [sprout-Sp9s 1 [set size 1 set deathv 1  set age 0 set color pink ]]
       if (count Sp11s in-radius 3.19 > 0) [sprout-Sp11s 1 [set size 1 set deathv 1  set age 0 set color pink ]]
       if (count Sp13s in-radius 3.19 > 0) [sprout-Sp13s 1 [set size 1 set deathv 1  set age 0 set color pink ]]
          if (count Sp15s in-radius 3.19 > 0) [sprout-Sp15s 1 [set size 1 set deathv 1  set age 0 set color pink ]]
       if (count Sp17s in-radius 3.19 > 0) [sprout-Sp17s 1 [set size 1 set deathv 1  set age 0 set color pink ]]
          if (count Sp19s in-radius 3.19 > 0) [sprout-Sp19s 1 [set size 1 set deathv 1  set age 0 set color pink ]]
       if (count Sp21s in-radius 3.19 > 0) [sprout-Sp21s 1 [set size 1 set deathv 1  set age 0 set color pink ]]
          if (count Sp23s in-radius 3.19 > 0) [sprout-Sp23s 1 [set size 1 set deathv 1  set age 0 set color pink ]]
       if (count Sp25s in-radius 3.19 > 0) [sprout-Sp25s 1 [set size 1 set deathv 1  set age 0 set color pink ]]
          if (count Sp27s in-radius 3.19 > 0) [sprout-Sp27s 1 [set size 1 set deathv 1  set age 0 set color pink ]]
       if (count Sp29s in-radius 3.19 > 0) [sprout-Sp29s 1 [set size 1 set deathv 1  set age 0 set color pink ]]
          if (count Sp31s in-radius 3.19 > 0) [sprout-Sp31s 1 [set size 1 set deathv 1  set age 0 set color pink ]]
       if (count Sp33s in-radius 3.19 > 0) [sprout-Sp33s 1 [set size 1 set deathv 1  set age 0 set color pink ]]
          if (count Sp35s in-radius 3.19 > 0) [sprout-Sp35s 1 [set size 1 set deathv 1  set age 0 set color pink ]]
       if (count Sp37s in-radius 3.19 > 0) [sprout-Sp37s 1 [set size 1 set deathv 1  set age 0 set color pink ]]
          if (count Sp39s in-radius 3.19 > 0) [sprout-Sp39s 1 [set size 1 set deathv 1  set age 0 set color pink ]]
       if (count Sp41s in-radius 3.19 > 0) [sprout-Sp41s 1 [set size 1 set deathv 1  set age 0 set color pink ]]
          if (count Sp43s in-radius 3.19 > 0) [sprout-Sp43s 1 [set size 1 set deathv 1  set age 0 set color pink ]]
       if (count Sp45s in-radius 3.19 > 0) [sprout-Sp45s 1 [set size 1 set deathv 1  set age 0 set color pink ]]
          if (count Sp47s in-radius 3.19 > 0) [sprout-Sp47s 1 [set size 1 set deathv 1  set age 0 set color pink ]]
       if (count Sp49s in-radius 3.19 > 0) [sprout-Sp49s 1 [set size 1 set deathv 1  set age 0 set color pink ]]
       if (count Sp51s in-radius 3.19 > 0) [sprout-Sp51s 1 [set size 1 set deathv 1  set age 0 set color pink ]]
          if (count Sp53s in-radius 3.19 > 0) [sprout-Sp53s 1 [set size 1 set deathv 1  set age 0 set color pink ]]
       if (count Sp55s in-radius 3.19 > 0) [sprout-Sp55s 1 [set size 1 set deathv 1  set age 0 set color pink ]]
          if (count Sp57s in-radius 3.19 > 0) [sprout-Sp57s 1 [set size 1 set deathv 1  set age 0 set color pink ]]
       if (count Sp59s in-radius 3.19 > 0) [sprout-Sp59s 1 [set size 1 set deathv 1  set age 0 set color pink ]]
          if (count Sp61s in-radius 3.19 > 0) [sprout-Sp61s 1 [set size 1 set deathv 1  set age 0 set color pink ]]
       if (count Sp63s in-radius 3.19 > 0) [sprout-Sp63s 1 [set size 1 set deathv 1  set age 0 set color pink ]]
          if (count Sp65s in-radius 3.19 > 0) [sprout-Sp65s 1 [set size 1 set deathv 1  set age 0 set color pink ]]
       if (count Sp67s in-radius 3.19 > 0) [sprout-Sp67s 1 [set size 1 set deathv 1  set age 0 set color pink ]]
          if (count Sp69s in-radius 3.19 > 0) [sprout-Sp69s 1 [set size 1 set deathv 1  set age 0 set color pink ]]
       if (count Sp71s in-radius 3.19 > 0) [sprout-Sp71s 1 [set size 1 set deathv 1  set age 0 set color pink ]]
          if (count Sp73s in-radius 3.19 > 0) [sprout-Sp73s 1 [set size 1 set deathv 1  set age 0 set color pink ]]
       if (count Sp75s in-radius 3.19 > 0) [sprout-Sp75s 1 [set size 1 set deathv 1  set age 0 set color pink ]]
          if (count Sp77s in-radius 3.19 > 0) [sprout-Sp77s 1 [set size 1 set deathv 1  set age 0 set color pink ]]
       if (count Sp79s in-radius 3.19 > 0) [sprout-Sp79s 1 [set size 1 set deathv 1  set age 0 set color pink ]]
       if (count Sp81s in-radius 3.19 > 0) [sprout-Sp81s 1 [set size 1 set deathv 1  set age 0 set color pink ]]
          if (count Sp83s in-radius 3.19 > 0) [sprout-Sp83s 1 [set size 1 set deathv 1  set age 0 set color pink ]]
       if (count Sp85s in-radius 3.19 > 0) [sprout-Sp85s 1 [set size 1 set deathv 1  set age 0 set color pink ]]
          if (count Sp87s in-radius 3.19 > 0) [sprout-Sp87s 1 [set size 1 set deathv 1  set age 0 set color pink ]]
       if (count Sp89s in-radius 3.19 > 0) [sprout-Sp78s 1 [set size 1 set deathv 1  set age 0 set color pink ]]
       if (count Sp91s in-radius 3.19 > 0) [sprout-Sp91s 1 [set size 1 set deathv 1  set age 0 set color pink ]]
          if (count Sp93s in-radius 3.19 > 0) [sprout-Sp93s 1 [set size 1 set deathv 1  set age 0 set color pink ]]
       if (count Sp95s in-radius 3.19 > 0) [sprout-Sp95s 1 [set size 1 set deathv 1  set age 0 set color pink ]]
   if (count Sp97s in-radius 3.19 > 0) [sprout-Sp97s 1 [set size 1 set deathv 1  set age 0 set color pink ]]
       if (count Sp99s in-radius 3.19 > 0) [sprout-Sp99s 1 [set size 1 set deathv 1  set age 0 set color pink ]]

   if (  count Sp100s with [age > 6] > 0  AND  random-float 1 > randyr ) [ sprout-Sp100s 1 [   set size 1 set deathv 1  set age 0 set color pink ]]
   if (  count Sp10s with [age > 6] > 0  AND  random-float 1 > randyr ) [ sprout-Sp10s 1 [   set size 1 set deathv 1  set age 0 set color pink ]]
   if (  count Sp12s with [age > 6] > 0  AND  random-float 1 > randyr ) [ sprout-Sp12s 1 [   set size 1 set deathv 1  set age 0 set color pink ]]
   if (  count Sp14s with [age > 6] > 0  AND  random-float 1 > randyr ) [ sprout-Sp14s 1 [   set size 1 set deathv 1  set age 0 set color pink ]]
   if (  count Sp16s with [age > 6] > 0  AND  random-float 1 > randyr ) [ sprout-Sp16s 1 [   set size 1 set deathv 1  set age 0 set color pink ]]
   if (  count Sp18s with [age > 6] > 0  AND  random-float 1 > randyr ) [ sprout-Sp18s 1 [   set size 1 set deathv 1  set age 0 set color pink ]]
   if (  count Sp20s with [age > 6] > 0  AND  random-float 1 > randyr ) [ sprout-Sp20s 1 [   set size 1 set deathv 1  set age 0 set color pink ]]
   if (  count Sp22s with [age > 6] > 0  AND  random-float 1 > randyr ) [ sprout-Sp22s 1 [   set size 1 set deathv 1  set age 0 set color pink ]]
   if (  count Sp24s with [age > 6] > 0  AND  random-float 1 > randyr ) [ sprout-Sp24s 1 [   set size 1 set deathv 1  set age 0 set color pink ]]
   if (  count Sp26s with [age > 6] > 0  AND  random-float 1 > randyr ) [ sprout-Sp26s 1 [   set size 1 set deathv 1  set age 0 set color pink ]]
   if (  count Sp28s with [age > 6] > 0  AND  random-float 1 > randyr ) [ sprout-Sp28s 1 [   set size 1 set deathv 1  set age 0 set color pink ]]
   if (  count Sp2s with [age > 6] > 0  AND  random-float 1 > randyr ) [ sprout-Sp2s 1 [   set size 1 set deathv 1  set age 0 set color pink ]]
   if (  count Sp30s with [age > 6] > 0  AND  random-float 1 > randyr ) [ sprout-Sp30s 1 [   set size 1 set deathv 1  set age 0 set color pink ]]
   if (  count Sp32s with [age > 6] > 0  AND  random-float 1 > randyr ) [ sprout-Sp32s 1 [   set size 1 set deathv 1  set age 0 set color pink ]]
   if (  count Sp34s with [age > 6] > 0  AND  random-float 1 > randyr ) [ sprout-Sp34s 1 [   set size 1 set deathv 1  set age 0 set color pink ]]
   if (  count Sp36s with [age > 6] > 0  AND  random-float 1 > randyr ) [ sprout-Sp36s 1 [   set size 1 set deathv 1  set age 0 set color pink ]]
   if (  count Sp38s with [age > 6] > 0  AND  random-float 1 > randyr ) [ sprout-Sp38s 1 [   set size 1 set deathv 1  set age 0 set color pink ]]
   if (  count Sp40s with [age > 6] > 0  AND  random-float 1 > randyr ) [ sprout-Sp40s 1 [   set size 1 set deathv 1  set age 0 set color pink ]]
   if (  count Sp42s with [age > 6] > 0  AND  random-float 1 > randyr ) [ sprout-Sp42s 1 [   set size 1 set deathv 1  set age 0 set color pink ]]
   if (  count Sp44s with [age > 6] > 0  AND  random-float 1 > randyr ) [ sprout-Sp44s 1 [   set size 1 set deathv 1  set age 0 set color pink ]]
   if (  count Sp46s with [age > 6] > 0  AND  random-float 1 > randyr ) [ sprout-Sp46s 1 [   set size 1 set deathv 1  set age 0 set color pink ]]
   if (  count Sp48s with [age > 6] > 0  AND  random-float 1 > randyr ) [ sprout-Sp48s 1 [   set size 1 set deathv 1  set age 0 set color pink ]]
   if (  count Sp4s with [age > 6] > 0  AND  random-float 1 > randyr ) [ sprout-Sp4s 1 [   set size 1 set deathv 1  set age 0 set color pink ]]
   if (  count Sp50s with [age > 6] > 0  AND  random-float 1 > randyr ) [ sprout-Sp50s 1 [   set size 1 set deathv 1  set age 0 set color pink ]]
   if (  count Sp52s with [age > 6] > 0  AND  random-float 1 > randyr ) [ sprout-Sp52s 1 [   set size 1 set deathv 1  set age 0 set color pink ]]
   if (  count Sp54s with [age > 6] > 0  AND  random-float 1 > randyr ) [ sprout-Sp54s 1 [   set size 1 set deathv 1  set age 0 set color pink ]]
   if (  count Sp56s with [age > 6] > 0  AND  random-float 1 > randyr ) [ sprout-Sp56s 1 [   set size 1 set deathv 1  set age 0 set color pink ]]
   if (  count Sp58s with [age > 6] > 0  AND  random-float 1 > randyr ) [ sprout-Sp58s 1 [   set size 1 set deathv 1  set age 0 set color pink ]]
   if (  count Sp60s with [age > 6] > 0  AND  random-float 1 > randyr ) [ sprout-Sp60s 1 [   set size 1 set deathv 1  set age 0 set color pink ]]
   if (  count Sp62s with [age > 6] > 0  AND  random-float 1 > randyr ) [ sprout-Sp62s 1 [   set size 1 set deathv 1  set age 0 set color pink ]]
   if (  count Sp64s with [age > 6] > 0  AND  random-float 1 > randyr ) [ sprout-Sp64s 1 [   set size 1 set deathv 1  set age 0 set color pink ]]
   if (  count Sp66s with [age > 6] > 0  AND  random-float 1 > randyr ) [ sprout-Sp66s 1 [   set size 1 set deathv 1  set age 0 set color pink ]]
   if (  count Sp68s with [age > 6] > 0  AND  random-float 1 > randyr ) [ sprout-Sp68s 1 [   set size 1 set deathv 1  set age 0 set color pink ]]
   if (  count Sp6s with [age > 6] > 0  AND  random-float 1 > randyr ) [ sprout-Sp6s 1 [   set size 1 set deathv 1  set age 0 set color pink ]]
   if (  count Sp70s with [age > 6] > 0  AND  random-float 1 > randyr ) [ sprout-Sp70s 1 [   set size 1 set deathv 1  set age 0 set color pink ]]
   if (  count Sp72s with [age > 6] > 0  AND  random-float 1 > randyr ) [ sprout-Sp72s 1 [   set size 1 set deathv 1  set age 0 set color pink ]]
   if (  count Sp74s with [age > 6] > 0  AND  random-float 1 > randyr ) [ sprout-Sp74s 1 [   set size 1 set deathv 1  set age 0 set color pink ]]
   if (  count Sp76s with [age > 6] > 0  AND  random-float 1 > randyr ) [ sprout-Sp76s 1 [   set size 1 set deathv 1  set age 0 set color pink ]]
   if (  count Sp78s with [age > 6] > 0  AND  random-float 1 > randyr ) [ sprout-Sp78s 1 [   set size 1 set deathv 1  set age 0 set color pink ]]
   if (  count Sp80s with [age > 6] > 0  AND  random-float 1 > randyr ) [ sprout-Sp80s 1 [   set size 1 set deathv 1  set age 0 set color pink ]]
   if (  count Sp82s with [age > 6] > 0  AND  random-float 1 > randyr ) [ sprout-Sp82s 1 [   set size 1 set deathv 1  set age 0 set color pink ]]
   if (  count Sp84s with [age > 6] > 0  AND  random-float 1 > randyr ) [ sprout-Sp84s 1 [   set size 1 set deathv 1  set age 0 set color pink ]]
   if (  count Sp86s with [age > 6] > 0  AND  random-float 1 > randyr ) [ sprout-Sp86s 1 [   set size 1 set deathv 1  set age 0 set color pink ]]
   if (  count Sp88s with [age > 6] > 0  AND  random-float 1 > randyr ) [ sprout-Sp88s 1 [   set size 1 set deathv 1  set age 0 set color pink ]]
   if (  count Sp8s with [age > 6] > 0  AND  random-float 1 > randyr ) [ sprout-Sp8s 1 [   set size 1 set deathv 1  set age 0 set color pink ]]
   if (  count Sp90s with [age > 6] > 0  AND  random-float 1 > randyr ) [ sprout-Sp90s 1 [   set size 1 set deathv 1  set age 0 set color pink ]]
   if (  count Sp92s with [age > 6] > 0  AND  random-float 1 > randyr ) [ sprout-Sp92s 1 [   set size 1 set deathv 1  set age 0 set color pink ]]
   if (  count Sp94s with [age > 6] > 0  AND  random-float 1 > randyr ) [ sprout-Sp94s 1 [   set size 1 set deathv 1  set age 0 set color pink ]]
   if (  count Sp96s with [age > 6] > 0  AND  random-float 1 > randyr ) [ sprout-Sp96s 1 [   set size 1 set deathv 1  set age 0 set color pink ]]
   if (  count Sp98s with [age > 6] > 0  AND  random-float 1 > randyr ) [ sprout-Sp98s 1 [   set size 1 set deathv 1  set age 0 set color pink ]]

]

]



death3
end 

 ; THE DEATH SUBROUTINE KILLS INDIVIDUALS OF AGE > 2, WITH A HIGHER RATE FOR UBIQUITOUS DISPERSING SPECIES

to death
  random-seed seed + 200
 set counterDie10 0
 ask Sp1s [
   if ( age > 2  AND  ASQD1    < random-float 0.079999  ) [ set counterdie10 counterdie10 + 1 die]  ]


 ask Sp2s [
   if ( age > 2  AND  ASQD2   < random-float 0.019999  ) [ set counterdie10 counterdie10 + 1 die]  ]
 ask Sp3s [
   if ( age > 2  AND  ASQD3  < random-float 0.079999 )  [ set counterdie10 counterdie10 + 1 die]  ]
 ask Sp4s [
   if ( age > 2  AND  ASQD4 < random-float 0.019999  )  [ set counterdie10 counterdie10 + 1 die]  ]
 ask Sp5s [
   if ( age > 2  AND  ASQD5  < random-float 0.079999  ) [ set counterdie10 counterdie10 + 1 die]  ]
 ask Sp6s [
   if ( age > 2  AND  ASQD6    < random-float 0.019999  ) [ set  counterdie10 counterdie10 + 1 die]  ]
 ask Sp7s [
   if ( age > 2  AND  ASQD7  < random-float 0.079999  ) [ set counterdie10 counterdie10 + 1 die]  ]
 ask Sp8s [
   if ( age > 2  AND  ASQD8  < random-float 0.019999  ) [ set counterdie10 counterdie10 + 1 die]  ]
 ask Sp9s [
   if ( age > 2  AND  ASQD9  < random-float 0.079999  ) [ set counterdie10 counterdie10 + 1 die]  ]
 ask Sp10s [
   if ( age > 2  AND  ASQD10  < random-float 0.019999  ) [ set counterdie10 counterdie10 + 1 die]  ]
 ask Sp11s [
   if ( age > 2  AND  ASQD11  < random-float 0.079999  ) [ set counterdie10 counterdie10 + 1 die]  ]
 ask Sp12s [
   if ( age > 2  AND  ASQD12  < random-float 0.019999  ) [ set counterdie10 counterdie10 + 1 die]  ]
 ask Sp13s [
   if ( age > 2  AND  ASQD13  < random-float 0.079999  ) [ set counterdie10 counterdie10 + 1 die]  ]
 ask Sp14s [
   if ( age > 2  AND  ASQD14  < random-float 0.019999  ) [ set counterdie10 counterdie10 + 1 die]  ]
 ask Sp15s [
   if ( age > 2  AND  ASQD15  < random-float 0.079999  ) [ set counterdie10 counterdie10 + 1 die]  ]
 ask Sp16s [
   if ( age > 2  AND  ASQD16  < random-float 0.019999  ) [ set counterdie10 counterdie10 + 1 die]  ]
 ask Sp17s [
   if ( age > 2  AND  ASQD17  < random-float 0.079999  ) [ set counterdie10 counterdie10 + 1 die]  ]
 ask Sp18s [
   if ( age > 2  AND  ASQD18  < random-float 0.019999  ) [ set counterdie10 counterdie10 + 1 die]  ]
 ask Sp19s [
   if ( age > 2  AND  ASQD19  < random-float 0.079999  ) [ set counterdie10 counterdie10 + 1 die]  ]
 ask Sp20s [
   if ( age > 2  AND  ASQD20  < random-float 0.019999  ) [ set counterdie10 counterdie10 + 1 die]  ]
 ask Sp21s [
   if ( age > 2  AND  ASQD21  < random-float 0.079999  ) [ set counterdie10 counterdie10 + 1 die]  ]
 ask Sp22s [
   if ( age > 2  AND  ASQD22  < random-float 0.019999  ) [ set counterdie10 counterdie10 + 1 die]  ]
 ask Sp23s [
   if ( age > 2  AND  ASQD23  < random-float 0.079999  ) [ set counterdie10 counterdie10 + 1 die]  ]
 ask Sp24s [
   if ( age > 2  AND  ASQD24  < random-float 0.019999  ) [ set counterdie10 counterdie10 + 1 die]  ]
 ask Sp25s [
   if ( age > 2  AND  ASQD25  < random-float 0.079999  ) [ set counterdie10 counterdie10 + 1 die]  ]
 ask Sp26s [
   if ( age > 2  AND  ASQD26  < random-float 0.019999  ) [ set counterdie10 counterdie10 + 1 die]  ]
 ask Sp27s [
   if ( age > 2  AND  ASQD27  < random-float 0.079999  ) [ set counterdie10 counterdie10 + 1 die]  ]
ask Sp28s [
   if ( age > 2  AND  ASQD28  < random-float 0.019999  ) [ set counterdie10 counterdie10 + 1 die]  ]
 ask Sp29s [
   if ( age > 2  AND  ASQD29  < random-float 0.079999  ) [ set counterdie10 counterdie10 + 1 die]  ]
ask Sp30s [
   if ( age > 2  AND  ASQD30  < random-float 0.019999  ) [ set counterdie10 counterdie10 + 1 die]  ]
 ask Sp31s [
   if ( age > 2  AND  ASQD31  < random-float 0.079999  ) [ set counterdie10 counterdie10 + 1 die]  ]
 ask Sp32s [
   if ( age > 2  AND  ASQD32  < random-float 0.019999  ) [ set counterdie10 counterdie10 + 1 die]  ]
 ask Sp33s [
   if ( age > 2  AND  ASQD33  < random-float 0.079999  ) [ set counterdie10 counterdie10 + 1 die]  ]
 ask Sp34s [
   if ( age > 2  AND  ASQD34  < random-float 0.019999  ) [ set counterdie10 counterdie10 + 1 die]  ]
 ask Sp35s [
   if ( age > 2  AND  ASQD35  < random-float 0.079999  ) [ set counterdie10 counterdie10 + 1 die]  ]
 ask Sp36s [
   if ( age > 2  AND  ASQD36  < random-float 0.019999  ) [ set counterdie10 counterdie10 + 1 die]  ]
 ask Sp37s [
   if ( age > 2  AND  ASQD37  < random-float 0.079999  ) [ set counterdie10 counterdie10 + 1 die]  ]
ask Sp38s [
   if ( age > 2  AND  ASQD38  < random-float 0.019999  ) [ set counterdie10 counterdie10 + 1 die]  ]
 ask Sp39s [
   if ( age > 2  AND  ASQD39  < random-float 0.079999  ) [ set counterdie10 counterdie10 + 1 die]  ]
ask Sp40s [
   if ( age > 2  AND  ASQD40  < random-float 0.019999  ) [ set counterdie10 counterdie10 + 1 die]  ]
 ask Sp41s [
   if ( age > 2  AND  ASQD41  < random-float 0.079999  ) [ set counterdie10 counterdie10 + 1 die]  ]
 ask Sp42s [
   if ( age > 2  AND  ASQD42  < random-float 0.019999  ) [ set counterdie10 counterdie10 + 1 die]  ]
 ask Sp43s [
   if ( age > 2  AND  ASQD43  < random-float 0.079999  ) [ set counterdie10 counterdie10 + 1 die]  ]
 ask Sp44s [
   if ( age > 2  AND  ASQD44  < random-float 0.019999  ) [ set counterdie10 counterdie10 + 1 die]  ]
 ask Sp45s [
   if ( age > 2  AND  ASQD45  < random-float 0.079999  ) [ set counterdie10 counterdie10 + 1 die]  ]
 ask Sp46s [
   if ( age > 2  AND  ASQD46  < random-float 0.019999  ) [ set counterdie10 counterdie10 + 1 die]  ]
 ask Sp47s [
   if ( age > 2  AND  ASQD47  < random-float 0.079999  ) [ set counterdie10 counterdie10 + 1 die]  ]
ask Sp48s [
   if ( age > 2  AND  ASQD48  < random-float 0.019999  ) [ set counterdie10 counterdie10 + 1 die]  ]
 ask Sp49s [
   if ( age > 2  AND  ASQD49  < random-float 0.079999  ) [ set counterdie10 counterdie10 + 1 die]  ]
 ask Sp50s [
   if ( age > 2  AND  ASQD50  < random-float 0.019999  ) [ set counterdie10 counterdie10 + 1 die]  ]
 ask Sp51s [
   if ( age > 2  AND  ASQD51  < random-float 0.079999  ) [ set counterdie10 counterdie10 + 1 die]  ]
 ask Sp52s [
   if ( age > 2  AND  ASQD52  < random-float 0.019999  ) [ set counterdie10 counterdie10 + 1 die]  ]
 ask Sp53s [
   if ( age > 2  AND  ASQD53  < random-float 0.079999  ) [ set counterdie10 counterdie10 + 1 die]  ]
 ask Sp54s [
   if ( age > 2  AND  ASQD54  < random-float 0.019999  ) [ set counterdie10 counterdie10 + 1 die]  ]
 ask Sp55s [
   if ( age > 2  AND  ASQD55  < random-float 0.079999  ) [ set counterdie10 counterdie10 + 1 die]  ]
 ask Sp56s [
   if ( age > 2  AND  ASQD56  < random-float 0.019999  ) [ set counterdie10 counterdie10 + 1 die]  ]
 ask Sp57s [
   if ( age > 2  AND  ASQD57   < random-float 0.079999  ) [ set counterdie10 counterdie10 + 1 die]  ]
 ask Sp58s [
   if ( age > 2  AND  ASQD58  < random-float 0.019999  ) [ set counterdie10 counterdie10 + 1 die]  ]
 ask Sp59s [
   if ( age > 2  AND  ASQD59  < random-float 0.079999  ) [ set counterdie10 counterdie10 + 1 die]  ]
ask Sp60s [
   if ( age > 2  AND  ASQD60  < random-float 0.019999  ) [ set counterdie10 counterdie10 + 1 die]  ]
 ask Sp61s [
   if ( age > 2  AND  ASQD61  < random-float 0.079999  ) [ set counterdie10 counterdie10 + 1 die]  ]
 ask Sp62s [
   if ( age > 2  AND  ASQD62  < random-float 0.019999  ) [ set counterdie10 counterdie10 + 1 die]  ]
 ask Sp63s [
   if ( age > 2  AND  ASQD63  < random-float 0.079999  ) [ set counterdie10 counterdie10 + 1 die]  ]
 ask Sp64s [
   if ( age > 2  AND  ASQD64  < random-float 0.019999  ) [ set counterdie10 counterdie10 + 1 die]  ]
 ask Sp65s [
   if ( age > 2  AND  ASQD65  < random-float 0.079999  ) [ set counterdie10 counterdie10 + 1 die]  ]
 ask Sp66s [
   if ( age > 2  AND  ASQD66  < random-float 0.019999  ) [ set counterdie10 counterdie10 + 1 die]  ]
 ask Sp67s [
   if ( age > 2  AND  ASQD67  < random-float 0.079999  ) [ set counterdie10 counterdie10 + 1 die]  ]
ask Sp68s [
   if ( age > 2  AND  ASQD68  < random-float 0.019999  ) [ set counterdie10 counterdie10 + 1 die]  ]
 ask Sp69s [
   if ( age > 2  AND  ASQD69  < random-float 0.079999  ) [ set counterdie10 counterdie10 + 1 die]  ]
ask Sp70s [
   if ( age > 2  AND  ASQD70  < random-float 0.019999  ) [ set counterdie10 counterdie10 + 1 die]  ]
 ask Sp71s [
   if ( age > 2  AND  ASQD71  < random-float 0.079999  ) [ set counterdie10 counterdie10 + 1 die]  ]
 ask Sp72s [
   if ( age > 2  AND  ASQD72  < random-float 0.019999  ) [ set counterdie10 counterdie10 + 1 die]  ]
 ask Sp73s [
   if ( age > 2  AND  ASQD73  < random-float 0.079999  ) [ set counterdie10 counterdie10 + 1 die]  ]
 ask Sp74s [
   if ( age > 2  AND  ASQD74  < random-float 0.019999  ) [ set counterdie10 counterdie10 + 1 die]  ]
 ask Sp75s [
   if ( age > 2  AND  ASQD75  < random-float 0.079999  ) [ set counterdie10 counterdie10 + 1 die]  ]
 ask Sp76s [
   if ( age > 2  AND  ASQD76  < random-float 0.019999  ) [ set counterdie10 counterdie10 + 1 die]  ]
 ask Sp77s [
   if ( age > 2  AND  ASQD77  < random-float 0.079999  ) [ set counterdie10 counterdie10 + 1 die]  ]
ask Sp78s [
   if ( age > 2  AND  ASQD78  < random-float 0.019999  ) [ set counterdie10 counterdie10 + 1 die]  ]
 ask Sp79s [
   if ( age > 2  AND  ASQD79  < random-float 0.079999  ) [ set counterdie10 counterdie10 + 1 die]  ]
 ask Sp80s [
   if ( age > 2  AND  ASQD80  < random-float 0.019999  ) [ set counterdie10 counterdie10 + 1 die]  ]
 ask Sp81s [
   if ( age > 2  AND  ASQD81  < random-float 0.079999  ) [ set counterdie10 counterdie10 + 1 die]  ]
 ask Sp82s [
   if ( age > 2  AND  ASQD82  < random-float 0.019999  ) [ set counterdie10 counterdie10 + 1 die]  ]
 ask Sp83s [
   if ( age > 2  AND  ASQD83  < random-float 0.079999  ) [ set counterdie10 counterdie10 + 1 die]  ]
 ask Sp84s [
   if ( age > 2  AND  ASQD84  < random-float 0.019999  ) [ set counterdie10 counterdie10 + 1 die]  ]
 ask Sp85s [
   if ( age > 2  AND  ASQD85  < random-float 0.079999  ) [ set counterdie10 counterdie10 + 1 die]  ]
 ask Sp86s [
   if ( age > 2  AND  ASQD86  < random-float 0.019999  ) [ set counterdie10 counterdie10 + 1 die]  ]
 ask Sp87s [
   if ( age > 2  AND  ASQD87  < random-float 0.079999  ) [ set counterdie10 counterdie10 + 1 die]  ]
ask Sp88s [
   if ( age > 2  AND  ASQD88  < random-float 0.019999  ) [ set counterdie10 counterdie10 + 1 die]  ]
 ask Sp89s [
   if ( age > 2  AND  ASQD89  < random-float 0.079999  ) [ set counterdie10 counterdie10 + 1 die]  ]
ask Sp90s [
   if ( age > 2  AND  ASQD90  < random-float 0.019999  ) [ set counterdie10 counterdie10 + 1 die]  ]
 ask Sp91s [
   if ( age > 2  AND  ASQD91  < random-float 0.079999  ) [ set counterdie10 counterdie10 + 1 die]  ]
 ask Sp92s [
   if ( age > 2  AND  ASQD92  < random-float 0.019999  ) [ set counterdie10 counterdie10 + 1 die]  ]
 ask Sp93s [
   if ( age > 2  AND  ASQD93  < random-float 0.079999  ) [ set counterdie10 counterdie10 + 1 die]  ]
 ask Sp94s [
   if ( age > 2  AND  ASQD94  < random-float 0.019999  ) [ set counterdie10 counterdie10 + 1 die]  ]
 ask Sp95s [
   if ( age > 2  AND  ASQD95  < random-float 0.079999  ) [ set counterdie10 counterdie10 + 1 die]  ]
 ask Sp96s [
   if ( age > 2  AND  ASQD96  < random-float 0.019999  ) [ set counterdie10 counterdie10 + 1 die]  ]
 ask Sp97s [
   if ( age > 2  AND  ASQD97  < random-float 0.079999  ) [ set counterdie10 counterdie10 + 1 die]  ]
ask Sp98s [
   if ( age > 2  AND  ASQD98  < random-float 0.019999  ) [ set counterdie10 counterdie10 + 1 die]  ]
 ask Sp99s [
   if ( age > 2  AND  ASQD99  < random-float 0.079999  ) [ set counterdie10 counterdie10 + 1 die]  ]
 ask Sp100s [    if ( age > 2  AND  ASQD100      < random-float 0.019999 ) [ set counterdie10 counterdie10 + 1 ] ]
end 

 ; THE DEATH3 SUBROUTINE KILLS THE NEWEST SEEDLINGS

to death3
  random-seed seed + 250
ask Sp1s  [    if ( age < 3  AND  ASQR1    < random-float 0.3 AND deathv = 1  ) [  die]  ]
ask Sp2s  [    if ( age < 3  AND  ASQR2   < random-float 0.2 AND deathv = 1  ) [  die]  ]
 ask Sp3s  [    if ( age < 3  AND  ASQR3  < random-float 0.3 AND deathv = 1 )  [  die]  ]
 ask Sp4s  [    if ( age < 3  AND  ASQR4 < random-float 0.2 AND deathv = 1  )  [  die]  ]
 ask Sp5s  [    if ( age < 3  AND  ASQR5  < random-float 0.3 AND deathv = 1  ) [  die]  ]
 ask Sp6s  [    if ( age < 3  AND  ASQR6    < random-float 0.2 AND deathv = 1  ) [die]  ]
 ask Sp7s  [    if ( age < 3  AND  ASQR7  < random-float 0.3 AND deathv = 1  ) [  die]  ]
 ask Sp8s  [    if ( age < 3  AND  ASQR8  < random-float 0.2 AND deathv = 1  ) [  die]  ]
 ask Sp9s  [    if ( age < 3  AND  ASQR9  < random-float 0.3 AND deathv = 1  ) [  die]  ]
 ask Sp10s  [    if ( age < 3  AND  ASQR10  < random-float 0.2 AND deathv = 1  ) [  die]  ]
 ask Sp11s  [    if ( age < 3  AND  ASQR11  < random-float 0.3 AND deathv = 1  ) [  die]  ]
 ask Sp12s  [    if ( age < 3  AND  ASQR12  < random-float 0.2 AND deathv = 1  ) [  die]  ]
 ask Sp13s  [    if ( age < 3  AND  ASQR13  < random-float 0.3 AND deathv = 1  ) [  die]  ]
 ask Sp14s  [    if ( age < 3  AND  ASQR14  < random-float 0.2 AND deathv = 1  ) [  die]  ]
 ask Sp15s  [    if ( age < 3  AND  ASQR15  < random-float 0.3 AND deathv = 1  ) [  die]  ]
 ask Sp16s  [    if ( age < 3  AND  ASQR16  < random-float 0.2 AND deathv = 1  ) [  die]  ]
 ask Sp17s  [    if ( age < 3  AND  ASQR17  < random-float 0.3 AND deathv = 1  ) [  die]  ]
 ask Sp18s  [    if ( age < 3  AND  ASQR18  < random-float 0.2 AND deathv = 1  ) [  die]  ]
 ask Sp19s  [    if ( age < 3  AND  ASQR19  < random-float 0.3 AND deathv = 1  ) [  die]  ]
 ask Sp20s  [    if ( age < 3  AND  ASQR20  < random-float 0.2 AND deathv = 1  ) [  die]  ]
 ask Sp21s  [    if ( age < 3  AND  ASQR21  < random-float 0.3 AND deathv = 1  ) [  die]  ]
 ask Sp22s  [    if ( age < 3  AND  ASQR22  < random-float 0.2 AND deathv = 1  ) [  die]  ]
 ask Sp23s  [    if ( age < 3  AND  ASQR23  < random-float 0.3 AND deathv = 1  ) [  die]  ]
 ask Sp24s  [    if ( age < 3  AND  ASQR24  < random-float 0.2 AND deathv = 1  ) [  die]  ]
 ask Sp25s  [    if ( age < 3  AND  ASQR25  < random-float 0.3 AND deathv = 1  ) [  die]  ]
 ask Sp26s  [    if ( age < 3  AND  ASQR26  < random-float 0.2 AND deathv = 1  ) [  die]  ]
 ask Sp27s  [    if ( age < 3  AND  ASQR27  < random-float 0.3 AND deathv = 1  ) [  die]  ]
ask Sp28s  [    if ( age < 3  AND  ASQR28  < random-float 0.2 AND deathv = 1  ) [  die]  ]
 ask Sp29s  [    if ( age < 3  AND  ASQR29  < random-float 0.3 AND deathv = 1  ) [  die]  ]
ask Sp30s  [    if ( age < 3  AND  ASQR30  < random-float 0.2 AND deathv = 1  ) [  die]  ]
 ask Sp31s  [    if ( age < 3  AND  ASQR31  < random-float 0.3 AND deathv = 1  ) [  die]  ]
 ask Sp32s  [    if ( age < 3  AND  ASQR32  < random-float 0.2 AND deathv = 1  ) [  die]  ]
 ask Sp33s  [    if ( age < 3  AND  ASQR33  < random-float 0.3 AND deathv = 1  ) [  die]  ]
 ask Sp34s  [    if ( age < 3  AND  ASQR34  < random-float 0.2 AND deathv = 1  ) [  die]  ]
 ask Sp35s  [    if ( age < 3  AND  ASQR35  < random-float 0.3 AND deathv = 1  ) [  die]  ]
 ask Sp36s  [    if ( age < 3  AND  ASQR36  < random-float 0.2 AND deathv = 1  ) [  die]  ]
 ask Sp37s  [    if ( age < 3  AND  ASQR37  < random-float 0.3 AND deathv = 1  ) [  die]  ]
ask Sp38s  [    if ( age < 3  AND  ASQR38  < random-float 0.2 AND deathv = 1  ) [  die]  ]
 ask Sp39s  [    if ( age < 3  AND  ASQR39  < random-float 0.3 AND deathv = 1  ) [  die]  ]
ask Sp40s  [    if ( age < 3  AND  ASQR40  < random-float 0.2 AND deathv = 1  ) [  die]  ]
 ask Sp41s  [    if ( age < 3  AND  ASQR41  < random-float 0.3 AND deathv = 1  ) [  die]  ]
 ask Sp42s  [    if ( age < 3  AND  ASQR42  < random-float 0.2 AND deathv = 1  ) [  die]  ]
 ask Sp43s  [    if ( age < 3  AND  ASQR43  < random-float 0.3 AND deathv = 1  ) [  die]  ]
 ask Sp44s  [    if ( age < 3  AND  ASQR44  < random-float 0.2 AND deathv = 1  ) [  die]  ]
 ask Sp45s  [    if ( age < 3  AND  ASQR45  < random-float 0.3 AND deathv = 1  ) [  die]  ]
 ask Sp46s  [    if ( age < 3  AND  ASQR46  < random-float 0.2 AND deathv = 1  ) [  die]  ]
 ask Sp47s  [    if ( age < 3  AND  ASQR47  < random-float 0.3 AND deathv = 1  ) [  die]  ]
ask Sp48s  [    if ( age < 3  AND  ASQR48  < random-float 0.2 AND deathv = 1  ) [  die]  ]
 ask Sp49s  [    if ( age < 3  AND  ASQR49  < random-float 0.3 AND deathv = 1  ) [  die]  ]
 ask Sp50s  [    if ( age < 3  AND  ASQR50  < random-float 0.2 AND deathv = 1  ) [  die]  ]
 ask Sp51s  [    if ( age < 3  AND  ASQR51  < random-float 0.3 AND deathv = 1  ) [  die]  ]
 ask Sp52s  [    if ( age < 3  AND  ASQR52  < random-float 0.2 AND deathv = 1  ) [  die]  ]
 ask Sp53s  [    if ( age < 3  AND  ASQR53  < random-float 0.3 AND deathv = 1  ) [  die]  ]
 ask Sp54s  [    if ( age < 3  AND  ASQR54  < random-float 0.2 AND deathv = 1  ) [  die]  ]
 ask Sp55s  [    if ( age < 3  AND  ASQR55  < random-float 0.3 AND deathv = 1  ) [  die]  ]
 ask Sp56s  [    if ( age < 3  AND  ASQR56  < random-float 0.2 AND deathv = 1  ) [  die]  ]
 ask Sp57s  [    if ( age < 3  AND  ASQR57   < random-float 0.2 AND deathv = 1  ) [  die]  ]
 ask Sp58s  [    if ( age < 3  AND  ASQR58  < random-float 0.3 AND deathv = 1  ) [  die]  ]
 ask Sp59s  [    if ( age < 3  AND  ASQR59  < random-float 0.2 AND deathv = 1  ) [  die]  ]
ask Sp60s  [    if ( age < 3  AND  ASQR60  < random-float 0.3 AND deathv = 1  ) [  die]  ]
 ask Sp61s  [    if ( age < 3  AND  ASQR61  < random-float 0.2 AND deathv = 1  ) [  die]  ]
 ask Sp62s  [    if ( age < 3  AND  ASQR62  < random-float 0.3 AND deathv = 1  ) [  die]  ]
 ask Sp63s  [    if ( age < 3  AND  ASQR63  < random-float 0.2 AND deathv = 1  ) [  die]  ]
 ask Sp64s  [    if ( age < 3  AND  ASQR64  < random-float 0.3 AND deathv = 1  ) [  die]  ]
 ask Sp65s  [    if ( age < 3  AND  ASQR65  < random-float 0.2 AND deathv = 1  ) [  die]  ]
 ask Sp66s  [    if ( age < 3  AND  ASQR66  < random-float 0.3 AND deathv = 1  ) [  die]  ]
 ask Sp67s  [    if ( age < 3  AND  ASQR67  < random-float 0.2 AND deathv = 1  ) [  die]  ]
ask Sp68s  [    if ( age < 3  AND  ASQR68  < random-float 0.3 AND deathv = 1  ) [  die]  ]
 ask Sp69s  [    if ( age < 3  AND  ASQR69  < random-float 0.2 AND deathv = 1  ) [  die]  ]
ask Sp70s  [    if ( age < 3  AND  ASQR70  < random-float 0.3 AND deathv = 1  ) [  die]  ]
 ask Sp71s  [    if ( age < 3  AND  ASQR71  < random-float 0.2 AND deathv = 1  ) [  die]  ]
 ask Sp72s  [    if ( age < 3  AND  ASQR72  < random-float 0.3 AND deathv = 1  ) [  die]  ]
 ask Sp73s  [    if ( age < 3  AND  ASQR73  < random-float 0.2 AND deathv = 1  ) [  die]  ]
 ask Sp74s  [    if ( age < 3  AND  ASQR74  < random-float 0.3 AND deathv = 1  ) [  die]  ]
 ask Sp75s  [    if ( age < 3  AND  ASQR75  < random-float 0.2 AND deathv = 1  ) [  die]  ]
 ask Sp76s  [    if ( age < 3  AND  ASQR76  < random-float 0.3 AND deathv = 1  ) [  die]  ]
 ask Sp77s  [    if ( age < 3  AND  ASQR77  < random-float 0.2 AND deathv = 1  ) [  die]  ]
ask Sp78s  [    if ( age < 3  AND  ASQR78  < random-float 0.3 AND deathv = 1  ) [  die]  ]
 ask Sp79s  [    if ( age < 3  AND  ASQR79  < random-float 0.2 AND deathv = 1  ) [  die]  ]
 ask Sp80s  [    if ( age < 3  AND  ASQR80  < random-float 0.3 AND deathv = 1  ) [  die]  ]
 ask Sp81s  [    if ( age < 3  AND  ASQR81  < random-float 0.2 AND deathv = 1  ) [  die]  ]
 ask Sp82s  [    if ( age < 3  AND  ASQR82  < random-float 0.3 AND deathv = 1  ) [  die]  ]
 ask Sp83s  [    if ( age < 3  AND  ASQR83  < random-float 0.2 AND deathv = 1  ) [  die]  ]
 ask Sp84s  [    if ( age < 3  AND  ASQR84  < random-float 0.3 AND deathv = 1  ) [  die]  ]
 ask Sp85s  [    if ( age < 3  AND  ASQR85  < random-float 0.2 AND deathv = 1  ) [  die]  ]
 ask Sp86s  [    if ( age < 3  AND  ASQR86  < random-float 0.3 AND deathv = 1  ) [  die]  ]
 ask Sp87s  [    if ( age < 3  AND  ASQR87  < random-float 0.2 AND deathv = 1  ) [  die]  ]
ask Sp88s  [    if ( age < 3  AND  ASQR88  < random-float 0.3 AND deathv = 1  ) [  die]  ]
 ask Sp89s  [    if ( age < 3  AND  ASQR89  < random-float 0.2 AND deathv = 1  ) [  die]  ]
ask Sp90s  [    if ( age < 3  AND  ASQR90  < random-float 0.3 AND deathv = 1  ) [  die]  ]
 ask Sp91s  [    if ( age < 3  AND  ASQR91  < random-float 0.2 AND deathv = 1  ) [  die]  ]
 ask Sp92s  [    if ( age < 3  AND  ASQR92  < random-float 0.3 AND deathv = 1  ) [  die]  ]
 ask Sp93s  [    if ( age < 3  AND  ASQR93  < random-float 0.3 AND deathv = 1  ) [  die]  ]
 ask Sp94s  [    if ( age < 3  AND  ASQR94  < random-float 0.2 AND deathv = 1  ) [  die]  ]
 ask Sp95s  [    if ( age < 3  AND  ASQR95  < random-float 0.3 AND deathv = 1  ) [  die]  ]
 ask Sp96s  [    if ( age < 3  AND  ASQR96  < random-float 0.2 AND deathv = 1  ) [  die]  ]
 ask Sp97s  [    if ( age < 3  AND  ASQR97  < random-float 0.3 AND deathv = 1  ) [  die]  ]
ask Sp98s  [    if ( age < 3  AND  ASQR98  < random-float 0.2 AND deathv = 1  ) [  die]  ]
 ask Sp99s  [    if ( age < 3  AND  ASQR99  < random-float 0.3 AND deathv = 1  ) [  die]  ]
 ask Sp100s [    if ( age < 3  AND  ASQR100      < random-float 0.2 AND deathv = 1 ) [ die ] ]
end 

; THE UBI SUBROUTINE ADDS LONG DISTANCE DISPERSAL FROM OFF THE GRID FOR THE UBIQUITOUS DISPERSERS

to ubi
  random-seed seed + 350
  repeat 1 [

ask patch random 100 random 100 [
 sprout-Sp1s 1 [
  set   size 1    set deathv 2  set age 0
      ] ]
   ask patch random 100 random 100 [ sprout-Sp3s 1 [
  set   size 1    set deathv 2  set age 0
           ] ]
   ask patch random 100 random 100 [ sprout-Sp5s 1 [
  set   size 1    set deathv 2  set age 0
           ] ]
  ask patch random 100 random 100 [ sprout-Sp7s 1 [
  set   size 1    set deathv 2  set age 0
           ] ]
   ask patch random 100 random 100 [ sprout-Sp9s 1 [
  set   size 1    set deathv 2  set age 0
           ] ]
  ask patch random 100 random 100 [ sprout-Sp11s 1 [
  set   size 1    set deathv 2  set age 0
            ] ]
  ask patch random 100 random 100 [ sprout-Sp13s 1 [
  set   size 1    set deathv 2  set age 0
             ] ]
         ask patch random 100 random 100 [ sprout-Sp15s 1 [
  set   size 1    set deathv 2  set age 0
             ] ]
         ask patch random 100 random 100 [ sprout-Sp17s 1 [
  set   size 1    set deathv 2  set age 0
             ] ]
                  ask patch random 100 random 100 [ sprout-Sp19s 1 [
  set   size 1    set deathv 2  set age 0
             ] ]
                  ask patch random 100 random 100 [ sprout-Sp21s 1 [
  set   size 1    set deathv 2  set age 0
             ] ]
ask patch random 100 random 100 [ sprout-Sp23s 1 [
  set   size 1    set deathv 2  set age 0
          ] ]
   ask patch random 100 random 100 [ sprout-Sp25s 1 [
  set   size 1    set deathv 2  set age 0
           ] ]
    ask patch random 100 random 100 [ sprout-Sp27s 1 [
  set   size 1    set deathv 2  set age 0
           ] ]
  ask patch random 100 random 100 [ sprout-Sp29s 1 [
  set   size 1    set deathv 2  set age 0
           ] ]
  ask patch random 100 random 100 [ sprout-Sp31s 1 [
  set   size 1    set deathv 2  set age 0
           ] ]
  ask patch random 100 random 100 [ sprout-Sp33s 1 [
  set   size 1    set deathv 2  set age 0
            ] ]
  ask patch random 100 random 100 [ sprout-Sp35s 1 [
  set   size 1    set deathv 2  set age 0
           ] ]
      ask patch random 100 random 100 [ sprout-Sp37s 1 [
  set   size 1    set deathv 2  set age 0
             ] ]
            ask patch random 100 random 100 [ sprout-Sp39s 1 [
  set   size 1    set deathv 2  set age 0
             ] ]
  ask patch random 100 random 100 [ sprout-Sp41s 1 [
  set   size 1    set deathv 2  set age 0
           ] ]
  ask patch random 100 random 100 [ sprout-Sp43s 1 [
  set   size 1    set deathv 2  set age 0
            ] ]
  ask patch random 100 random 100 [ sprout-Sp45s 1 [
  set   size 1    set deathv 2  set age 0
           ] ]
      ask patch random 100 random 100 [ sprout-Sp47s 1 [
  set   size 1    set deathv 2  set age 0
             ] ]
            ask patch random 100 random 100 [ sprout-Sp49s 1 [
  set   size 1    set deathv 2  set age 0
             ] ]
  ask patch random 100 random 100 [ sprout-Sp51s 1 [
  set   size 1    set deathv 2  set age 0
           ] ]
  ask patch random 100 random 100 [ sprout-Sp53s 1 [
  set   size 1    set deathv 2  set age 0
            ] ]
  ask patch random 100 random 100 [ sprout-Sp55s 1 [
  set   size 1    set deathv 2  set age 0
           ] ]
      ask patch random 100 random 100 [ sprout-Sp57s 1 [
  set   size 1    set deathv 2  set age 0
             ] ]
            ask patch random 100 random 100 [ sprout-Sp59s 1 [
  set   size 1    set deathv 2  set age 0
             ] ]
  ask patch random 100 random 100 [ sprout-Sp61s 1 [
  set   size 1    set deathv 2  set age 0
           ] ]
  ask patch random 100 random 100 [ sprout-Sp63s 1 [
  set   size 1    set deathv 2  set age 0
            ] ]
  ask patch random 100 random 100 [ sprout-Sp65s 1 [
  set   size 1    set deathv 2  set age 0
           ] ]
      ask patch random 100 random 100 [ sprout-Sp67s 1 [
  set   size 1    set deathv 2  set age 0
             ] ]
            ask patch random 100 random 100 [ sprout-Sp69s 1 [
  set   size 1    set deathv 2  set age 0
             ] ]
  ask patch random 100 random 100 [ sprout-Sp71s 1 [
  set   size 1    set deathv 2  set age 0
           ] ]
  ask patch random 100 random 100 [ sprout-Sp73s 1 [
  set   size 1    set deathv 2  set age 0
            ] ]
  ask patch random 100 random 100 [ sprout-Sp75s 1 [
  set   size 1    set deathv 2  set age 0
           ] ]
      ask patch random 100 random 100 [ sprout-Sp77s 1 [
  set   size 1    set deathv 2  set age 0
             ] ]
            ask patch random 100 random 100 [ sprout-Sp79s 1 [
  set   size 1    set deathv 2  set age 0
             ] ]
  ask patch random 100 random 100 [ sprout-Sp81s 1 [
  set   size 1    set deathv 2  set age 0
           ] ]
  ask patch random 100 random 100 [ sprout-Sp83s 1 [
  set   size 1    set deathv 2  set age 0
            ] ]
  ask patch random 100 random 100 [ sprout-Sp85s 1 [
  set   size 1    set deathv 2  set age 0
           ] ]
      ask patch random 100 random 100 [ sprout-Sp87s 1 [
  set   size 1    set deathv 2  set age 0
             ] ]
            ask patch random 100 random 100 [ sprout-Sp89s 1 [
  set   size 1    set deathv 2  set age 0
             ] ]
  ask patch random 100 random 100 [ sprout-Sp91s 1 [
  set   size 1    set deathv 2  set age 0
           ] ]
  ask patch random 100 random 100 [ sprout-Sp93s 1 [
  set   size 1    set deathv 2  set age 0
            ] ]
  ask patch random 100 random 100 [ sprout-Sp95s 1 [
  set   size 1    set deathv 2  set age 0
           ] ]
      ask patch random 100 random 100 [ sprout-Sp97s 1 [
  set   size 1  set deathv 2    set age 0
             ] ]
            ask patch random 100 random 100 [ sprout-Sp99s 1 [
  set   size 1  set deathv 2    set age 0
             ] ]
  ;]
    ]
  death4
end 

; THE DEATH4 SUBROUTINE KILLS INDIVIDUALS THAT HAVE DISPERSED IN FROM OFF THE GRID

to death4
  random-seed seed + 300
ask Sp1s  [    if ( age < 3  AND  ASQR1    < random-float 0.3 AND deathv = 2  ) [  die]  ]

 ask Sp3s  [    if ( age < 3  AND  ASQR3  < random-float 0.3 AND deathv = 2 )  [  die]  ]
 ask Sp5s  [    if ( age < 3  AND  ASQR5  < random-float 0.3 AND deathv = 2  ) [  die]  ]
 ask Sp7s  [    if ( age < 3  AND  ASQR7  < random-float 0.3 AND deathv = 2  ) [  die]  ]
 ask Sp9s  [    if ( age < 3  AND  ASQR9  < random-float 0.3 AND deathv = 2  ) [  die]  ]
 ask Sp11s  [    if ( age < 3  AND  ASQR11  < random-float 0.3 AND deathv = 2  ) [  die]  ]
  ask Sp13s  [    if ( age < 3  AND  ASQR13  < random-float 0.3 AND deathv = 2  ) [  die]  ]
 ask Sp15s  [    if ( age < 3  AND  ASQR15  < random-float 0.3 AND deathv = 2  ) [  die]  ]
 ask Sp17s  [    if ( age < 3  AND  ASQR17  < random-float 0.3 AND deathv = 2  ) [  die]  ]
 ask Sp19s  [    if ( age < 3  AND  ASQR19  < random-float 0.3 AND deathv = 2  ) [  die]  ]
 ask Sp21s  [    if ( age < 3  AND  ASQR21  < random-float 0.3 AND deathv = 2  ) [  die]  ]
 ask Sp23s  [    if ( age < 3  AND  ASQR23  < random-float 0.3 AND deathv = 2  ) [  die]  ]
 ask Sp25s  [    if ( age < 3  AND  ASQR25  < random-float 0.3 AND deathv = 2  ) [  die]  ]
 ask Sp27s  [    if ( age < 3  AND  ASQR27  < random-float 0.3 AND deathv = 2  ) [  die]  ]
 ask Sp29s  [    if ( age < 3  AND  ASQR29  < random-float 0.3 AND deathv = 2  ) [  die]  ]
 ask Sp31s  [    if ( age < 3  AND  ASQR31  < random-float 0.3 AND deathv = 2  ) [  die]  ]
 ask Sp33s  [    if ( age < 3  AND  ASQR33  < random-float 0.3 AND deathv = 2  ) [  die]  ]
 ask Sp35s  [    if ( age < 3  AND  ASQR35  < random-float 0.3 AND deathv = 2  ) [  die]  ]
 ask Sp37s  [    if ( age < 3  AND  ASQR37  < random-float 0.3 AND deathv = 2  ) [  die]  ]
 ask Sp39s  [    if ( age < 3  AND  ASQR39  < random-float 0.3 AND deathv = 2  ) [  die]  ]
 ask Sp41s  [    if ( age < 3  AND  ASQR41  < random-float 0.3 AND deathv = 2  ) [  die]  ]
 ask Sp43s  [    if ( age < 3  AND  ASQR43  < random-float 0.3 AND deathv = 2  ) [  die]  ]
 ask Sp45s  [    if ( age < 3  AND  ASQR45  < random-float 0.3 AND deathv = 2  ) [  die]  ]
 ask Sp47s  [    if ( age < 3  AND  ASQR47  < random-float 0.3 AND deathv = 2  ) [  die]  ]
 ask Sp49s  [    if ( age < 3  AND  ASQR49  < random-float 0.3 AND deathv = 2  ) [  die]  ]
 ask Sp51s  [    if ( age < 3  AND  ASQR51  < random-float 0.3 AND deathv = 2  ) [  die]  ]
 ask Sp53s  [    if ( age < 3  AND  ASQR53  < random-float 0.3 AND deathv = 2  ) [  die]  ]
 ask Sp55s  [    if ( age < 3  AND  ASQR55  < random-float 0.3 AND deathv = 2  ) [  die]  ]
 ask Sp57s  [    if ( age < 3  AND  ASQR57   < random-float 0.2 AND deathv = 2  ) [  die]  ]
 ask Sp59s  [    if ( age < 3  AND  ASQR59  < random-float 0.2 AND deathv = 2  ) [  die]  ]
 ask Sp61s  [    if ( age < 3  AND  ASQR61  < random-float 0.2 AND deathv = 2  ) [  die]  ]
 ask Sp63s  [    if ( age < 3  AND  ASQR63  < random-float 0.2 AND deathv = 2  ) [  die]  ]
 ask Sp65s  [    if ( age < 3  AND  ASQR65  < random-float 0.2 AND deathv = 2  ) [  die]  ]
 ask Sp67s  [    if ( age < 3  AND  ASQR67  < random-float 0.2 AND deathv = 2  ) [  die]  ]
 ask Sp69s  [    if ( age < 3  AND  ASQR69  < random-float 0.2 AND deathv = 2  ) [  die]  ]
 ask Sp71s  [    if ( age < 3  AND  ASQR71  < random-float 0.2 AND deathv = 2  ) [  die]  ]
 ask Sp73s  [    if ( age < 3  AND  ASQR73  < random-float 0.2 AND deathv = 2  ) [  die]  ]
 ask Sp75s  [    if ( age < 3  AND  ASQR75  < random-float 0.2 AND deathv = 2  ) [  die]  ]
 ask Sp77s  [    if ( age < 3  AND  ASQR77  < random-float 0.2 AND deathv = 2  ) [  die]  ]
 ask Sp79s  [    if ( age < 3  AND  ASQR79  < random-float 0.2 AND deathv = 2  ) [  die]  ]
 ask Sp81s  [    if ( age < 3  AND  ASQR81  < random-float 0.2 AND deathv = 2  ) [  die]  ]
 ask Sp83s  [    if ( age < 3  AND  ASQR83  < random-float 0.2 AND deathv = 2  ) [  die]  ]
 ask Sp85s  [    if ( age < 3  AND  ASQR85  < random-float 0.2 AND deathv = 2  ) [  die]  ]
 ask Sp87s  [    if ( age < 3  AND  ASQR87  < random-float 0.2 AND deathv = 2  ) [  die]  ]
 ask Sp89s  [    if ( age < 3  AND  ASQR89  < random-float 0.2 AND deathv = 2  ) [  die]  ]
 ask Sp91s  [    if ( age < 3  AND  ASQR91  < random-float 0.2 AND deathv = 2  ) [  die]  ]
 ask Sp93s  [    if ( age < 3  AND  ASQR93  < random-float 0.3 AND deathv = 2  ) [  die]  ]
 ask Sp95s  [    if ( age < 3  AND  ASQR95  < random-float 0.3 AND deathv = 2  ) [  die]  ]
 ask Sp97s  [    if ( age < 3  AND  ASQR97  < random-float 0.3 AND deathv = 2  ) [  die]  ]
 ask Sp99s  [    if ( age < 3  AND  ASQR99  < random-float 0.3 AND deathv = 2  ) [  die]  ]
end 



; THE RICH SUBROUTINE CALCULATES THE NUMBER OF SPECIES CONSERVED AT THE END OF THE SIMULATION, NOT INCLUDING SEEDLINGS

to rich

set gamma 0


if ( count  Sp1s with [age > 2] > 1) [set gamma gamma + 1]
if ( count  Sp2s with [age > 2] > 1) [set gamma gamma + 1]
if ( count  Sp3s with [age > 2] > 1) [set gamma gamma + 1]
if ( count  Sp4s with [age > 2] > 1) [set gamma gamma + 1]
if ( count  Sp5s with [age > 2] > 1) [set gamma gamma + 1]
if ( count  Sp6s with [age > 2] > 1) [set gamma gamma + 1]
if ( count  Sp7s with [age > 2] > 1) [set gamma gamma + 1]
if ( count  Sp8s with [age > 2] > 1) [set gamma gamma + 1]
if ( count  Sp9s with [age > 2] > 1) [set gamma gamma + 1]
if ( count  Sp10s with [age > 2] > 1) [set gamma gamma + 1]
if ( count  Sp11s with [age > 2] > 1) [set gamma gamma + 1]
if ( count  Sp12s with [age > 2] > 1) [set gamma gamma + 1]
if ( count  Sp13s with [age > 2] > 1) [set gamma gamma + 1]
if ( count  Sp14s with [age > 2] > 1) [set gamma gamma + 1]
if ( count  Sp18s with [age > 2] > 1) [set gamma gamma + 1]
if ( count  Sp16s with [age > 2] > 1) [set gamma gamma + 1]
if ( count  Sp17s with [age > 2] > 1) [set gamma gamma + 1]
if ( count  Sp18s with [age > 2] > 1) [set gamma gamma + 1]
if ( count  Sp19s with [age > 2] > 1) [set gamma gamma + 1]
if ( count  Sp20s with [age > 2] > 1) [set gamma gamma + 1]
if ( count  Sp21s with [age > 2] > 1) [set gamma gamma + 1]
if ( count  Sp22s with [age > 2] > 1) [set gamma gamma + 1]
 if ( count  Sp23s with [age > 2] > 1) [set gamma gamma + 1]
if ( count  Sp24s with [age > 2] > 1) [set gamma gamma + 1]
if ( count  Sp25s with [age > 2] > 1) [set gamma gamma + 1]
if ( count  Sp26s with [age > 2] > 1) [set gamma gamma + 1]
if ( count  Sp27s with [age > 2] > 1) [set gamma gamma + 1]
if ( count  Sp28s with [age > 2] > 1) [set gamma gamma + 1]
if ( count  Sp29s with [age > 2] > 1) [set gamma gamma + 1]
if ( count  Sp30s with [age > 2] > 1) [set gamma gamma + 1]
if ( count  Sp31s with [age > 2] > 1) [set gamma gamma + 1]
if ( count  Sp32s with [age > 2] > 1) [set gamma gamma + 1]
if ( count  Sp33s with [age > 2] > 1) [set gamma gamma + 1]
if ( count  Sp34s with [age > 2] > 1) [set gamma gamma + 1]
if ( count  Sp35s with [age > 2] > 1) [set gamma gamma + 1]
if ( count  Sp36s with [age > 2] > 1) [set gamma gamma + 1]
if ( count  Sp37s with [age > 2] > 1) [set gamma gamma + 1]
if ( count  Sp38s with [age > 2] > 1) [set gamma gamma + 1]
if ( count  Sp39s with [age > 2] > 1) [set gamma gamma + 1]
if ( count  Sp40s with [age > 2] > 1) [set gamma gamma + 1]
if ( count  Sp41s with [age > 2] > 1) [set gamma gamma + 1]
if ( count  Sp42s with [age > 2] > 1) [set gamma gamma + 1]
 if ( count  Sp43s with [age > 2] > 1) [set gamma gamma + 1]
if ( count  Sp44s with [age > 2] > 1) [set gamma gamma + 1]
if ( count  Sp45s with [age > 2] > 1) [set gamma gamma + 1]
if ( count  Sp46s with [age > 2] > 1) [set gamma gamma + 1]
if ( count  Sp47s with [age > 2] > 1) [set gamma gamma + 1]
if ( count  Sp48s with [age > 2] > 1) [set gamma gamma + 1]
if ( count  Sp49s with [age > 2] > 1) [set gamma gamma + 1]
if ( count  Sp50s with [age > 2] > 1) [set gamma gamma + 1]
if ( count  Sp51s with [age > 2] > 1) [set gamma gamma + 1]
if ( count  Sp52s with [age > 2] > 1) [set gamma gamma + 1]
 if ( count  Sp53s with [age > 2] > 1) [set gamma gamma + 1]
if ( count  Sp54s with [age > 2] > 1) [set gamma gamma + 1]
if ( count  Sp55s with [age > 2] > 1) [set gamma gamma + 1]
if ( count  Sp56s with [age > 2] > 1) [set gamma gamma + 1]
if ( count  Sp57s with [age > 2] > 1) [set gamma gamma + 1]
if ( count  Sp58s with [age > 2] > 1) [set gamma gamma + 1]
if ( count  Sp59s with [age > 2] > 1) [set gamma gamma + 1]
if ( count  Sp60s with [age > 2] > 1) [set gamma gamma + 1]
if ( count  Sp61s with [age > 2] > 1) [set gamma gamma + 1]
if ( count  Sp62s with [age > 2] > 1) [set gamma gamma + 1]
 if ( count  Sp63s with [age > 2] > 1) [set gamma gamma + 1]
if ( count  Sp64s with [age > 2] > 1) [set gamma gamma + 1]
if ( count  Sp65s with [age > 2] > 1) [set gamma gamma + 1]
if ( count  Sp66s with [age > 2] > 1) [set gamma gamma + 1]
if ( count  Sp67s with [age > 2] > 1) [set gamma gamma + 1]
if ( count  Sp68s with [age > 2] > 1) [set gamma gamma + 1]
if ( count  Sp69s with [age > 2] > 1) [set gamma gamma + 1]
if ( count  Sp70s with [age > 2] > 1) [set gamma gamma + 1]
if ( count  Sp71s with [age > 2] > 1) [set gamma gamma + 1]
if ( count  Sp72s with [age > 2] > 1) [set gamma gamma + 1]
 if ( count  Sp73s with [age > 2] > 1) [set gamma gamma + 1]
if ( count  Sp74s with [age > 2] > 1) [set gamma gamma + 1]
if ( count  Sp75s with [age > 2] > 1) [set gamma gamma + 1]
if ( count  Sp76s with [age > 2] > 1) [set gamma gamma + 1]
if ( count  Sp77s with [age > 2] > 1) [set gamma gamma + 1]
if ( count  Sp78s with [age > 2] > 1) [set gamma gamma + 1]
if ( count  Sp79s with [age > 2] > 1) [set gamma gamma + 1]
if ( count  Sp80s with [age > 2] > 1) [set gamma gamma + 1]
if ( count  Sp81s with [age > 2] > 1) [set gamma gamma + 1]
if ( count  Sp82s with [age > 2] > 1) [set gamma gamma + 1]
 if ( count  Sp83s with [age > 2] > 1) [set gamma gamma + 1]
if ( count  Sp84s with [age > 2] > 1) [set gamma gamma + 1]
if ( count  Sp85s with [age > 2] > 1) [set gamma gamma + 1]
if ( count  Sp86s with [age > 2] > 1) [set gamma gamma + 1]
if ( count  Sp87s with [age > 2] > 1) [set gamma gamma + 1]
if ( count  Sp88s with [age > 2] > 1) [set gamma gamma + 1]
if ( count  Sp89s with [age > 2] > 1) [set gamma gamma + 1]
if ( count  Sp90s with [age > 2] > 1) [set gamma gamma + 1]
if ( count  Sp91s with [age > 2] > 1) [set gamma gamma + 1]
if ( count  Sp92s with [age > 2] > 1) [set gamma gamma + 1]
 if ( count  Sp93s with [age > 2] > 1) [set gamma gamma + 1]
if ( count  Sp94s with [age > 2] > 1) [set gamma gamma + 1]
if ( count  Sp95s with [age > 2] > 1) [set gamma gamma + 1]
if ( count  Sp96s with [age > 2] > 1) [set gamma gamma + 1]
if ( count  Sp97s with [age > 2] > 1) [set gamma gamma + 1]
if ( count  Sp98s with [age > 2] > 1) [set gamma gamma + 1]
if ( count  Sp99s with [age > 2] > 1) [set gamma gamma + 1]
if (count Sp100s with [age > 2] > 1) [set gamma gamma + 1]
end 


; THE OUTCOUNT SUBROUTINE PRINTS THE NUMBER OF INDIVIDUALS OF EACH SPECIES THAT ARE
 ; EXTANT ANYWHERE ON THE GRID

to outcount1
print year
 print count  Sp1s
 print count  Sp2s
 print count  Sp3s
 print count  Sp4s
 print count  Sp5s
 print count  Sp6s
 print count  Sp7s
 print count  Sp8s
 print count  Sp9s
 print count  Sp10s
 print count  Sp11s
 print count  Sp12s
 print count  Sp13s
 print count  Sp14s
 print count  Sp18s
 print count  Sp16s
 print count  Sp17s
 print count  Sp18s
 print count  Sp19s
 print count  Sp20s
 print count  Sp21s
 print count  Sp22s
  print count  Sp23s
 print count  Sp24s
 print count  Sp25s
 print count  Sp26s
 print count  Sp27s
 print count  Sp28s
 print count  Sp29s
 print count  Sp30s
 print count  Sp31s
 print count  Sp32s
 print count  Sp33s
 print count  Sp34s
 print count  Sp35s
 print count  Sp36s
 print count  Sp37s
 print count  Sp38s
 print count  Sp39s
 print count  Sp40s
 print count  Sp41s
 print count  Sp42s
  print count  Sp43s
 print count  Sp44s
 print count  Sp45s
 print count  Sp46s
 print count  Sp47s
 print count  Sp48s
 print count  Sp49s
 print count  Sp50s
 print count  Sp51s
 print count  Sp52s
  print count  Sp53s
 print count  Sp54s
 print count  Sp55s
 print count  Sp56s
 print count  Sp57s
 print count  Sp58s
 print count  Sp59s
 print count  Sp60s
 print count  Sp61s
 print count  Sp62s
  print count  Sp63s
 print count  Sp64s
 print count  Sp65s
 print count  Sp66s
 print count  Sp67s
 print count  Sp68s
 print count  Sp69s
 print count  Sp70s
 print count  Sp71s
 print count  Sp72s
  print count  Sp73s
 print count  Sp74s
 print count  Sp75s
 print count  Sp76s
 print count  Sp77s
 print count  Sp78s
 print count  Sp79s
 print count  Sp80s
 print count  Sp81s
 print count  Sp82s
  print count  Sp83s
 print count  Sp84s
 print count  Sp85s
 print count  Sp86s
 print count  Sp87s
 print count  Sp88s
 print count  Sp89s
 print count  Sp90s
 print count  Sp91s
 print count  Sp92s
  print count  Sp93s
 print count  Sp94s
 print count  Sp95s
 print count  Sp96s
 print count  Sp97s
 print count  Sp98s
 print count  Sp99s
 print count  Sp100s
end 

to outcount2
print year
  print count  patches with [climate4 < 0.95]
    print count  patches with [climate4 < 0.9]
    print count  patches with [climate4 < 0.85]
    print count  patches with [climate4 < 0.8]
    print count  patches with [climate4 < 0.75]
    print count  patches with [climate4 < 0.7]
    print count  patches with [climate4 < 0.65]
    print count  patches with [climate4 < 0.6]
    print count  patches with [climate4 < 0.55]
    print count  patches with [climate4 < 0.5]
    print count  patches with [climate4 < 0.45]
    print count  patches with [climate4 < 0.4]
    print count  patches with [climate4 < 0.35]
    print count  patches with [climate4 < 0.3]
    print count  patches with [climate4 < 0.25]
    print count  patches with [climate4 < 0.2]
    print count  patches with [climate4 < 0.15]
    print count  patches with [climate4 < 0.1]
    print count  patches with [climate4 < 0.05]
end 

to outcount3
print year

  ask patches [
    set alpha 0
   if (count   Sp1s-here > 0) [ set alpha alpha + 1 ]
 if (count   Sp2s-here > 0) [ set alpha alpha + 1 ]
 if (count   Sp3s-here > 0) [ set alpha alpha + 1 ]
 if (count   Sp4s-here > 0) [ set alpha alpha + 1 ]
 if (count   Sp5s-here > 0) [ set alpha alpha + 1 ]
 if (count   Sp6s-here > 0) [ set alpha alpha + 1 ]
 if (count   Sp7s-here > 0) [ set alpha alpha + 1 ]
 if (count   Sp8s-here > 0) [ set alpha alpha + 1 ]
 if (count   Sp9s-here > 0) [ set alpha alpha + 1 ]
 if (count   Sp10s-here > 0) [ set alpha alpha + 1 ]
 if (count   Sp11s-here > 0) [ set alpha alpha + 1 ]
 if (count   Sp12s-here > 0) [ set alpha alpha + 1 ]
 if (count   Sp13s-here > 0) [ set alpha alpha + 1 ]
 if (count   Sp14s-here > 0) [ set alpha alpha + 1 ]
 if (count   Sp18s-here > 0) [ set alpha alpha + 1 ]
 if (count   Sp16s-here > 0) [ set alpha alpha + 1 ]
 if (count   Sp17s-here > 0) [ set alpha alpha + 1 ]
 if (count   Sp18s-here > 0) [ set alpha alpha + 1 ]
 if (count   Sp19s-here > 0) [ set alpha alpha + 1 ]
 if (count   Sp20s-here > 0) [ set alpha alpha + 1 ]
 if (count   Sp21s-here > 0) [ set alpha alpha + 1 ]
 if (count   Sp22s-here > 0) [ set alpha alpha + 1 ]
  if (count   Sp23s-here > 0) [ set alpha alpha + 1 ]
 if (count   Sp24s-here > 0) [ set alpha alpha + 1 ]
 if (count   Sp25s-here > 0) [ set alpha alpha + 1 ]
 if (count   Sp26s-here > 0) [ set alpha alpha + 1 ]
 if (count   Sp27s-here > 0) [ set alpha alpha + 1 ]
 if (count   Sp28s-here > 0) [ set alpha alpha + 1 ]
 if (count   Sp29s-here > 0) [ set alpha alpha + 1 ]
 if (count   Sp30s-here > 0) [ set alpha alpha + 1 ]
 if (count   Sp31s-here > 0) [ set alpha alpha + 1 ]
 if (count   Sp32s-here > 0) [ set alpha alpha + 1 ]
 if (count   Sp33s-here > 0) [ set alpha alpha + 1 ]
 if (count   Sp34s-here > 0) [ set alpha alpha + 1 ]
 if (count   Sp35s-here > 0) [ set alpha alpha + 1 ]
 if (count   Sp36s-here > 0) [ set alpha alpha + 1 ]
 if (count   Sp37s-here > 0) [ set alpha alpha + 1 ]
 if (count   Sp38s-here > 0) [ set alpha alpha + 1 ]
 if (count   Sp39s-here > 0) [ set alpha alpha + 1 ]
 if (count   Sp40s-here > 0) [ set alpha alpha + 1 ]
 if (count   Sp41s-here > 0) [ set alpha alpha + 1 ]
 if (count   Sp42s-here > 0) [ set alpha alpha + 1 ]
  if (count   Sp43s-here > 0) [ set alpha alpha + 1 ]
 if (count   Sp44s-here > 0) [ set alpha alpha + 1 ]
 if (count   Sp45s-here > 0) [ set alpha alpha + 1 ]
 if (count   Sp46s-here > 0) [ set alpha alpha + 1 ]
 if (count   Sp47s-here > 0) [ set alpha alpha + 1 ]
 if (count   Sp48s-here > 0) [ set alpha alpha + 1 ]
 if (count   Sp49s-here > 0) [ set alpha alpha + 1 ]
 if (count   Sp50s-here > 0) [ set alpha alpha + 1 ]
 if (count   Sp51s-here > 0) [ set alpha alpha + 1 ]
 if (count   Sp52s-here > 0) [ set alpha alpha + 1 ]
  if (count   Sp53s-here > 0) [ set alpha alpha + 1 ]
 if (count   Sp54s-here > 0) [ set alpha alpha + 1 ]
 if (count   Sp55s-here > 0) [ set alpha alpha + 1 ]
 if (count   Sp56s-here > 0) [ set alpha alpha + 1 ]
 if (count   Sp57s-here > 0) [ set alpha alpha + 1 ]
 if (count   Sp58s-here > 0) [ set alpha alpha + 1 ]
 if (count   Sp59s-here > 0) [ set alpha alpha + 1 ]
 if (count   Sp60s-here > 0) [ set alpha alpha + 1 ]
 if (count   Sp61s-here > 0) [ set alpha alpha + 1 ]
 if (count   Sp62s-here > 0) [ set alpha alpha + 1 ]
  if (count   Sp63s-here > 0) [ set alpha alpha + 1 ]
 if (count   Sp64s-here > 0) [ set alpha alpha + 1 ]
 if (count   Sp65s-here > 0) [ set alpha alpha + 1 ]
 if (count   Sp66s-here > 0) [ set alpha alpha + 1 ]
 if (count   Sp67s-here > 0) [ set alpha alpha + 1 ]
 if (count   Sp68s-here > 0) [ set alpha alpha + 1 ]
 if (count   Sp69s-here > 0) [ set alpha alpha + 1 ]
 if (count   Sp70s-here > 0) [ set alpha alpha + 1 ]
 if (count   Sp71s-here > 0) [ set alpha alpha + 1 ]
 if (count   Sp72s-here > 0) [ set alpha alpha + 1 ]
  if (count   Sp73s-here > 0) [ set alpha alpha + 1 ]
 if (count   Sp74s-here > 0) [ set alpha alpha + 1 ]
 if (count   Sp75s-here > 0) [ set alpha alpha + 1 ]
 if (count   Sp76s-here > 0) [ set alpha alpha + 1 ]
 if (count   Sp77s-here > 0) [ set alpha alpha + 1 ]
 if (count   Sp78s-here > 0) [ set alpha alpha + 1 ]
 if (count   Sp79s-here > 0) [ set alpha alpha + 1 ]
 if (count   Sp80s-here > 0) [ set alpha alpha + 1 ]
 if (count   Sp81s-here > 0) [ set alpha alpha + 1 ]
 if (count   Sp82s-here > 0) [ set alpha alpha + 1 ]
  if (count   Sp83s-here > 0) [ set alpha alpha + 1 ]
 if (count   Sp84s-here > 0) [ set alpha alpha + 1 ]
 if (count   Sp85s-here > 0) [ set alpha alpha + 1 ]
 if (count   Sp86s-here > 0) [ set alpha alpha + 1 ]
 if (count   Sp87s-here > 0) [ set alpha alpha + 1 ]
 if (count   Sp88s-here > 0) [ set alpha alpha + 1 ]
 if (count   Sp89s-here > 0) [ set alpha alpha + 1 ]
 if (count   Sp90s-here > 0) [ set alpha alpha + 1 ]
 if (count   Sp91s-here > 0) [ set alpha alpha + 1 ]
 if (count   Sp92s-here > 0) [ set alpha alpha + 1 ]
  if (count   Sp93s-here > 0) [ set alpha alpha + 1 ]
 if (count   Sp94s-here > 0) [ set alpha alpha + 1 ]
 if (count   Sp95s-here > 0) [ set alpha alpha + 1 ]
 if (count   Sp96s-here > 0) [ set alpha alpha + 1 ]
 if (count   Sp97s-here > 0) [ set alpha alpha + 1 ]
 if (count   Sp98s-here > 0) [ set alpha alpha + 1 ]
 if (count   Sp99s-here > 0) [ set alpha alpha + 1 ]
 if (count   Sp100s-here > 0) [ set alpha alpha + 1 ]

    print pxcor print pycor print alpha
  ]
end 

There is only one version of this model, created 4 months ago by George Malanson.

Attached files

File Type Description Last updated
JBI_buffer_effectiveness.png preview Preview for 'JBI_buffer_effectiveness' 4 months ago, by George Malanson Download

This model does not have any ancestors.

This model does not have any descendants.