www. iemar. tuwien. ac. at
ask turtle 0 [print shape] print (word „The shape is “ shape)
ask turtles with […] [ print ] watch turtle 0 watch one-of turtles
ask patch 0 0 [ print pcolor ; you are patch 0 0 ] ; you are observer print [pcolor] of patch 0 0
[color] of turtles
let mortality (list print mortality 15 14 16 13 14 15 14 )
let mortality (list 15 14 16 13 14 15 14) set mortality lput 13 mortality print mortality
print first mortality set mortality but-first mortality print empty? mortality print 3 mortality print mortality
Add a plot to your model…
In hospital-1. nlogo, type the following into observer>: print [popul] of patches …to get the list of population sizes per patch. then type the following: set-histogram-num-bars 3 histogram [popul] of patches
to total-population let total 0 ask patches [ set total (total + popul) ] ; total now contains the ; sum of all popul end let mylist [popul] of patches let total mylist
e. g. data. wien. gv. at (list 15. 5 …)
… ask turtle 0 [ ask print self ] ] ask patch 0 0 [ ask print self ] ] [ [
Links are an own breed, which is created by a turtle: ask person 0 [ create-link-with turtle 1 ] Any breed can be linked. Links can be both directed and undirected, although we will only cover the latter ones in this tutorial (refer to Net. Logo Dictionary for directed ones). Furthermore, you can create breeds of links, which is also not covered in this course.
ask person 0 [ create-link-with turtle 1 create-link-with turtle 2 ] ask person 0 [ ask link-neighbors with […] [ print self ] ]
breed [persons person] … create-persons 1 [ let holder self create-turtles 1 [ create-link-with holder set xcor random-xcor set ycor random-ycor ] ]
ask turtle 0 [ ask patch 0 0 [ … ] ]
ask turtle 0 [ let the-turtle self ask patch 0 0 [ set pcolor [color] of the-turtle ] ]
to-report add [x y] let result (x + y) report result end to setup print water-patches end to-report water-patches report patches with [pcolor = SKY] end
to move-turtles [ in-direction how-far ] ask turtles [ set heading in-direction forward how-far ] end