function pullCard(state, c, cards) {
    if(state[c] === 0) return zeroes([state.length]);

    // If no cards left in shoe, pull from a newly shuffled shoe
    if(cards <= 0) {
      return fillArray(i => {
        if(CARD_STATES[i] === 10) {
          return TEN_ODDS;
        } else {
          return CARD_ODDS;
        }
      }, 10);
    }

    let newState = [];
    let total = vtotal(state);
    state = vnormalize(state);
    CARD_STATES.forEach((card, c2) => {
      if(c2 === c) {
        newState[c2] = (cards * state[c2] - 1) / (cards - 1);
      } else {
        newState[c2] = (cards * state[c2]) / (cards - 1);
      }
      if(newState[c2] < 0) {
        newState[c2] = 0;
      }
    });
    newState = vnormalize(newState);
    return vscale(newState, total);
  }
// Shift the deck distribution after pulling one card
Shift the deck distribution after pulling one card
Shift the deck distribution after pulling one card
function pullCard(state, c, cards) {
    if(state[c] === 0) return zeroes([state.length]);
    if(cards <= 0) {
      return fillArray(i => {
        if(CARD_STATES[i] === 10) {
          return TEN_ODDS;
        } else {
          return CARD_ODDS;
        }
      }, 10);
    }
    let newState = [];
    let total = vtotal(state);
    state = vnormalize(state);
    CARD_STATES.forEach((card, c2) => {
      if(c2 === c) {
        newState[c2] = (cards * state[c2] - 1) / (cards - 1);
      } else {
        newState[c2] = (cards * state[c2]) / (cards - 1);
      }
      if(newState[c2] < 0) {
        newState[c2] = 0;
      }
    });
    newState = vnormalize(newState);
    return vscale(newState, total);
  }
function pullCard ( state , c , cards ) { if ( state [ c ] === 0 ) return zeroes ( [ state . length ] ) ; if ( cards <= 0 ) { return fillArray ( i => { if ( CARD_STATES [ i ] === 10 ) { return TEN_ODDS ; } else { return CARD_ODDS ; } } , 10 ) ; } let newState = [ ] ; let total = vtotal ( state ) ; state = vnormalize ( state ) ; CARD_STATES . forEach ( ( card , c2 ) => { if ( c2 === c ) { newState [ c2 ] = ( cards * state [ c2 ] - 1 ) / ( cards - 1 ) ; } else { newState [ c2 ] = ( cards * state [ c2 ] ) / ( cards - 1 ) ; } if ( newState [ c2 ] < 0 ) { newState [ c2 ] = 0 ; } } ) ; newState = vnormalize ( newState ) ; return vscale ( newState , total ) ; }
Shift the deck distribution after pulling one card
Shift the deck distribution after pulling one card
// If no cards left in shoe, pull from a newly shuffled shoe