示例#1
0
        private string GetStringResultEqualPosition(RowElements rowElements)
        {
            string       result = "";
            ColorElement cp; // Parameter
            ColorElement cs; // Secret

            for (int i = 0; i < rowElements.GetElements().Count; i++)
            {
                cp = rowElements.GetElements()[i];    // Parameter
                cs = _rowCodeSecret.GetElements()[i]; // Secret

                if (cp.Equals(cs))
                {
                    // Si hay coincidencia de posición.
                    result += OK_POS;
                }
            }
            return(result);
        }
示例#2
0
        private void ValidateRowElements(RowElements rowElements)
        {
            if (rowElements.GetElements().Count != this.NumElementPerRow)
            {
                throw new ArgumentException("El objeto no tiene " + this.NumElementPerRow + " elementos.");
            }

            if (_listAttempts.Count == NumMaxAttempts)
            {
                throw new WarningException("La lista tiene el máximo de intentos (" + NumMaxAttempts + ").");
            }
        }
示例#3
0
        private string GetStringResultDistinctPosition(RowElements rowElements)
        {
            string       result = "";
            ColorElement cp; // Parameter
            ColorElement cs; // Secret

            for (int i = 0; i < rowElements.GetElements().Count; i++)
            {
                for (int j = 0; j < _rowCodeSecret.GetElements().Count; j++)
                {
                    if (i != j)
                    {
                        cs = _rowCodeSecret.GetElements()[i]; // Secret
                        cp = rowElements.GetElements()[j];    // Parameter
                        if (cs.Equals(cp))
                        {
                            // Si hay coincidencia en otra posición posición.
                            result += OK_OPOS;
                        }
                    }
                }
            }
            return(result);
        }