Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- to setup
- clear-all
- setup-turtles
- reset-ticks
- ask turtles [ set size 1 ]
- end
- to setup-turtles
- create-vegetatives 1
- ask turtles [
- setxy random-xcor random-ycor
- set shape "circle"
- set color 65]
- end
- to go
- divide
- add-age
- move
- differentiate
- tick
- end
- turtles-own [age
- bump
- inh
- pro
- proL]
- breed [vegetatives vegetative]
- breed [heterocysts heterocyst]
- to add-age
- ask turtles [
- set age age + 1
- ifelse show-age?
- [ set label age ]
- [ set label "" ]
- ]
- end
- to divide
- ask vegetatives [
- if random 100 < 2 [
- hatch 1[
- set bump 1
- set age age - 1
- set inh 0
- ]
- ]]
- end
- ;;Trying to get only one turtle per patch, making the others move
- to move
- ask turtles[
- while [bump = 1] [
- ifelse not any? turtles-on patch-right-and-ahead 180 1[
- rt 180
- fd 1
- set bump 0
- if any? other turtles-here[
- ask other turtles-here
- [set bump 1]
- ]
- ]
- [fd 1
- set bump 0
- if any? other turtles-here[
- ask other turtles-here[
- set bump 1]
- ]
- ]
- ]]
- end
- to differentiate
- ask turtles[
- set pro (pro - inh + (random 2))
- set proL round pro
- ifelse show-proL?
- [ set label PatS ]
- [ set label "" ]
- create-links-with other turtles-on patch-ahead 1
- create-links-with other turtles-on patch-right-and-ahead 180 1
- if breed = vegetatives [
- if any? link-neighbors[
- ifelse any? link-neighbors with [breed = heterocysts]
- []
- [set inh mean [inh] of link-neighbors]
- ]
- if any? vegetatives with [pro > 50]
- [ask vegetatives with [pro > 50]
- [set breed heterocysts
- set color brown
- set shape "circle"
- if any? link-neighbors[
- ask link-neighbors with [breed != heterocysts]
- [set inh 2]]
- ]]
- ]]
- clear-links
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement