code:
turtles-own [closest-turtle]
to setup
to setup
;clear-all
;; (for this model to work with NetLogo's new plotting features,
;; __clear-all-and-reset-ticks should be replaced with clear-all at
;; the beginning of your setup procedure and reset-ticks at the end
;; of the procedure.)
__clear-all-and-reset-ticks ;stand for clear all and it is the compact syntax of clear-all
;; (for this model to work with NetLogo's new plotting features,
;; __clear-all-and-reset-ticks should be replaced with clear-all at
;; the beginning of your setup procedure and reset-ticks at the end
;; of the procedure.)
__clear-all-and-reset-ticks ;stand for clear all and it is the compact syntax of clear-all
;here we will prepare the ingredients
create-turtles 200
; crt 1 this is a compact syntax
; crt 1 this is a compact syntax
ask turtles [
;at thi part we can give specify characteristics of the turtles
setxy random-xcor random-ycor
set heading 0
set size 1
;set shape "circle"
set color 9.9
setxy random-xcor random-ycor
set heading 0
set size 1
;set shape "circle"
set color 9.9
]
end
to go
;ready steady cook
let angled 10
ask turtles [
;pd
fd step
fd step
repeat 100 [
right angled + random 25
]
right angled + random 25
]
]
end
to repel
ask turtles [
set closest-turtle min-one-of other turtles [distance myself]
if closest-turtle != nobody [
face closest-turtle
bk .1
set closest-turtle min-one-of other turtles [distance myself]
if closest-turtle != nobody [
face closest-turtle
bk .1
]
]
end
to drawlink
ask turtles [
set closest-turtle min-one-of other turtles [distance myself]
create-link-with closest-turtle
set closest-turtle min-one-of other turtles [distance myself]
create-link-with closest-turtle
]
end