range expansion

range expansion preview image

1 collaborator

Default-person carlos tonhatti (Author)

Tags

(This model has yet to be categorized with any tags)
Visible to everyone | Changeable by everyone
Model was written in NetLogo 5.2.0 • Viewed 239 times • Downloaded 26 times • Run 0 times
Download the 'range expansion' modelDownload this modelEmbed this model

Do you have questions or comments about this model? Ask them here! (You'll first need to log in.)


Comments and Questions

Please start the discussion about this model! (You'll first need to log in.)

Click to Run Model

extensions[profiler] 
extensions[bitmap]
extensions[matrix]

globals [ arrive arrived chance-to-stay    x y c bd mutx muty  t.dimension]
;turtles-own[]

to setup 
  clear-all
  create-turtles 1 
  ask turtles [ setxy 0 random-ycor set color violet + 3 set shape "dot"]
  set chance-to-stay 1 - migration
   
  
    ; point of mutation
  set mutx 10
  set muty random-ycor
  ask patch  mutx muty [set pcolor green]
  set arrive false
  set arrived false
  reset-ticks
  set x 0
  set y 0
  set c 0
end 

to go   
  ;profiler:start
    reproduce-turtles
    ask patch mutx muty[if any? turtles-here [set arrive true]]
    if arrive = true[ 
                      if arrived = false
                           [ask patch mutx muty [ask turtles-here [set color blue]] 
                            ask turtles [set arrived true]
                           ]
                            ]
    cut2 
    tick
   ;profiler:stop
   ;print profiler:report
   ;profiler:reset
end 

to reproduce-turtles
       ask turtles [hatch random-poisson g [
                                         if random-float 1.0 < chance-to-stay
                                          [stop] 
         
                                         let neigb count neighbors4 
                                          if random-float 1.0 <  migration / neigb 
                                           [rt one-of [0 90 180 270] fd 1]
                                        ] 
                   ]    
end 

to cut2
  ask patches[
  let lista 0
  let num-turtles count turtles-here
  let diff num-turtles - carrying-capacity
  
  if  diff > 0
     [ repeat diff [
                 ask turtles-here [set lista [who] of turtles-here]
                 let to-die one-of lista
                 ask turtle to-die [die]]
     ]
  ]
end 

to-report howmany
  let how 0
  ask patch 0 0 [set how count turtles-here]
   report how
end 

to-report total 
  let total-t 0
  ask turtles [set total-t count other turtles]
  report total
end 

to-report time
  report ticks
end 

to-report extinction
     let extinct false
    if not any? turtles with [color = blue] and arrived = true
    [set extinct true]
    report extinct
end 

;to-report turtlesdimension
 ;  
 ; ask turtles [set x [xcor] of turtles
  ;             set y [ycor] of turtles
   ;            set c [color]of turtles]
  
   ;ask turtles [set t.dimension matrix:from-column-list [[x] [y] [c]]]
 ;report t.dimension
;end
 ;; not in use
  ;;
;to blue-dimension
 ;    
  ;    if any? turtles with [color = blue]
   ;     [ask one-of turtles [set bd-max-x max [xcor] of turtles with [color = blue]
;                      set bd-min-x min  [xcor] of turtles with [color = blue]
;                      set bd-max-y max [ycor] of turtles with [color = blue]
;                      set bd-max-y min [ycor] of turtles with [color = blue]
;                      ]
;        ]
;       
;  print (list bd-max-x bd-min-x bd-max-y bd-min-y)
;end
 


 
  ;;
  ;;
  ;;
  ;;
  ;;
  ;;
  
  ;to cut
  ;let num-turtles count turtles 
  ;:if num-turtles <= carrying-capacity
  ;[stop]
  
  ;let chance-to-die ( num-turtles - carrying-capacity)/ num-turtles
  ;ask turtles 
  ;[
   ; if random-float 1.0 < chance-to-die
   ; [die]
  ;]
  
;end

to move-turtles
  ask turtles[
       ; let chance-to-stay 1 - migration
        if random-float 1.0 < chance-to-stay
         [stop] 
         
        let neigb count neighbors4 
        if random-float 1.0 <  migration / neigb 
         [rt one-of [0 90 180 270] fd 1]
         ]     
end 

to reproduce-turtles2
    ask turtles [hatch random-poisson 2 []]    
end 

There is only one version of this model, created about 10 years ago by carlos tonhatti.

Attached files

File Type Description Last updated
range expansion.png preview Preview for 'range expansion' about 10 years ago, by carlos tonhatti Download

This model does not have any ancestors.

This model does not have any descendants.