Chess960 class Null safety
Constructors
- Chess960()
- Chess960.fromFEN(String fen)
- Start with a position from a FEN
Properties
- ascii → String
-
Returns a String representation of the current position
complete with ascii art
read-only
-
board
↔ List<
Piece?> -
read / write
-
castling
↔ ColorMap<
int> -
read / write
- ep_square ↔ int?
-
read / write
- fen → String
-
read-only
- game_over → bool
-
read-only
- half_moves ↔ int
-
read / write
- hashCode → int
-
The hash code for this object. [...]
read-only, inherited
- header ↔ Map
-
read / write
-
history
↔ List<
State> -
read / write
- in_check → bool
-
read-only
- in_checkmate → bool
-
read-only
- in_draw → bool
-
read-only
- in_stalemate → bool
-
read-only
- in_threefold_repetition → bool
-
read-only
- insufficient_material → bool
-
read-only
-
kings
↔ ColorMap<
int> -
read / write
- move_number ↔ int
-
read / write
- runtimeType → Type
-
A representation of the runtime type of the object.
read-only, inherited
- turn ↔ Color
-
read / write
Methods
-
attacked(
Color color, int square) → bool -
build_move(
List< Piece?> board, dynamic from, dynamic to, dynamic flags, [PieceType? promotion]) → Move -
clear(
) → void - Reset all of the instance variables
-
copy(
) → Chess960 - Deep copy of the current Chess instance
-
generate_fen(
) → String - Returns a FEN String representing the current position
-
generate_moves(
[Map? options]) → List< Move> -
get(
String square) → Piece? - Returns the piece at the square in question or null if there is none
-
get_disambiguator(
Move move) → String -
getHistory(
[Map? options]) → List -
king_attacked(
Color color) → bool -
load(
String fen) → bool - Load a position from a FEN String
-
load_pgn(
String? pgn, [Map? options]) → bool -
Load the moves of a game stored in Portable Game Notation.
options
is an optional parameter that contains a 'newline_char' which is a string representation of a RegExp (and should not be pre-escaped) and defaults to '\r?\n'). Returnstrue
if the PGN was parsed successfully, otherwisefalse
. -
make_move(
Move move) → void -
make_pretty(
Move ugly_move) → Map< String, dynamic> - pretty = external move object
-
move(
dynamic move) → bool - The move function can be called with in the following parameters: .move('Nxb7') <- where 'move' is a case-sensitive SAN string .move({ from: 'h7', <- where the 'move' is a move object (additional to :'h8', fields are ignored) promotion: 'q', }) or it can be called with a Move object It returns true if the move was made, or false if it could not be.
-
move_to_san(
Move move) → String - Convert a move from 0x88 coordinates to Standard Algebraic Notation(SAN)
-
moves(
[Map? options]) → List - Returns a list of legals moves from the current position. The function takes an optional parameter which controls the single-square move generation and verbosity. [...]
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a non-existent method or property is accessed. [...]
inherited
-
perft(
int? depth) → int -
pgn(
[Map? options]) → String - Return the PGN representation of the game thus far
-
push(
Move move) → void -
put(
Piece piece, String square) → bool -
Put
piece
onsquare
-
remove(
String square) → Piece? - Removes a piece from a square and returns it, or null if none is present
-
reset(
) → void - Go back to the chess starting position
-
san_moves(
) → List< String?> - return the san string representation of each move in history. Each string corresponds to one move.
-
set_header(
dynamic args) → Map - Updates header with the List of args and returns it
-
square_color(
dynamic square) → String? -
Returns the color of the square ('light' or 'dark'), or null if
square
is invalid -
toString(
) → String -
A string representation of this object. [...]
inherited
-
trim(
String str) → String -
undo(
) → Map< String, dynamic> ? - Takeback the last half-move, returning a move Map if successful, otherwise null.
-
undo_move(
) → Move? - Undoes a move and returns it, or null if move history is empty
-
update_setup(
String fen) → void - called when the initial board setup is changed with put() or remove(). modifies the SetUp and FEN properties of the header object. if the FEN is equal to the default position, the SetUp and FEN are deleted the setup is only updated if history.length is zero, ie moves haven't been made.
Operators
-
operator ==(
Object other) → bool -
The equality operator. [...]
inherited
Static Properties
Static Methods
-
algebraic(
int i) → String -
file(
int i) → int -
is_digit(
String c) → bool -
pieces_to_start_fen(
List< PieceType> pieces) → String -
random_start_fen(
) → String -
random_start_pieces(
) → List< PieceType> -
rank(
int i) → int -
swap_color(
Color c) → Color -
validate_fen(
dynamic fen) → Map - Check the formatting of a FEN String is correct Returns a Map with keys valid, error_number, and error
Constants
- ATTACKS → const List
-
const [20, 0, 0, 0, 0, 0, 0, 24, 0, 0, 0, 0, 0, 0, 20, 0, 0, 20, 0, 0, 0, 0, 0, 24, 0, 0, 0, 0, 0, 20, 0, 0, 0, 0, 20, 0, 0, 0, 0, 24, 0, 0, 0, 0, 20, 0, 0, 0, 0, 0, 0, 20, 0, 0, 0, 24, 0, 0, 0, 20, 0…
- BISHOP → const PieceType
-
PieceType.BISHOP
-
BITS
→ const Map<
String, int> -
const {'NORMAL' : BITS_NORMAL, 'CAPTURE' : BITS_CAPTURE, 'BIG_PAWN' : BITS_BIG_PAWN, 'EP_CAPTURE' : BITS_EP_CAPTURE, 'PROMOTION' : BITS_PROMOTION, 'KSIDE_CA…
- BITS_BIG_PAWN → const int
-
4
- BITS_CAPTURE → const int
-
2
- BITS_EP_CAPTURE → const int
-
8
- BITS_KSIDE_CASTLE → const int
-
32
- BITS_NORMAL → const int
-
1
- BITS_PROMOTION → const int
-
16
- BITS_QSIDE_CASTLE → const int
-
64
- BLACK → const Color
-
Color.BLACK
-
DEFAULT_HEADER
→ const Map<
String, String> -
const {'Variant' : 'Chess960'}
- DEFAULT_POSITION → const String
-
'rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1'
- EMPTY → const int
-
-1
-
FLAGS
→ const Map<
String, String> -
const {'NORMAL' : 'n', 'CAPTURE' : 'c', 'BIG_PAWN' : 'b', 'EP_CAPTURE' : 'e', 'PROMOTION' : 'p', 'KSIDE_CASTLE' …
- KING → const PieceType
-
PieceType.KING
- KNIGHT → const PieceType
-
PieceType.KNIGHT
- PAWN → const PieceType
-
PieceType.PAWN
-
PAWN_OFFSETS
→ const Map<
Color, List< int> > -
const {BLACK : const [16, 32, 17, 15], WHITE : const [-16, -32, -17, -15]}
-
PIECE_OFFSETS
→ const Map<
PieceType, List< int> > -
const {KNIGHT : const [-18, -33, -31, -14, 18, 33, 31, 14], BISHOP : const [-17, -15, 17, 15], ROOK : const [-16, 1, 16, -1], QUEEN : const [-17, -16, -15, 1, 17, 16, 15, -1], KING : const [-17, -16, …
-
PIECE_TYPES
→ const Map<
String, PieceType> -
const {'p' : PieceType.PAWN, 'n' : PieceType.KNIGHT, 'b' : PieceType.BISHOP, 'r' : PieceType.ROOK, 'q' : PieceType.QUEEN, 'k' : PieceType.KING}
- POSSIBLE_RESULTS → const List
-
const ['1-0', '0-1', '1/2-1/2', '*']
- QUEEN → const PieceType
-
PieceType.QUEEN
- RANK_1 → const int
-
7
- RANK_2 → const int
-
6
- RANK_3 → const int
-
5
- RANK_4 → const int
-
4
- RANK_5 → const int
-
3
- RANK_6 → const int
-
2
- RANK_7 → const int
-
1
- RANK_8 → const int
-
0
-
RAYS
→ const List<
int> -
const [17, 0, 0, 0, 0, 0, 0, 16, 0, 0, 0, 0, 0, 0, 15, 0, 0, 17, 0, 0, 0, 0, 0, 16, 0, 0, 0, 0, 0, 15, 0, 0, 0, 0, 17, 0, 0, 0, 0, 16, 0, 0, 0, 0, 15, 0, 0, 0, 0, 0, 0, 17, 0, 0, 0, 16, 0, 0, 0, 15, 0…
- ROOK → const PieceType
-
PieceType.ROOK
- SQUARES → const Map
-
const {'a8' : 0, 'b8' : 1, 'c8' : 2, 'd8' : 3, 'e8' : 4, 'f8' : 5, 'g8' : 6, 'h8' : 7, 'a7' : 16, 'b7' : 17, 'c7'…
- SQUARES_A1 → const int
-
112
- SQUARES_A8 → const int
-
0
- SQUARES_H1 → const int
-
119
- SQUARES_H8 → const int
-
7
- SYMBOLS → const String
-
'pnbrqkPNBRQK'
- WHITE → const Color
-
Color.WHITE