Position class

Constructors

Position()
Position.fromFen(String fen)
factory
Position.startpos()
factory

Properties

castling int
getter/setter pair
epSquare int
getter/setter pair
fullmove int
getter/setter pair
halfmove int
getter/setter pair
hashCode int
The hash code for this object.
no setterinherited
inCheck bool
no setter
kingSquare int
no setter
mailbox List<int>
final
moverKingSafe bool
After makeMove, whether the side that just moved left its own king safe (i.e. the move was legal). Cheap legality filter for search/perft.
no setter
occ List<int>
final
occAll int
getter/setter pair
pieces List<List<int>>
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
turn int
getter/setter pair

Methods

generateCaptures(List<int> out) → void
Append pseudo-legal captures (and all promotions) — the quiescence set.
generateLegal() List<int>
Legal moves: pseudo-legal filtered by making each and rejecting those that leave our king in check.
generatePseudoLegal(List<int> out) → void
Append all pseudo-legal moves for the side to move to out.
hash() int
A full 64-bit position key (native ints), folding all piece bitboards plus side-to-move, castling rights and the en-passant square. Cheap — no FEN rebuild — and collisions are negligible for a per-search table.
override
isSquareAttacked(int sq, int byColor) bool
Is sq attacked by any piece of byColor, given current occupancy?
makeMove(int m) → void
makeNullMove() → void
Pass the turn to the opponent without moving (null-move pruning). Only the side to move and en-passant square change; the board is untouched. Never call when inCheck (the null side could be mated).
moveFromUci(String uci) int
Find the legal move matching UCI string uci, or -1.
moveToUci(int m) String
Long-algebraic (UCI) string for m, e.g. e2e4, e7e8q.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
see(int move) int
Static Exchange Evaluation: the material a capture move wins or loses after the full sequence of optimal recaptures on the target square, in centipawns from the moving side's view. Negative means a losing capture.
toFen() String
toString() String
A string representation of this object.
inherited
unmakeMove() → void
unmakeNullMove() → void

Operators

operator ==(Object other) bool
The equality operator.
inherited