Пример #1
0
        /// <summary>
        /// Gets the checker piece.
        /// </summary>
        /// <param name="type">The type.</param>
        /// <returns>Checkerpiece from the factory</returns>
        /// <exception cref="ArgumentException">Enum to Checker Piece not defined</exception>
        public static CheckerPiece GetCheckerPiece(CheckerPieceType type)
        {
            switch (type)
            {
            case CheckerPieceType.RedPawn:
                return(new RedPawnCheckerPiece());

            case CheckerPieceType.RedKing:
                return(new RedKingCheckerPiece());

            case CheckerPieceType.BlackPawn:
                return(new BlackPawnCheckerPiece());

            case CheckerPieceType.BlackKing:
                return(new BlackKingCheckerPiece());

            case CheckerPieceType.nullPiece:
                return(new NullCheckerPiece());

            default:
                throw new ArgumentException("Enum to Checker Piece not defined");
            }
        }
Пример #2
0
 /// <summary>
 /// Initializes a new instance of the <see cref="CheckersPoint"/> class.
 /// </summary>
 /// <param name="row">The row.</param>
 /// <param name="column">The column.</param>
 /// <param name="checkerPieceType">Type of the checker piece.</param>
 public CheckersPoint(int row, int column, CheckerPieceType checkerPieceType)
 {
     Row     = row;
     Column  = column;
     Checker = CheckerPieceFactory.GetCheckerPiece(checkerPieceType);
 }