src/util.js
function getPlayerDisasters(player, game) {
  return player.hand
    .map((card) => {
      return card.validDisasters ? card.validDisasters(player, game) : []
    })
    .reduce((acc, array) => {
      return acc.concat(array)
    }, [])
    .sort((disasterA, disasterB) => disasterB.weight - disasterA.weight)
}
function getPlayerDisasters(player, game) {
  return player.hand
    .map((card) => {
      return card.validDisasters ? card.validDisasters(player, game) : []
    })
    .reduce((acc, array) => {
      return acc.concat(array)
    }, [])
    .sort((disasterA, disasterB) => disasterB.weight - disasterA.weight)
}
function getPlayerDisasters ( player , game ) { return player . hand . map ( ( card ) => { return card . validDisasters ? card . validDisasters ( player , game ) : [ ] } ) . reduce ( ( acc , array ) => { return acc . concat ( array ) } , [ ] ) . sort ( ( disasterA , disasterB ) => disasterB . weight - disasterA . weight ) }
Get a list of possible disaster moves, sorted by best option
Get a list of possible disaster moves sorted by best option