def discard
      ordered = player.hand.map do |card|
        i = card_preference.map { |preference| card.type == preference }.index(true)
        {card: card, index: i}
      end
      ordered.sort_by { |h| h[:index] || 99 }.last.try(:fetch, :card)
    end
def discard
      ordered = player.hand.map do |card|
        i = card_preference.map { |preference| card.type == preference }.index(true)
        {card: card, index: i}
      end
      ordered.sort_by { |h| h[:index] || 99 }.last.try(:fetch, :card)
    end
def discard ordered = player . hand . map do | card | i = card_preference . map { | preference | card . type == preference } . index ( true ) { card : card , index : i } end ordered . sort_by { | h | h [ :index ] || 99 } . last . try ( :fetch , :card ) end
This method is called if your hand is over the hand limit, it returns the card that you would like to discard.
 Returning nil or a card you don't have is a very bad idea. Bad things will happen to you.
This method is called if your hand is over the hand limit it returns the card that you would like to discard . Returning nil or a card you don t have is a very bad idea . Bad things will happen to you .