Skip to content
Snippets Groups Projects
Commit 33196598 authored by Martin Lange's avatar Martin Lange
Browse files

setup for a minimal NetLogo model

parent 3211389e
No related branches found
No related tags found
1 merge request!2Setup for a minimal NetLogo model
Pipeline #15921 passed with stage
in 14 seconds
/model/
/odd/
......@@ -2,4 +2,39 @@
This is an example project to demonstrate Literate Programming to create [NetLogo](https://ccl.northwestern.edu/netlogo/) models from ODD+C protocols.
## setup
```netlogo
;- Setup
to setup
reset-ticks
end
```
## go
```netlogo
;- Go
to go
tick
end
```
## Appendix
### Code tab
The content of the code tab is created by simply drawing together all blocks shown above:
```netlogo
;- file:Code.nls
; ==> Setup.
; ==> Go.
```
### NetLogo file
In the main `nlogo` file, we only "include" an `nls` file to allow for the reverse mode.
The file `Model.nlogo` is simply copied from the `nlogo` directory via option `code_files` in the `[paths]` section of the `Yarner.toml`.
This separation of model code and user interface also allows to edit the model's UI elements in NetLogo's GUI builder tool, while using Literate Programming for the code.
......@@ -2,9 +2,9 @@
fence_sequence = "```"
fence_sequence_alt = "~~~"
block_name_prefix = "//-"
block_name_prefix = ";-"
macro_start = "// ==>"
macro_start = "; ==>"
macro_end = "."
transclusion_start = "@{{"
......@@ -15,29 +15,25 @@ link_prefix = "@"
file_prefix = "file:"
hidden_prefix = "hidden:"
# default_language = "rust"
[paths]
root = "lp/"
code = "../model/"
docs = "../odd/"
files = ["ODD.md"]
# entrypoint = "Main"
# code_files = ["**/*.rs"]
# code_paths = ["_"]
# doc_files = ["**/*.png", "**/*.jpg"]
# doc_paths = ["_"]
# [language.rs]
# clear_blank_lines = true
# eof_newline = true
# [language.rs.block_labels]
# comment_start = "//"
## comment_end = "*/"
# block_start = "<@"
# block_next = "<@>"
# block_end = "@>"
root = "."
code = "model/"
docs = "odd/"
files = ["README.md"]
entrypoint = "Main" # Avoids writing unnamed code blocks
# NetLogo is not suited to generate the UI from code.
# We therefore use the copy files feature for the base .nlogo file, and for UI.
code_files = ["nlogo/Model.nlogo"]
code_paths = ["-"]
[language.nls]
clear_blank_lines = true
eof_newline = true
[language.nls.block_labels]
comment_start = ";"
block_start = "<@"
block_next = "<@>"
block_end = "@>"
# Rabies model - ODD protocol
__includes["Code.nls"]
@#$#@#$#@
GRAPHICS-WINDOW
220
10
733
524
-1
-1
5.0
1
10
1
1
1
0
1
1
1
0
100
0
100
1
1
1
ticks
30.0
BUTTON
10
10
80
50
NIL
setup
NIL
1
T
OBSERVER
NIL
NIL
NIL
NIL
1
BUTTON
90
10
160
50
NIL
go
T
1
T
OBSERVER
NIL
NIL
NIL
NIL
1
@#$#@#$#@
## WHAT IS IT?
## HOW IT WORKS
## HOW TO USE IT
@#$#@#$#@
default
true
0
Polygon -7500403 true true 150 5 40 250 150 205 260 250
@#$#@#$#@
NetLogo 6.1.0
@#$#@#$#@
@#$#@#$#@
@#$#@#$#@
@#$#@#$#@
@#$#@#$#@
default
0.0
-0.2 0 0.0 1.0
0.0 1 1.0 0.0
0.2 0 0.0 1.0
link direction
true
0
Line -7500403 true 150 150 90 180
Line -7500403 true 150 150 210 180
@#$#@#$#@
0
@#$#@#$#@
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment