-
Notifications
You must be signed in to change notification settings - Fork 16
Expand file tree
/
Copy pathexitOptions.js
More file actions
25 lines (23 loc) · 751 Bytes
/
exitOptions.js
File metadata and controls
25 lines (23 loc) · 751 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
// import Color from '/src/Color.js'
import ColorMap from '/src/ColorMap.js'
export default function TwoDrawOptions(div, model, patchSize = 8) {
const patchColors = model.patches.map(p => {
switch (p.breed.name) {
case 'exits':
return ColorMap.Basic16.atIndex(p.exitNumber + 4)
case 'inside':
return 'black'
case 'wall':
return 'gray'
default:
return ColorMap.LightGray.randomColor()
}
})
const drawOptions = {
turtlesShape: 'circle',
turtlesColor: t => patchColors[t.exit.id],
turtlesSize: 1,
initPatches: () => patchColors,
}
return { div, patchSize, drawOptions }
}