II would like to save in a line only a number and after that to go to the next line. Here is a sample of my code file-open "energy.txt" ask ants [set...
Dragos, ... One way is to use file-print "" after each file-write, like this: file-open "energy.txt" ask ants [ set energy_total energy_total + energy ...
II would like to save in a line only a number and after that to go to the next line. *-SNIP DO YOU KNOW WHAT CAN I TYPE HERE "file-write energy_total" in order...
Martin Rudbeck Jepsen
mrj@...
Feb 2, 2005 4:31 pm
2585
Thank you Martin, Thank you Jim. It is working now. Dragos Jim Lyons <jimlyons@...> wrote: Dragos, ... One way is to use file-print "" after each...
The main difference between Martin and Jim's solutions is this: With file-write, a space is added after each entry, no new-line is added, and strings are...
Hello, I`m new here and I have one question: Turtles have a unique ID "who". But Patches? Is there a way to provide patches with a unique ID like "who"? I...
" Is there a way to provide patches with a unique ID like "who"?" Right yesterday I had to solve exactly this problem. See the attached modell file as one...
Thorsten Schmidt
THO_SCHMIDT@...
Feb 3, 2005 8:51 pm
2589
Hello Thorsten, You could try: to pid ca ask patches[set plabel pxcor + 221 - (21 * pycor)] end Regards, Derek...
Derek Rush
derekrush@...
Feb 4, 2005 3:12 am
2590
As a side note,a general form to assign ascending numbers (l to r, t to b) to patches is: set patch-id ( (pxcor + screen-edge-x) + (screen-size-x * ...
Here's another solution: Patches AND Turtles both have another important, and unique, identifier: The turtle, or patch, itself. You can store a reference to a...
... Hello Derek, it took me a while to understand, why this mini code snippet is working. Really an elegant way to do it! Thank you a lot, simplicity rocks, ...
Thorsten Schmidt
THO_SCHMIDT@...
Feb 4, 2005 3:40 pm
2593
Dear Netlogoers, I am struggling for days now to link groups of patches to a turtle! I am modeling land use where farmers (i.e. 28 turtles) own individual...
Lilibeth Acosta-Michlik
acosta@...
Feb 7, 2005 2:48 pm
2594
... You seem to be off to a good start by creating a patch variable like "owner." The trick is to also create a turtle variable that holds the same value,...
Dear Dr. Lilibeth Acosta-Michlik, I would think that the first thing you have to do is to assign the patches to the turtles. Do you have an idea about how the...
Martin Rudbeck Jepsen
mrj@...
Feb 8, 2005 1:50 pm
2596
... The two simplest ways to do this are to either assign the farmer turtle itself to the ownership variable of the patch, or to assign the agentset of patches...
John S. Erickson <john.erickson@...> ... Yes. A simimlar approach, when creating a many-to-many relationships, such as groups of farmers jointly owning...
Is it possible to run i.e. two dimension cellular automata such as each agent/patch/square change is state simultaneously with the others ( actually this is...
hey there! i was just wondering if anyone could help me write a procedure to-report factorial [n] which calculates the value of n! in netlogo please help me...
... It sure is. For this sort of "simultaneous" your cells need to store their states in two places, for example, "current-state" and "new-state" The cells...
to-report factorial [n] let c 1 let f 1 repeat n [ set f f * c set c c + 1 ] report f end ciao, bg chabo1130 <chabo1130@...> wrote: hey there! i was just...
here's another version: to-report factorial [ n ] report ifelse-value ( n = 0 ) [ 1 ] [ n * factorial ( n - 1 ) ] end be careful of hitting netlogo's largest...
Here's another version! to-report factorial [ n ] report ifelse-value n = 0 [ 1 ] [ reduce [ ?1 * ?2 ] (n-values n [ 1.0 + ? ] ) ] end ;; if n is 0, report...
... Of course. There are many examples of cellular automata included in the NetLogo models library. Look in Sample Models -> Computer Science -> Cellular...
A shorter solution uses recursion: to-report factorial [n] if n = 1 [ report 1 ] report n * factorial (n - 1) end -- Andrei Scheinkman, NetLogo Developer ...
... Shorter, eh? Let's late a look at the solutions provided so far! Notes: Andrei's solution as posted tested on (n=1) which prevented it from correctly...
... Oops. I also changed the if to if else, eliminating the *implied* else. Did that almost automatically. Sorry. As written, Andrei's code would have been...
Hello, I am iterating turtles randomly by foreach shuffle values-from turtles [self] [ ask ? [ ... ] ] but they kill each other (some turtles are dead by their...
... phidippus> How do I skip dead turtles? see http://ccl.northwestern.edu/netlogo/docs/faq.html#dead -- Seth Tisue / seth@... / (847) 467-2814 lead...
Well, you could do this: foreach turtle-list [ if ? != nobody [ ask ? [ ... ] ] ] But I have developed a way to create a randomly ordered normal agentset. A...