pieceType property

PieceType pieceType

Implementation

PieceType get pieceType {
  switch (this) {
    case ChessPiece.white_pawn:
    case ChessPiece.black_pawn:
      return PieceType.pawn;
    case ChessPiece.white_knight:
    case ChessPiece.black_knight:
      return PieceType.knight;
    case ChessPiece.white_bishop:
    case ChessPiece.black_bishop:
      return PieceType.bishop;
    case ChessPiece.white_rook:
    case ChessPiece.black_rook:
      return PieceType.rook;
    case ChessPiece.white_queen:
    case ChessPiece.black_queen:
      return PieceType.queen;
    case ChessPiece.white_king:
    case ChessPiece.black_king:
      return PieceType.king;
    case ChessPiece.none:
      throw Exception("invalid");
  }
}