1 | <html>
|
2 |
|
3 | <head>
|
4 | <title>Pheromone1</title>
|
5 | </head>
|
6 |
|
7 | <body>
|
8 | <div id="modelDiv"></div>
|
9 |
|
10 | <script type="module">
|
11 | import * as util from 'https://code.agentscript.org/src/utils.js'
|
12 | import TwoDraw from 'https://code.agentscript.org/src/TwoDraw.js'
|
13 | import ColorMap from 'https://code.agentscript.org/src/ColorMap.js'
|
14 | import Animator from 'https://code.agentscript.org/src/Animator.js'
|
15 |
|
16 | import Model from './PheromoneModel.js'
|
17 |
|
18 | const colorMap = ColorMap.gradientColorMap(
|
19 | 8, ['black', 'purple', 'yellow']
|
20 | )
|
21 |
|
22 | const model = new Model()
|
23 | model.setup()
|
24 |
|
25 | const view = new TwoDraw(model, {
|
26 | div: 'modelDiv',
|
27 | patchSize: 20,
|
28 | drawOptions: {
|
29 | turtlesSize: 2,
|
30 | patchesColor: (p) => colorMap.scaleColor(p.pheromone, 0, 100)
|
31 | }
|
32 | })
|
33 |
|
34 | const anim = new Animator(
|
35 | () => {
|
36 | model.step()
|
37 | view.draw()
|
38 | },
|
39 | 500,
|
40 | 30
|
41 | )
|
42 | </script>
|
43 | </body>
|
44 |
|
45 | </html> |
\ | No newline at end of file |