A template for a NetLogo model to be released under the GNU General Public Licence. Includes a handful of other elements part of good practice:
- A
ChangeLog
section of the Info tab in which you record modifications you've made in the code tab. There is a Wikipedia page on ChangeLog if you want to know more, and various other resources on the web. - A
.gitignore
that has entries forData*
anddata*
so that if you copy the contents of this folder into your own repository for collaborating on code, you don't accidentally end up copying potentially sensitive or licensed data to a public repository..gitignore
will also ignore NetLogo temporary files (.*.tmp.nlogo
) and OS temporary filesIcon
(Windows) and.DS_Store
(Mac OSX) - Switch and input for seed control.
- Unit testing utilities. The
unit-test
procedure can be used to run unit tests (if edited to call procedures implementing them). Procedures implementing unit tests should callassert-list-equals
,assert-equals
,assert-true
andassert-false
when checking functionality is as expected. - Output area for progress, notes and warning messages. Use
output-error
instead of the built-inerror
command, as this sets theerror?
flag as well as displaying the message.output-warning
is provided to give a warning message (a non-fatal error that may suggest a problem, but the program can continue to run),output-note
is provided to give the user noteworthy information about the run, andprint-progress
is provided to write a message advising the user of important stages reached during the run -- which can be helpful for long-running procedures to reassure them that the model is making an advance, and is not hung. - A
error?
flag to record whether an error has happened. This is set automatically whenoutput-error
is called with a string argument containing the error message. In additioncarefully [] []
is wrapped around the model-specific code so that theerror?
flag is set if there is an unexpected runtime error. This is important when running the model in headless mode.