Move

public struct Move : CustomStringConvertible, Hashable

Represents move on board.

  • Square where piece goes from.

    Declaration

    Swift

    public let from: Square
  • to

    Square where piece goes to.

    Declaration

    Swift

    public let to: Square
  • Indicates if move promotes pawn into piece.

    Declaration

    Swift

    public let promotion: PieceKind?

Initialization

  • Initialize move with start and end squares.

    Declaration

    Swift

    public init(from: Square, to: Square, promotion: PieceKind? = nil)

    Parameters

    from

    Square where piece goes from.

    to

    Square where piece goes to.

    promotion

    A piece kind which should be set instead of pawn in case of promotion.

  • Initialize move with human readable string.

    Declaration

    Swift

    public init(string: String)

    Parameters

    string

    Move string in human readable format (e.g., "g1f3", "e7e8Q").

CustomStringConvertible

  • Converts move into human readable string format.

    Declaration

    Swift

    public var description: String { get }