

Not quite as nice as embedding, but it’ll work. and Programming Guides and the NetLogo Dictionary. To use it just save what’s below as a text file with the extension to “.nlogo”. We expect you to learn the basic elements of NetLogo mainly by.

and then create 20 turtles (crt 20 is short for create-turtles 20). NetLogo is a programmable modeling environment for simulating complex systems. nlogo file is just a text file so I can put the whole thing in the post, including the GUI elements. Net Logo is a programming language for simulating interactions between agents in a. Set-current-plot "Totals" set-current-plot-pen "adoptions" plot count turtles with In lieu of embedding the whole simulation, here’s the “procedure” source code, which will only work if you hook the variables “constant-hazard” and “endogenous-hazard” and the plot-pen “Totals:adoption” to GUI elements. Even doing it locally on my mac, the embed doesn’t works in Safari (but does work in Chrome, Firefox, and Opera).
#Netlogo crt how to#
Note that in theory you can embed a NetLogo simulation in a webpage but I don’t know how to get WordPress to do this. So while this sim doesn’t do anything new it’s nice that I can extend it to do new things. (Actually the model library already has this in the form of the “virus on a network” model but the point is that it’s flexible). The really exciting thing though is that NetLogo makes it much easier to do simulations with network and/or spatial structure so I could refine the model to have structure. After just a few hours of reading the tutorial, I was able to write the script below, which is kind of a replication of an older Stata script. The basic “models library” includes biology models like wolf-sheep as well as some social science models that I already lecture on but didn’t have a dynamic illustration for, most notably Barabasi’s preferential attachment model and the team assembly model Uzzi et al developed on Broadway musicals. Every time you're tempted to use an index of some kind in your code, take a step back and think again: there is probably a better (as in "more netlogoish") way to do it.As part of my prep work for attending James Kitts’ “ Modeling Emergence” workshop at ASA I’ve been playing with NetLogo and there’s some really cool stuff in there. I don't know what you're ultimately trying to achieve, but if I could offer general advice, it would be to try to embrace to NetLogo mindset. If threshhold > 0 and threshhold < variable-x [ caand crtcan only be run by the observer.
#Netlogo crt code#
(If you don't specify, the code is run by the observer.) In the code above, the observer uses askto make the set of all turtles run the commands between the square brackets. You could do something along the lines of: globals [ In NetLogo, you must specify which agents - turtles, patches, or the observer - are to run each command. NetLogo's world is a world of turtles and patches and links, not a world of arrays and indices and numbers. That being said, as much as I think it is fun to play with lists, I think you are approaching your problem in a very unnetlogoish way. Here is a somewhat verbose test to check that both versions would give you the expected results: globals [ Set variable-list map new-value range length variable-list Set variable-list replace-item i variable-list new-value i There are a few different ways to approach the problem, but if I was in your situation, I would first write a small reporter that gives me the value that should be stored at each index: to-report new-value
