Enum chess_engine::GameResult[][src]

pub enum GameResult {
    Continuing(Board),
    Victory(Color),
    Stalemate,
    IllegalMove(Move),
}
Expand description

The result of a move being played on the board.

Variants

Continuing(Board)

The game is not finished, and the game is still in play.

Tuple Fields of Continuing

0: Board
Victory(Color)

One player, the victor, checkmated the other. This stores the color of the winner.

Tuple Fields of Victory

0: Color
Stalemate

The game is drawn. This can be a result of the current player having no legal moves and not being in check, or because both players have insufficient material on the board.

Insufficient material consists of:

  1. The player only has a king
  2. The player only has a king and a knight
  3. The player only has a king and two knights
  4. The player only has a king and a bishop
  5. The player only has a king and two bishops

In a regular game of chess, threefold repetition also triggers a stalemate, but this engine does not have builtin support for threefold repetition detection yet.

IllegalMove(Move)

An illegal move was made. This can include many things, such as moving a piece through another piece, attempting to capture an allied piece, moving non-orthogonally or non-diagonally, or non-knight-like according the rules governing the movement of the piece. Additionally, moves that put the player in check, (for example, moving a pinned piece), are also illegal.

Tuple Fields of IllegalMove

0: Move

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

This method returns an Ordering between self and other. Read more

Compares and returns the maximum of two values. Read more

Compares and returns the minimum of two values. Read more

Restrict a value to a certain interval. Read more

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

This method returns an ordering between self and other values if one exists. Read more

This method tests less than (for self and other) and is used by the < operator. Read more

This method tests less than or equal to (for self and other) and is used by the <= operator. Read more

This method tests greater than (for self and other) and is used by the > operator. Read more

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

recently added

Uses borrowed data to replace owned data, usually by cloning. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.