global.TOP='/home/sbosse/proj/jam/js'; require(TOP+'/top/module')([process.cwd(),TOP]); var Io = Require('com/io'); var Aios = Require('jam/aios'); var Comp = Require('com/compat'); var node_ac = function (x,y) { //var self=this; // Data State this.pos={x:x,y:y}; this.x; // Activities this.init = function () { this.x=0; }; this.end = function () { log('finalize'); kill(); }; this.act1 = function () { log('act1'); }; this.act2 = function () { //log('act2 '+this.x); this.x++; //sleep(1000); }; this.act3 = function () { //log('act3'); }; this.on = { error : function (e) { log('Caught exception '+e); }, exit : function () { log('Terminating.'); } }; // Transition network this.trans = { init: function () { return 'act1'; }, act1: function () { if (this.pos.x==3 && this.pos.y==3) return 'act2'; else return 'end'; }, act2: function () { if (this.x<1000) return 'act3'; else return 'end'; }, act3: function () { return 'act2'; }, end: function () { } } // Control State this.next='init'; } var world_ac = function () { this.init = function () { log('World: Starting node agents ['+ this.options.x+','+this.options.y+'] ..'); for (var j=0;j