Advertisement
Guest User

Untitled

a guest
Jul 27th, 2016
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.76 KB | None | 0 0
  1. to setup
  2. clear-all
  3. setup-turtles
  4. reset-ticks
  5. ask turtles [ set size 1 ]
  6. end
  7.  
  8. to setup-turtles
  9. create-vegetatives 1
  10. ask turtles [
  11. setxy random-xcor random-ycor
  12. set shape "circle"
  13. set color 65]
  14. end
  15.  
  16. to go
  17. divide
  18. add-age
  19. move
  20. differentiate
  21. tick
  22. end
  23.  
  24. turtles-own [age
  25. bump
  26. inh
  27. pro
  28. proL]
  29.  
  30.  
  31. breed [vegetatives vegetative]
  32. breed [heterocysts heterocyst]
  33.  
  34. to add-age
  35. ask turtles [
  36. set age age + 1
  37. ifelse show-age?
  38. [ set label age ]
  39. [ set label "" ]
  40. ]
  41. end
  42.  
  43.  
  44. to divide
  45. ask vegetatives [
  46. if random 100 < 2 [
  47. hatch 1[
  48. set bump 1
  49. set age age - 1
  50. set inh 0
  51. ]
  52. ]]
  53. end
  54.  
  55. ;;Trying to get only one turtle per patch, making the others move
  56. to move
  57. ask turtles[
  58. while [bump = 1] [
  59. ifelse not any? turtles-on patch-right-and-ahead 180 1[
  60. rt 180
  61. fd 1
  62. set bump 0
  63. if any? other turtles-here[
  64. ask other turtles-here
  65. [set bump 1]
  66. ]
  67. ]
  68. [fd 1
  69. set bump 0
  70. if any? other turtles-here[
  71. ask other turtles-here[
  72. set bump 1]
  73. ]
  74. ]
  75. ]]
  76. end
  77.  
  78.  
  79. to differentiate
  80. ask turtles[
  81. set pro (pro - inh + (random 2))
  82. set proL round pro
  83. ifelse show-proL?
  84. [ set label PatS ]
  85. [ set label "" ]
  86. create-links-with other turtles-on patch-ahead 1
  87. create-links-with other turtles-on patch-right-and-ahead 180 1
  88. if breed = vegetatives [
  89. if any? link-neighbors[
  90. ifelse any? link-neighbors with [breed = heterocysts]
  91. []
  92. [set inh mean [inh] of link-neighbors]
  93. ]
  94. if any? vegetatives with [pro > 50]
  95. [ask vegetatives with [pro > 50]
  96. [set breed heterocysts
  97. set color brown
  98. set shape "circle"
  99. if any? link-neighbors[
  100. ask link-neighbors with [breed != heterocysts]
  101. [set inh 2]]
  102. ]]
  103. ]]
  104. clear-links
  105. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement