rollComplete(roll, callback) {
      // Generally, in order to "shoot", a player must have a line bet on the table.
      // There must be at least one Pass or Don't Pass bet on the table to roll.
      if (!this.playerBets.find(function(bet) {
        return bet['bet']['hasPoint'] && bet['bet']['useGamePoint'];
      })) {
        if (callback != null) {
          callback(null, 0);
        }
        return;
      }
      // First, take or pay the bets that resolve with this roll.
      var unresolvedBets = [];
      for (var x=0; x<this.playerBets.length; x++) {
        var pay = this.playerBets[x]['bet'].evaluateRoll(this, this.playerBets[x], roll);
        if (typeof(pay) !== 'number') {
          // Pay is only a number if the bet is resolved. Keep the bet.
          unresolvedBets.push(this.playerBets[x]);
        } else if (callback != null) {
          callback(this.playerBets[x], pay);
        }
      }

      // Next, mark the point for the game if it needs to be marked.
      if (roll.rollValue() === 7 || roll.rollValue() === this.pointValue) {
        // The game either came back on the point or made a "seven out", so the point is done.
        this.pointValue = 0;
      } else if (!this.pointValue) {
        this.pointValue = roll.isValidPoint() || 0;
      }

      // Then, for all contract bets without a point, mark them if we rolled a valid point.
      // Even if we hit the main point, the "Don'ts and Comes" still need a point.
      for (x=0; x<unresolvedBets.length; x++) {
        if (roll.isValidPoint() && unresolvedBets[x]['bet']['hasPoint'] && !unresolvedBets[x]['bet']['pointValue']) {
          unresolvedBets[x]['bet'].pointMarked(roll.rollValue());
        }
      }

      // Finally, reset the playerBets.
      this.playerBets = unresolvedBets;
    }
/*
     * Once the dice have been "rolled", evaluate the game according to the roll.
     * @param roll [DiceRoll] The combination that was rolled.
     * @param callback [Function] Function to perform additional processing based on the bet and pay.
     */
Once the dice have been "rolled", evaluate the game according to the roll.
@param roll [DiceRoll] The combination that was rolled.
@param callback [Function] Function to perform additional processing based on the bet and pay.
Once the dice have been " rolled " evaluate the game according to the roll . @param roll [ DiceRoll ] The combination that was rolled . @param callback [ Function ] Function to perform additional processing based on the bet and pay .
rollComplete(roll, callback) {
      if (!this.playerBets.find(function(bet) {
        return bet['bet']['hasPoint'] && bet['bet']['useGamePoint'];
      })) {
        if (callback != null) {
          callback(null, 0);
        }
        return;
      }
      var unresolvedBets = [];
      for (var x=0; x<this.playerBets.length; x++) {
        var pay = this.playerBets[x]['bet'].evaluateRoll(this, this.playerBets[x], roll);
        if (typeof(pay) !== 'number') {
          unresolvedBets.push(this.playerBets[x]);
        } else if (callback != null) {
          callback(this.playerBets[x], pay);
        }
      }
      if (roll.rollValue() === 7 || roll.rollValue() === this.pointValue) {
        this.pointValue = 0;
      } else if (!this.pointValue) {
        this.pointValue = roll.isValidPoint() || 0;
      }
      for (x=0; x<unresolvedBets.length; x++) {
        if (roll.isValidPoint() && unresolvedBets[x]['bet']['hasPoint'] && !unresolvedBets[x]['bet']['pointValue']) {
          unresolvedBets[x]['bet'].pointMarked(roll.rollValue());
        }
      }
      this.playerBets = unresolvedBets;
    }
rollComplete ( roll , callback ) { if ( ! this . playerBets . find ( function ( bet ) { return bet [ 'bet' ] [ 'hasPoint' ] && bet [ 'bet' ] [ 'useGamePoint' ] ; } ) ) { if ( callback != null ) { callback ( null , 0 ) ; } return ; } var unresolvedBets = [ ] ; for ( var x = 0 ; x < this . playerBets . length ; x ++ ) { var pay = this . playerBets [ x ] [ 'bet' ] . evaluateRoll ( this , this . playerBets [ x ] , roll ) ; if ( typeof ( pay ) !== 'number' ) { unresolvedBets . push ( this . playerBets [ x ] ) ; } else if ( callback != null ) { callback ( this . playerBets [ x ] , pay ) ; } } if ( roll . rollValue ( ) === 7 || roll . rollValue ( ) === this . pointValue ) { this . pointValue = 0 ; } else if ( ! this . pointValue ) { this . pointValue = roll . isValidPoint ( ) || 0 ; } for ( x = 0 ; x < unresolvedBets . length ; x ++ ) { if ( roll . isValidPoint ( ) && unresolvedBets [ x ] [ 'bet' ] [ 'hasPoint' ] && ! unresolvedBets [ x ] [ 'bet' ] [ 'pointValue' ] ) { unresolvedBets [ x ] [ 'bet' ] . pointMarked ( roll . rollValue ( ) ) ; } } this . playerBets = unresolvedBets ; }
Once the dice have been "rolled", evaluate the game according to the roll.
Once the dice have been " rolled " evaluate the game according to the roll .
// Generally, in order to "shoot", a player must have a line bet on the table. // There must be at least one Pass or Don't Pass bet on the table to roll. // First, take or pay the bets that resolve with this roll. // Pay is only a number if the bet is resolved. Keep the bet. // Next, mark the point for the game if it needs to be marked. // The game either came back on the point or made a "seven out", so the point is done. // Then, for all contract bets without a point, mark them if we rolled a valid point. // Even if we hit the main point, the "Don'ts and Comes" still need a point. // Finally, reset the playerBets.