blob: 47329b7d74317d578e1914c016d8b6b48a3e4a28 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
|
'use strict';
/* sense structure:
* {
* size: number
* read: function(lattice, agent) -> number[size]
* }
*/
export function sense_read(lattice, agent, sense) {
const result = sense.read(lattice, agent);
if (result.length !== sense.size) {
throw new Error(`Expected result of size ${sense.size}, but got ${result.length} instead.`);
}
return sense.read(lattice, agent);
}
|