예제 #1
0
        public eExceptions ValidateGuess(Position i_Position)
        {
            m_Exceptions = GameValidation.ValidateGuess(i_Position, m_BoardSize);
            if (m_Exceptions == eExceptions.ValidGuess)
            {
                int positionInArray = getCardPositionInArray(i_Position);
                if (m_GameCards[positionInArray].Visible)
                {
                    m_Exceptions = eExceptions.CardExpose;
                }
            }

            return(m_Exceptions);
        }
예제 #2
0
        public static eExceptions ValidateGuess(Position i_Guess, Position i_BoardSize)
        {
            eExceptions isValid = eExceptions.ValidGuess;

            if (isValid == eExceptions.ValidGuess)
            {
                if (i_BoardSize.Row <= i_Guess.Row || i_Guess.Row < 0 || i_BoardSize.Column <= i_Guess.Column || i_Guess.Column < 0)
                {
                    isValid = eExceptions.OutOfBound;
                }
            }

            return(isValid);
        }
예제 #3
0
        public static bool ExceptionsCatch(eExceptions i_Exception)
        {
            bool isValid = true;

            if (i_Exception == eExceptions.CardExpose)
            {
                isValid = false;
                cardExposeMsg();
            }
            else if (i_Exception == eExceptions.OutOfBound)
            {
                isValid = false;
                positionOutOfBoundMsg();
            }
            else if (i_Exception == eExceptions.InvalidGuess)
            {
                isValid = false;
                inValidGuessMsg();
            }

            return(isValid);
        }