src/util.js
function getCardWeight(player, target, card, game) {
  let moves = []
  if (card.validPlays) {
    moves = card.validPlays(player, target, game)
  }
  if (card.validCounters && target.discard.length) {
    moves = card.validCounters(player, target, game)
  }
  if (card.validDisasters) {
    moves = card.validDisasters(player, game)
  }
  // Pick out the highest weight of those moves
  return moves.reduce((acc, move) => {
    return move.weight > acc ? move.weight : acc
  }, 0)
}
function getCardWeight(player, target, card, game) {
  let moves = []
  if (card.validPlays) {
    moves = card.validPlays(player, target, game)
  }
  if (card.validCounters && target.discard.length) {
    moves = card.validCounters(player, target, game)
  }
  if (card.validDisasters) {
    moves = card.validDisasters(player, game)
  }
  // Pick out the highest weight of those moves
  return moves.reduce((acc, move) => {
    return move.weight > acc ? move.weight : acc
  }, 0)
}
function getCardWeight ( player , target , card , game ) { let moves = [ ] if ( card . validPlays ) { moves = card . validPlays ( player , target , game ) } if ( card . validCounters && target . discard . length ) { moves = card . validCounters ( player , target , game ) } if ( card . validDisasters ) { moves = card . validDisasters ( player , game ) } // Pick out the highest weight of those moves return moves . reduce ( ( acc , move ) => { return move . weight > acc ? move . weight : acc } , 0 ) }
Return a cards best weight
Return a cards best weight