agentscript
Version:
AgentScript Model in Model/View architecture
35 lines (27 loc) • 897 B
HTML
<html>
<head>
<title>Ants</title>
</head>
<body>
<script type="module">
import Animator from 'https://code.agentscript.org/src/Animator.js'
import TwoDraw from 'https://code.agentscript.org/src/TwoDraw.js'
import Model from 'https://code.agentscript.org/models/AntsModel.js'
import TwoDrawOptions from '../views2mv/antsOptions.js'
const patchSize = 10
const modelOptions = TwoDraw.fullScreenOptions(patchSize)
const model = new Model(modelOptions)
model.setup()
const view = new TwoDraw(model, TwoDrawOptions("modelDiv", model, patchSize))
const anim = new Animator(
() => {
model.step()
view.draw()
},
500, // how many steps
30 // at fps steps/second
)
</script>
<div id="modelDiv"></div>
</body>
</html>