示例#1
0
        public void TurnManToKingOnBoard(Position i_CurrPiecePosition)
        {
            eCellMode currentMode = r_BoardMatrix[i_CurrPiecePosition.Row, i_CurrPiecePosition.Col];

            if (currentMode == eCellMode.Player1Piece)
            {
                r_BoardMatrix[i_CurrPiecePosition.Row, i_CurrPiecePosition.Col] = eCellMode.Player1King;
            }
            else
            { // currentMode == eCellMode.Player2Piece
                r_BoardMatrix[i_CurrPiecePosition.Row, i_CurrPiecePosition.Col] = eCellMode.Player2King;
            }
        }
示例#2
0
        // Used by the function that builds the pieces lists according to the positions on the board
        private bool isPieceBelongsToPlayer(eCellMode i_Cell, Checkers.ePlayerTag i_Player)
        {
            bool pieceBelongToPlayer;

            switch (i_Player)
            {
            case Checkers.ePlayerTag.First:
                pieceBelongToPlayer = i_Cell == eCellMode.Player1Piece || i_Cell == eCellMode.Player1King;
                break;

            case Checkers.ePlayerTag.Second:
                pieceBelongToPlayer = i_Cell == eCellMode.Player2Piece || i_Cell == eCellMode.Player2King;
                break;

            default:
                throw new InvalidEnumArgumentException();
            }

            return(pieceBelongToPlayer);
        }
示例#3
0
        // Used by the function that builds the pieces lists according to the positions on the board
        private bool isPieceBelongsToPlayer(eCellMode i_Cell, Checkers.ePlayerTag i_Player)
        {
            bool pieceBelongToPlayer;
            switch (i_Player)
            {
                    case Checkers.ePlayerTag.First:
                    pieceBelongToPlayer = i_Cell == eCellMode.Player1Piece || i_Cell == eCellMode.Player1King;
                    break;
                    case Checkers.ePlayerTag.Second:
                    pieceBelongToPlayer = i_Cell == eCellMode.Player2Piece || i_Cell == eCellMode.Player2King;
                    break;                 
                default:
                    throw new InvalidEnumArgumentException();
            }

            return pieceBelongToPlayer;
        }