private static bool checkValidMoveInput(String i_currentMove, BoardGame i_BoardGame) { bool isValid = true; const short k_ValidInputLength = 5; short boardSize = i_BoardGame.GetSize(); if (i_currentMove.Length == 1) { if (!i_currentMove.Equals("Q")) { isValid = false; } } else { if (i_currentMove.Length == k_ValidInputLength && i_currentMove[2] == '>') { if (i_currentMove[0] < 'A' || i_currentMove[0] > boardSize + 65 || i_currentMove[3] < 'A' || i_currentMove[3] > boardSize + 65) { isValid = false; } else if (i_currentMove[1] < 'a' || i_currentMove[1] > boardSize + 97 || i_currentMove[4] < 'a' || i_currentMove[4] > boardSize + 97) { isValid = false; } } else { isValid = false; } } return(isValid); }
internal void MoveOnBoard(BoardGame i_BoardGame) { switch (this.MoveType) { case (eTypeOfMove.Regular): if (m_FromSquare.Type == eSquareType.X && m_ToSquare.Row == 0) { m_ToSquare.Type = eSquareType.K; } else if (m_FromSquare.Type == eSquareType.O && m_ToSquare.Row == i_BoardGame.GetSize() - 1) { m_ToSquare.Type = eSquareType.U; } else { m_ToSquare.Type = m_FromSquare.Type; } m_FromSquare.Type = eSquareType.None; break; case (eTypeOfMove.Jump): capturePieceOnBoard(i_BoardGame); if (m_FromSquare.Type == eSquareType.X && m_ToSquare.Row == 0) { m_ToSquare.Type = eSquareType.K; } else { if (m_FromSquare.Type == eSquareType.O && m_ToSquare.Row == i_BoardGame.GetSize() - 1) { m_ToSquare.Type = eSquareType.U; } else { m_ToSquare.Type = m_FromSquare.Type; } } m_FromSquare.Type = eSquareType.None; break; } }