Piece

public struct Piece : Hashable, CustomStringConvertible

Piece on Board with it’s color.

Initialization

  • Initializes a piece with it’s kind and color.

    Declaration

    Swift

    public init(kind: PieceKind, color: PieceColor)

    Parameters

    kind

    Piece kind.

    color

    Piece color.

  • Initializes a piece with given character.

    Possible values are: K for white king, n for black pawn and so on.

    Declaration

    Swift

    public init?(character: Character)

    Parameters

    character

    Character that represents a piece.

Custom string convertable

  • String that indicates the stored piece.

    Possible values are: K for white king, r for black rook and so on.

    Declaration

    Swift

    public var description: String { get }