Netlogo: Set specific setxy patern with set number of turtles? -


is possible create set number of turtles, file, have own patches? in same location?

i've got 106 turtles i'm reading in file , hoping have them created on own patches, square latice kind of thing. want able @ model world , identify turtle.

file-open "turtledata_a.txt" show file-read-line while [not file-at-end?]  [ set param read-from-string (word "[" file-read-line "]") create-turtles 1 [setxy ??] ] file-close  ] 

probably easiest use csv extension , add xy data file you're reading in. example, if have turtle_data.csv file looks like:

param-to-read,x,y john,-10,10 billy,-5,5 bob,0,0 simon,5,-5 michael,10,-10 

you can do:

extensions [ csv ]  turtles-own [ param ]  setup   ca   reset-ticks   file-close-all   file-open "turtle_data.csv"    ;; read headings line in skip data extraction   let headings csv:from-row file-read-line    while [ not file-at-end? ] [     let data csv:from-row file-read-line     create-turtles 1 [       set param item 0 data       setxy item 1 data item 2 data     ]   ]    file-close-all end 

which give like:

enter image description here

then can modify x , y values in .csv file place turtles want them. work?

of course, can add other columns in .csv file (like color, size, shape, etc) identify turtles @ glance.


Comments

Popular posts from this blog

php - Vagrant up error - Uncaught Reflection Exception: Class DOMDocument does not exist -

vue.js - Create hooks for automated testing -

Add new key value to json node in java -