engine/core.js
/**
       Subscribe your callbacks to be called during resolution of the round.
       tick: the tick at which you want to perform your action
       action: function(tick): will be called when resolving the tick
       pre: optional function(tick): will be called before resolving
            any subscribed actions for this tick.
            This allows you to update temporary state of the field.
       post: optional function(tick): will be called after resolving all
             subscribed actions.
             This allows you to finalise the temporary state that was required
             during resolution of the actions.
     */
Subscribe your callbacks to be called during resolution of the round.
Subscribe your callbacks to be called during resolution of the round .
subscribe(tick, action, pre, post) {
        if (tick <= 0 || tick > this.ticksPerRound) {
            throw new Error("Can't subscribe to tick " + tick
                            + ". Should be 1-" + this.ticksPerRound);
        }
        let cb = {};
        if (action) cb.action = action;
        if (pre) cb.pre = pre;
        if (post) cb.post = post;
        this.subscriptions[tick - 1].push(cb);
    }
subscribe ( tick , action , pre , post ) { if ( tick <= 0 || tick > this . ticksPerRound ) { throw new Error ( "Can't subscribe to tick " + tick + ". Should be 1-" + this . ticksPerRound ) ; } let cb = { } ; if ( action ) cb . action = action ; if ( pre ) cb . pre = pre ; if ( post ) cb . post = post ; this . subscriptions [ tick - 1 ] . push ( cb ) ; }
Subscribe your callbacks to be called during resolution of the round.
Subscribe your callbacks to be called during resolution of the round .