PieceType.fromBetza constructor

PieceType.fromBetza(
  1. String betza, {
  2. bool royal = false,
  3. PiecePromoOptions promoOptions = PiecePromoOptions.promoPiece,
  4. bool enPassantable = false,
  5. bool noSanSymbol = false,
  6. int value = Bishop.defaultPieceValue,
  7. List<RegionEffect> regionEffects = const [],
  8. List<Action> actions = const [],
})

Generate a piece type with all of its moves from Betza notation.

Implementation

factory PieceType.fromBetza(
  String betza, {
  bool royal = false,
  PiecePromoOptions promoOptions = PiecePromoOptions.promoPiece,
  bool enPassantable = false,
  bool noSanSymbol = false,
  int value = Bishop.defaultPieceValue,
  List<RegionEffect> regionEffects = const [],
  List<Action> actions = const [],
}) {
  List<Atom> atoms = Betza.parse(betza);
  List<MoveDefinition> moves =
      atoms.map((e) => e.moveDefinitions).expand((e) => e).toList();

  return PieceType(
    betza: betza,
    moves: moves,
    royal: royal,
    promoOptions: promoOptions,
    enPassantable: enPassantable,
    noSanSymbol: noSanSymbol,
    value: value,
    regionEffects: regionEffects,
    actions: actions,
  );
}