Skip to content

Commit c2a71d8

Browse files
rtmandreyevclaude
andcommitted
Example: Simple Viral Marketing, a live NetLogo model drawn as a construct
- examples/netlogo-viral-marketing/: NetLogo's Simple Viral Marketing (© 2012 Uri Wilensky), rebuilt to run live in the browser, with the exported NetLogo run and the construct of that run; the page's design is unchanged except the neutral "100 BehaviorSpace runs" wording and a credit and licence line in its existing style - that folder is CC BY-NC-SA 3.0, like the model it derives from: its own LICENSE and README, and NOTICE, README and PUBLISHING say so - the gallery: a "Beyond objects" section (examples/beyond.json) whose pages are published as they are, beside the construct of their scene Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
1 parent 38ecafa commit c2a71d8

14 files changed

Lines changed: 1063 additions & 11 deletions

File tree

‎NOTICE‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,5 +21,13 @@ independent reconstructions from public references; the scenes cite those refere
2121
include no reference photograph. Product, vehicle and place names belong to their owners, and
2222
no endorsement is implied.
2323

24+
One folder is licensed differently: examples/netlogo-viral-marketing/ derives from NetLogo's
25+
Simple Viral Marketing model, Copyright 2012 Uri Wilensky (NetLogo Models Library; Wilensky &
26+
Rand, An Introduction to Agent-Based Modeling, MIT Press, 2015), licensed under Creative Commons
27+
Attribution-NonCommercial-ShareAlike 3.0. Everything in that folder (its page, its JavaScript
28+
port of the model, the exported NetLogo run and its construct) is under CC BY-NC-SA 3.0, not
29+
MIT; see its LICENSE. That page loads three.js from cdn.jsdelivr.net and its fonts from Google
30+
Fonts when opened; nothing from it is bundled into the toolkit or its packages.
31+
2432
History: extracted from the hologram-skill branch of the Tessera project, where the same
2533
author wrote it (first under Apache-2.0); relicensed under MIT by its author.

‎PUBLISHING.md‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,4 +97,5 @@ needed), draw its poster with `python3 scripts/gallery_images.py <slug>`, and re
9797

9898
Nothing but static files: every link is relative, each construct is one self-contained
9999
`construct.html` (plain WebGL2, no external scripts, fonts or styles), and `.nojekyll` tells
100-
GitHub Pages to serve the files as they are. It is about 41 MB.
100+
GitHub Pages to serve the files as they are. The pages under Beyond objects (`examples/beyond.json`) are published as
101+
they are and may load from other hosts: the NetLogo page loads three.js and its fonts from CDNs. It is about 90 MB, most of it the three films.

‎README.md‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,9 @@ See [CONTRIBUTING.md](CONTRIBUTING.md). Run the tests with
204204

205205
## License
206206

207-
[MIT](LICENSE) — Copyright (c) 2026 Artyom Andreyev.
207+
[MIT](LICENSE) — Copyright (c) 2026 Artyom Andreyev. One example folder,
208+
[examples/netlogo-viral-marketing/](examples/netlogo-viral-marketing/), derives from Uri Wilensky's
209+
NetLogo model and is under CC BY-NC-SA 3.0 instead (see its LICENSE).
208210

209211
Construct's working method is inspired by [Anatomy](https://github.com/wheresryan22/anatomy)'s
210212
truth-first construction (MIT); it shares the method, not code. Product, vehicle and place names

‎construct_hologram/test_package.py‎

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -163,11 +163,13 @@ def test_the_site_has_only_relative_links_that_resolve(self):
163163
out = site.build(Path(d, "site"))
164164
self.assertTrue((out / ".nojekyll").exists())
165165
pages = [p for p in out.rglob("*.html") if p.name != "construct.html"]
166-
self.assertEqual(len([p for p in pages if p.name == "index.html"]), len(site._load_examples()) + 1)
166+
beyond = {b["slug"] for b in site._load_beyond()}
167+
self.assertEqual(len([p for p in pages if p.name == "index.html"]), len(site._load_examples()) + len(beyond) + 1)
167168
for page in pages:
169+
own = page.parent.name in beyond # a "beyond" page, published as it is: its fonts, licence link
168170
for ref in re.findall(r'(?:href|src)="([^"]+)"', page.read_text(encoding="utf-8")):
169171
if ref.startswith(("https://", "http://")):
170-
self.assertTrue(ref.startswith((site.SITE_URL, site.REPO_URL)), (page, ref))
172+
self.assertTrue(own or ref.startswith((site.SITE_URL, site.REPO_URL)), (page, ref))
171173
continue
172174
target = (page.parent / ref.split("?")[0]).resolve()
173175
if ref.endswith("/"):
@@ -183,6 +185,19 @@ def test_the_site_has_only_relative_links_that_resolve(self):
183185
html_ = (out / "examples" / "leica-m3" / "construct.html").read_text(encoding="utf-8")
184186
self.assertIsNone(re.search(r'<script[^>]+src=|<link[^>]+href="http', html_)) # self-contained
185187

188+
def test_the_netlogo_example_keeps_its_licence_and_credit(self):
189+
from . import diagnose
190+
d = HERE.parent / "examples" / "netlogo-viral-marketing"
191+
page = (d / "index.html").read_text(encoding="utf-8")
192+
self.assertIn("© 2012 Uri Wilensky", page) # the credit, on the page itself
193+
self.assertIn("https://creativecommons.org/licenses/by-nc-sa/3.0/", page)
194+
self.assertIn("NetLogo, 100 BehaviorSpace runs", page) # the neutral wording
195+
self.assertNotRegex(page, r"(?i)week 2|my behaviorspace|/Users/|@asu")
196+
self.assertIn("CC BY-NC-SA 3.0", (d / "LICENSE").read_text(encoding="utf-8"))
197+
self.assertIn("Uri Wilensky", (d / "README.md").read_text(encoding="utf-8"))
198+
self.assertIn("examples/netlogo-viral-marketing/", (HERE.parent / "NOTICE").read_text(encoding="utf-8"))
199+
self.assertTrue(diagnose.diagnose_text((d / "scene.json").read_text(encoding="utf-8"))["ok"])
200+
186201
def test_every_film_is_complete_and_checks_clean(self):
187202
from . import diagnose
188203
root = HERE.parent / "examples"

‎examples/beyond.json‎

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{
2+
"format": "construct-beyond",
3+
"version": 1,
4+
"beyond": [
5+
{
6+
"slug": "netlogo-viral-marketing",
7+
"title": "Simple Viral Marketing (NetLogo)",
8+
"line": "A NetLogo agent-based model of viral marketing, rebuilt to run live in the browser and drawn as a construct.",
9+
"label": "live model · DeepSeek V4.1 Flash scene",
10+
"credit": "Model © 2012 Uri Wilensky · CC BY-NC-SA 3.0",
11+
"files": ["index.html", "svm-model.js", "netlogo-run.js", "scene.json", "LICENSE", "hero.jpg", "thumb.jpg"]
12+
}
13+
]
14+
}
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
This folder (examples/netlogo-viral-marketing/) is licensed differently from the rest of Construct.
2+
3+
Simple Viral Marketing
4+
Copyright 2012 Uri Wilensky.
5+
NetLogo Models Library; Wilensky, U. & Rand, W. (2015). An Introduction to Agent-Based Modeling:
6+
Modeling Natural, Social, and Engineered Complex Systems with NetLogo. MIT Press.
7+
8+
The model is licensed under the Creative Commons Attribution-NonCommercial-ShareAlike 3.0 License.
9+
Everything in this folder derives from it: the page (index.html), the port of the model to
10+
JavaScript (svm-model.js), the exported NetLogo run (netlogo-run.js), the construct scene of that
11+
run (scene.json) and its pictures. They are therefore distributed under the same license:
12+
13+
Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported (CC BY-NC-SA 3.0)
14+
https://creativecommons.org/licenses/by-nc-sa/3.0/
15+
Legal code: https://creativecommons.org/licenses/by-nc-sa/3.0/legalcode
16+
17+
NetLogo itself is free software under the GNU General Public License; see
18+
https://ccl.northwestern.edu/netlogo/docs/copyright.html. The rest of Construct, outside this
19+
folder, is under the MIT License (see the LICENSE file at the root of the repository).
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
# Simple Viral Marketing, live
2+
3+
[![The live model: the social network on the floor, each adoption rising to the moment it happened, the gold disc marking now](hero.jpg)](https://rtmandreyev.github.io/construct/examples/netlogo-viral-marketing/)
4+
5+
**[Open the live model →](https://rtmandreyev.github.io/construct/examples/netlogo-viral-marketing/)** · or
6+
[the construct](https://rtmandreyev.github.io/construct/examples/netlogo-viral-marketing/construct.html)
7+
of one NetLogo run
8+
9+
An example of what Construct can be used for beyond objects: NetLogo's **Simple Viral Marketing**
10+
agent-based model, rebuilt to run live in the browser and drawn as a construct. Five hundred people
11+
and one product: the floor is who knows whom, and height is when each person adopted. You can set
12+
up a network, run it tick by tick, scrub the timeline, trace who convinced whom, and run it 100
13+
times to compare with NetLogo's own BehaviorSpace results.
14+
15+
**Credit:** *Simple Viral Marketing* © 2012 Uri Wilensky, NetLogo Models Library (Wilensky, U. &
16+
Rand, W., *An Introduction to Agent-Based Modeling*, MIT Press, 2015), licensed under
17+
[CC BY-NC-SA 3.0](https://creativecommons.org/licenses/by-nc-sa/3.0/).
18+
19+
**License:** unlike the rest of Construct (MIT), **this folder is under CC BY-NC-SA 3.0**, because
20+
everything in it derives from the model: the page, the port of the model, the NetLogo run and the
21+
construct. See [LICENSE](LICENSE).
22+
23+
## How it was made
24+
25+
1. **NetLogo.** One run of the model in NetLogo 7.0.4 (random network, 500 people, betweenness
26+
seeding, budget 3, random-seed 2026), run through BehaviorSpace and exported: each person's
27+
adoption tick, its cause (seed, advertising or a neighbour) and the network as NetLogo laid it
28+
out. The decision rule is the library model's, unchanged. The export is `netlogo-run.js`.
29+
2. **The construct.** That run, turned into exact polylines, was written into a Construct scene by
30+
DeepSeek V4.1 Flash, over check-and-repair and art-direction rounds (`scene.json`); Construct
31+
builds it into [construct.html](https://rtmandreyev.github.io/construct/examples/netlogo-viral-marketing/construct.html).
32+
3. **The live page.** The model rebuilt rule for rule in JavaScript (`svm-model.js`), by Claude
33+
Opus 5.5, so it runs in the browser, and a page (`index.html`) that draws it in Construct's
34+
Measured Light style, tick by tick. The port uses its own random-number generator, so a seed
35+
here is not a NetLogo seed; over 100 runs per budget its mean times to 50, 90, 95 and 99%
36+
adoption came within 0 to 9 ticks of NetLogo's BehaviorSpace means, and full adoption within its
37+
wide run-to-run spread.
38+
39+
Unlike the other examples, the page is not a Construct page: it loads three.js 0.160.0 from
40+
cdn.jsdelivr.net and its fonts (Instrument Serif, IBM Plex Mono) from Google Fonts, so it needs an
41+
internet connection. It opens from any static host or straight from disk. URL options:
42+
`?source=netlogo` (replay the NetLogo run), `?t=<tick>`, `?orbit=0`.
43+
44+
The "who convinced whom" line credits one adopted neighbour at random, a drawing choice: the
45+
model's rule uses the share of adopted neighbours, not one person.
162 KB
Loading

0 commit comments

Comments
 (0)