outcome property

Outcome? get outcome

The outcome of the game, or null if the game is not over.

Implementation

Outcome? get outcome {
  if (variantOutcome != null) {
    return variantOutcome;
  } else if (isCheckmate) {
    return Outcome(winner: turn.opposite);
  } else if (isInsufficientMaterial || isStalemate) {
    return Outcome.draw;
  } else {
    return null;
  }
}