isRed property

bool isRed

Is this card red? Note that while jokers have no suit, there is a black one and a red one.

Implementation

bool get isRed {
  if (index == Card.Joker.index) return true;
  if (index < Card.LowAceOfClubs.index || index > Card.AceOfSpades.index) {
    return false;
  }
  return (index & 3) == Suit.Diamond.index - 1 ||
      (index & 3) == Suit.Heart.index - 1;
}