From 281d2699dd84ca0fa671881cf033036412726e3c Mon Sep 17 00:00:00 2001 From: sbosse Date: Tue, 27 Aug 2024 00:13:12 +0200 Subject: [PATCH] Tue 27 Aug 00:13:11 CEST 2024 --- demo/sejam2/simple/world.js | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 demo/sejam2/simple/world.js diff --git a/demo/sejam2/simple/world.js b/demo/sejam2/simple/world.js new file mode 100644 index 0000000..1117b19 --- /dev/null +++ b/demo/sejam2/simple/world.js @@ -0,0 +1,37 @@ +// World agent controlling the simulation and collection monitoring data +function (options) { + this.monitor=[] + this.act = { + init: function () { + log('Initializing ...'); + // csv.write(file,header,data:[[]]|[{}],callback?,verbose?) + }, + percept: function () { + log('Percepting ...'); + this.monitor.push({ + time:time(), + sensor1:random(0,100) + }) + }, + update: function () { + log('Processing ...'); + simu.csv.write('/tmp/monitor.csv',null,this.monitor); + }, + wait: function () { + log('Sleeping ...'); + sleep(10); + } + } + this.trans = { + init: function () {return percept}, + percept: function () { + return update + }, + update: function () { + return wait; + }, + wait: function () {return percept} + } + this.next='init'; +} +