agentscript
Version:
AgentScript Model in Model/View architecture
40 lines (35 loc) • 1.16 kB
HTML
<html>
<head>
<title>Template</title>
</head>
<body>
<script type="module">
import Animator from 'https://agentscript.org/src/Animator.js'
import TwoDraw from 'https://agentscript.org/src/TwoDraw.js'
import Model from 'https://agentscript.org/models/TemplateModel.js'
const model = new Model()
model.setup()
const view = new TwoDraw(model, {
div: 'modelDiv',
patchSize: 20,
drawOptions: {
turtlesColor: 'yellow',
turtlesSize: 3,
turtlesShape: 'bug',
linksColor: 'red',
linksWidth: 3,
// patchesMap: 'Jet', // for bright patch colors!
},
})
const anim = new Animator(
() => {
model.step()
view.draw()
},
500, // run for 500 steps
30 // at 30 steps/second
)
</script>
<div id="modelDiv"></div>
</body>
</html>