fromPgn static method

Rule? fromPgn(
  1. String? variant
)

Parses a PGN header variant tag

Implementation

static Rule? fromPgn(String? variant) {
  switch ((variant ?? 'chess').toLowerCase()) {
    case 'chess':
    case 'chess960':
    case 'chess 960':
    case 'standard':
    case 'from position':
    case 'classical':
    case 'normal':
    case 'fischerandom': // Cute Chess
    case 'fischerrandom':
    case 'fischer random':
    case 'wild/0':
    case 'wild/1':
    case 'wild/2':
    case 'wild/3':
    case 'wild/4':
    case 'wild/5':
    case 'wild/6':
    case 'wild/7':
    case 'wild/8':
    case 'wild/8a':
      return Rule.chess;
    case 'crazyhouse':
    case 'crazy house':
    case 'house':
    case 'zh':
      return Rule.crazyhouse;
    case 'king of the hill':
    case 'koth':
    case 'kingofthehill':
      return Rule.kingofthehill;
    case 'three-check':
    case 'three check':
    case 'threecheck':
    case 'three check chess':
    case '3-check':
    case '3 check':
    case '3check':
      return Rule.threecheck;
    case 'antichess':
    case 'anti chess':
    case 'anti':
      return Rule.antichess;
    case 'atomic':
    case 'atom':
    case 'atomic chess':
      return Rule.atomic;
    case 'horde':
    case 'horde chess':
      return Rule.horde;
    case 'racing kings':
    case 'racingkings':
    case 'racing':
    case 'race':
      return Rule.racingKings;
    default:
      return null;
  }
}