39 lines
934 B
Plaintext
39 lines
934 B
Plaintext
include "vec2.bzz"
|
|
####################################################################################################
|
|
# Updater related
|
|
# This should be here for the updater to work, changing position of code will crash the updater
|
|
####################################################################################################
|
|
updated="update_ack"
|
|
update_no=0
|
|
function updated_neigh(){
|
|
neighbors.broadcast(updated, update_no)
|
|
}
|
|
|
|
function init(){
|
|
s = swarm.create(1)
|
|
s.join()
|
|
v = stigmergy.create(5)
|
|
t= {}
|
|
v.put("p",t)
|
|
v.put("u",1)
|
|
}
|
|
|
|
function step() {
|
|
log("Swarm size: ",ROBOTS)
|
|
log("The vstig has ", v.size(), " elements")
|
|
log(v.get("u"))
|
|
if (id==1) {
|
|
tmp = { .x=3}
|
|
v.put("p",tmp)
|
|
v.put("u",2)
|
|
}
|
|
log(v.get("p"))
|
|
}
|
|
|
|
# Executed once when the robot (or the simulator) is reset.
|
|
function reset() {
|
|
}
|
|
|
|
# Executed once at the end of experiment.
|
|
function destroy() {
|
|
} |