Piece
public struct Piece : Hashable, CustomStringConvertible
Piece on Board
with it’s color.
-
Piece kind.
Declaration
Swift
public let kind: PieceKind
-
Piece color.
Declaration
Swift
public let color: PieceColor
-
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.
-
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 }