PieceType.fromBetza constructor
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 [],
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,
);
}