BuiltVariant class
Constructors
BuiltVariant ({required Variant data , required List <PieceDefinition > pieces , required Map <String , PieceDefinition > pieceLookup , required Map <String , int > pieceIndexLookup , required List <int > promotionPieces , required List <int > promotablePieces , Map <int , int > ? promoLimits , Map <int , List <int > > ? promoMap , PromotionBuilder ? promotionBuilder , DropBuilderFunction ? dropBuilder , MoveChecker ? passChecker , PieceMoveChecker ? firstMoveChecker , required int epPiece , required int castlingPiece , required int rookPiece , required int royalPiece , required MaterialConditions <int > materialConditions , required Map <String , BuiltRegion > regions , required Map <int , List <String > > winRegions , required List <Action > actions , required Map <ActionEvent , List <Action > > actionsByEvent , StateTransformFunction <BishopState > ? stateTransformer , List <MoveGenFunction <Move > > moveGenerators = const [] , Map <Type , MoveProcessorFunction <Move > > moveProcessors = const {} , Map <Type , MoveFormatterFunction <Move > > algebraicMoveFormatters = const {} , Map <Type , MoveFormatterFunction <Move > > prettyMoveFormatters = const {} })
const
BuiltVariant.fromData (Variant data )
factory
BuiltVariant.standard ()
factory
Properties
actions
→ List <Action >
final
actionsByEvent
→ Map <ActionEvent , List <Action > >
final
addCapturesToHand
→ bool
no setter
algebraicMoveFormatters
→ Map <Type , MoveFormatterFunction <Move > >
final
boardSize
→ BoardSize
The size of the board.
no setter
castling
→ bool
Whether this variant supports castling.
no setter
castlingOptions
→ CastlingOptions
The castling rules for this VariantData.
no setter
castlingPiece
→ int
final
data
→ Variant
final
defaultPromotablePiece
→ int
The first piece type in the piece map that's promotable.
no setter
dropBuilder
→ DropBuilderFunction ?
final
enPassant
→ bool
Is en passant allowed in this variant?
no setter
epPiece
→ int
final
firstMoveChecker
→ PieceMoveChecker ?
final
forbidChecks
→ bool
If this is true, it is impossible to make a move that checks anyone.
no setter
forcedCapture
→ ForcedCapture ?
If this is set, non-capturing moves cannot be played while capturing
moves are available. Examples are Antichess and Draughts.
no setter
gameEndConditions
→ GameEndConditionSet
no setter
gating
→ bool
Whether this variant involves gating.
no setter
gatingMode
→ GatingMode
What type of gating, if any, is used in this variant?
no setter
halfMoveDraw
→ int ?
Set this to 100 for the 50-move rule in standard chess.
no setter
handsEnabled
→ bool
Are hands enabled in this variant? For example, Crazyhouse.
no setter
hashCode
→ int
The hash code for this object.
no setter inherited
hasMoveGenerators
→ bool
Whether this variant has custom move generators.
no setter
hasPass
→ bool
Whether this variant has pass moves.
no setter
hasRegions
→ bool
Whether this variant has any region definitions.
no setter
hasWinRegions
→ bool
Whether this variant has any win regions.
no setter
materialConditions
→ MaterialConditions <int >
final
moveGenerators
→ List <MoveGenFunction <Move > >
final
moveProcessors
→ Map <Type , MoveProcessorFunction <Move > >
final
name
→ String
A human-friendly name.
no setter
outputOptions
→ OutputOptions
no setter
passChecker
→ MoveChecker ?
final
pieceIndexLookup
→ Map <String , int >
final
pieceLookup
→ Map <String , PieceDefinition >
final
pieces
→ List <PieceDefinition >
final
pieceTypes
→ Map <String , PieceType >
The pieces to be used in this variant, in the form symbol: pieceType.
Symbols are single uppercase letters, such as 'P' (pawn) or 'N' (knight).
no setter
pieceValues
→ Map <String , int > ?
The relative values of pieces. These are usually already set in the PieceType
definitions, so only use this if you want to override those.
For example, you have a variant where a pawn is worth 200 instead of 100,
but you still want to use the normal pawn definition.
no setter
prettyMoveFormatters
→ Map <Type , MoveFormatterFunction <Move > >
final
promoLimits
→ Map <int , int > ?
final
promoMap
→ Map <int , List <int > > ?
final
promotablePieces
→ List <int >
final
promotion
→ bool
Is promotion enabled?
no setter
promotionBuilder
→ PromotionBuilder ?
final
promotionPieces
→ List <int >
final
regions
→ Map <String , BuiltRegion >
final
repetitionDraw
→ int ?
Set this to 3 for the threefold repeition rule in standard chess.
no setter
rookPiece
→ int
final
royalPiece
→ int
final
runtimeType
→ Type
A representation of the runtime type of the object.
no setter inherited
startPosBuilder
→ StartPositionBuilder ?
A builder function for variants with variable start positions, such as Chess 960.
no setter
startPosition
→ String ?
A full starting position, specified as a
FEN string .
no setter
stateTransformer
→ StateTransformFunction <BishopState > ?
final
winRegions
→ Map <int , List <String > >
final
Methods
actionsForTrigger (ActionTrigger trigger , {bool checkPrecondition = true })
→ Iterable <Action >
Generates all actions for trigger
.
allowMovement (int piece , int square )
→ bool
For use with restricted movement regions - determines whether it is
allowed for piece
to move to square
.
canFirstMove ({required BishopState state , required int from , required int colour , required MoveDefinition moveDefinition })
→ bool
canPass ({required BishopState state , required int colour })
→ bool
Determines whether player colour
can pass their turn in state
.
capturedPieces (BishopState state , {String ? startPos , int ? seed })
→ Map <int , int >
capturedPiecesStr (BishopState state , {String ? startPos , int ? seed })
→ Map <String , int >
copyWith ({Variant ? data , List <PieceDefinition > ? pieces , Map <String , PieceDefinition > ? pieceLookup , Map <String , int > ? pieceIndexLookup , List <int > ? promotionPieces , List <int > ? promotablePieces , Map <int , int > ? promoLimits , Map <int , List <int > > ? promoMap , PromotionBuilder ? promotionBuilder , DropBuilderFunction ? dropBuilder , MoveChecker ? passChecker , PieceMoveChecker ? firstMoveChecker , int ? royalPiece , int ? epPiece , int ? castlingPiece , int ? rookPiece , MaterialConditions <int > ? materialConditions , Map <String , BuiltRegion > ? regions , Map <int , List <String > > ? winRegions , List <Action > ? actions , Map <ActionEvent , List <Action > > ? actionsByEvent , StateTransformFunction <BishopState > ? stateTransformer , List <MoveGenFunction <Move > > ? moveGenerators , Map <Type , MoveProcessorFunction <Move > > ? moveProcessors , Map <Type , MoveFormatterFunction <Move > > ? algebraicMoveFormatters , Map <Type , MoveFormatterFunction <Move > > ? prettyMoveFormatters })
→ BuiltVariant
executeActions (ActionTrigger trigger )
→ List <ActionEffect >
Generates all effects for all actions triggered by trigger
.
generateCustomMoves ({required BishopState state , required int player , MoveGenParams params = MoveGenParams.normal })
→ Iterable <Move >
generateDrops ({required BishopState state , required int colour })
→ List <Move > ?
Generate all drop moves for player colour
in state
.
generatePromotionMoves ({required StandardMove base , required BishopState state , PieceType ? pieceType })
→ List <StandardMove > ?
Generates all possible moves for the base
move,
given state
and pieceType
.
getPromoPieces ({BishopState ? state , PieceType ? pieceType , int ? pieceIndex })
→ List <int >
hasActionsForEvent (ActionEvent event )
→ bool
Whether this variant has actions for event
.
inWinRegion (int piece , int square )
→ bool
Determins whether piece
(including colour) is in one of its win
regions, if it has any.
makeCustomMove (MoveProcessorParams <Move > params )
→ BishopState ?
noSuchMethod (Invocation invocation )
→ dynamic
Invoked when a nonexistent method or property is accessed.
inherited
pieceFromSymbol (String symbol )
→ int
pieceHasWinRegions (int piece )
→ bool
piece
should contain its colour.
pieceIndex (String symbol )
→ int
pieceIndices (List <String > symbols )
→ List <int >
pieceMapIntToStr <T > (Map <int , T > input , {bool fullPiece = false })
→ Map <String , T >
pieceMapStrToInt <T > (Map <String , T > input , {bool fullPiece = false })
→ Map <int , T >
pieceSymbol (int type , [int colour = Bishop.white ])
→ String
pieceType (int piece , [int ? square ])
→ PieceType
toString ()
→ String
A string representation of this object.
override
transformState (BishopState state , [int ? player ])
→ BishopState