Published
Edited
Apr 19, 2021
Importers
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
states = ['traitor', 'enabler', 'victim', 'bystander', 'helper']
Insert cell
colormap = t => d3.interpolateSpectral(.1 + t * .9)
Insert cell
Insert cell
Insert cell
conditions = db => [
(u, vs, links) =>
!vs.map(v => db.node(v).state).every(s => s == 'traitor') &&
vs.map(v => db.node(v).state).some(s => s == 'victim'),
(u, vs, links) =>
!vs.map(v => db.node(v).state).every(s => s == 'enabler') &&
vs.map(v => db.node(v).state).some(s => s == 'traitor'),
(u, vs, links) =>
!vs.map(v => db.node(v).state).every(s => s == 'victim') &&
vs.map(v => db.node(v).state).some(s => s == 'traitor'),
(u, vs, links) => true, // !vs.map(v => db.node(v).state).every(s => s == 'bystander'),
(u, vs, links) =>
!vs.map(v => db.node(v).state).every(s => s == 'helper') &&
vs.map(v => db.node(v).state).some(s => s == 'victim')
]
Insert cell
mutable tick = 0
Insert cell
Insert cell
Insert cell
Insert cell
mutable focus = "A"
Insert cell
Insert cell
wedges(focus)
Insert cell
triples(focus)
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
social = {
perturb;
return wfc(shape, false);
}
// shape.setNode("D", null); // to test resolution
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
town
Insert cell
{
let ret = html`<svg width=${width} height=500></svg>`;
yield ret;

render(ret, town);
yield ret;
}
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
/* states = ['fine', 'stressed', 'upset']
conditions = db => [
// edit me - these are simple, 'I can't match any neighbor' conditions
(reactor, kith, links) =>
!kith.map(v => db.node(v).state).some(s => s == 'upset'),
(reactor, kith, links) =>
!kith.map(v => db.node(v).state).some(s => s == 'stressed'),
(reactor, kith, links) =>
!kith.map(v => db.node(v).state).some(s => s == 'stressed')
]
.fine rect { fill: #aaaaaa; }
.stressed rect { fill: #aa8888; }
.upset rect { fill: #aa5555; }*/
Insert cell

Purpose-built for displays of data

Observable is your go-to platform for exploring data and creating expressive data visualizations. Use reactive JavaScript notebooks for prototyping and a collaborative canvas for visual data exploration and dashboard creation.
Learn more