Пример #1
0
        public static void CaptureRivalCheckerPiece(Board i_GameBoard, ref CheckersPiece io_CurrentCheckerPiece, string i_PositionTo,
                                                    ref CheckersPiece io_RivalCheckerPiece)
        {
            ushort nextColIndex;
            ushort nextRowIndex = i_GameBoard.GetIndexInBoard(ref i_PositionTo, out nextColIndex);

            // Update board after eating, and move the current checker to his next place.
            i_GameBoard.UpdateAfterEating(io_CurrentCheckerPiece.RowIndex, io_CurrentCheckerPiece.ColIndex,
                                          nextRowIndex, nextColIndex,
                                          io_RivalCheckerPiece.RowIndex, io_RivalCheckerPiece.ColIndex);
            // Update current checker position.
            io_CurrentCheckerPiece.ChangePosition(nextRowIndex, nextColIndex);
            // Update rival's checker status (dead).
            io_RivalCheckerPiece.Die();
        }
Пример #2
0
        // Move Tools Methods:
        public static void MoveTool(ref Board io_GameBoard, ref CheckersPiece io_CurrentChecker, string i_PositionTo)
        {
            ushort nextRowIndex = (ushort)(i_PositionTo[k_RowIndex] - 'a');
            ushort nextColIndex = (ushort)(i_PositionTo[k_ColIndex] - 'A');

            // If there is not(!) a rival checker piece in the way.
            // Check valid move - include: inborder, valid input, is empty cell.
            // Validation.CheckValidMoveRegularTool(io_GameBoard, i_CurrentPlayer, io_CurrentChecker, ref i_PositionFrom, ref i_PositionTo);

            // Update board - new tool position.
            io_GameBoard.UpdateBoardAccordingToPlayersMove(
                io_CurrentChecker.RowIndex,
                io_CurrentChecker.ColIndex,
                nextRowIndex,
                nextColIndex);

            io_CurrentChecker.ChangePosition(nextRowIndex, nextColIndex);
        }