src/util.js
function getPlayerCounters(player, attacker, game) {
  return player.hand
    .map((card) => {
      return card.validCounters ? card.validCounters(player, attacker, game) : []
    })
    .reduce((acc, array) => {
      return acc.concat(array)
    }, [])
    .sort((counterA, counterB) => counterB.weight - counterA.weight)
}
function getPlayerCounters(player, attacker, game) {
  return player.hand
    .map((card) => {
      return card.validCounters ? card.validCounters(player, attacker, game) : []
    })
    .reduce((acc, array) => {
      return acc.concat(array)
    }, [])
    .sort((counterA, counterB) => counterB.weight - counterA.weight)
}
function getPlayerCounters ( player , attacker , game ) { return player . hand . map ( ( card ) => { return card . validCounters ? card . validCounters ( player , attacker , game ) : [ ] } ) . reduce ( ( acc , array ) => { return acc . concat ( array ) } , [ ] ) . sort ( ( counterA , counterB ) => counterB . weight - counterA . weight ) }
Get a list of possible counter moves, sorted by best option
Get a list of possible counter moves sorted by best option