private void TotalResetForm()
        {
            ResetForm();
            Sequence.CreateTempFile();

            GridSequences.Rows.Clear();
            GridSequences.Refresh();
        }
Ejemplo n.º 2
0
        public int GridScore()
        {
            int score = 0;

            if (GridSequences != null)
            {
                // Increase the score for each word.
                score += GridSequences.Count * Configuration.PointsPerWord;

                // Increase the score for intersecting letters.
                List <Char> intersectingLetters = GridSequences.GetIntersectingLetters();
                foreach (Char letter in intersectingLetters)
                {
                    score += Configuration.IntersectingPointsPerLetter[(int)letter - (int)'A'];
                }

                // Get all letters.
                List <Char> allLetters = new List <Char>();

                foreach (String[] letters in GridRows)
                {
                    foreach (String letter in letters)
                    {
                        if (letter[0] != ' ')
                        {
                            allLetters.Add(letter[0]);
                        }
                    }
                }

                // Remove each intersecting letter from allLetters.
                List <Char> nonIntersectingLetters = allLetters;
                foreach (Char letter in intersectingLetters)
                {
                    nonIntersectingLetters.Remove(letter);
                }

                // Increase the score for non-intersecting letters.
                foreach (Char letter in nonIntersectingLetters)
                {
                    score += Configuration.NonIntersectingPointsPerLetter[(int)letter - (int)'A'];
                }
            }

            return(score);
        }
Ejemplo n.º 3
0
        public Boolean IsValid(WordData wordData)
        {
            GridSequences.GridWordDataErrorsDetected = false;

            // Check that if the word data is not overlapping with opposite oriented words
            if (wordData.Orientation.IsHorizontal)
            {
                GridSequences.CheckVerticalIntersectionOverlapping(wordData);
            }
            else
            {
                GridSequences.CheckHorizontalIntersectionOverlapping(wordData);
            }

            // Check that if the word data is not overlapping with words having same orientation AND
            // Check that if the word data is not touching other words havings same/opposite orientation
            if (GridSequences.GridWordDataErrorsDetected == false)
            {
                GridSequences.CheckTouchingWords(wordData);
            }

            // Check word group count
            if (GridSequences.GridWordDataErrorsDetected == false)
            {
                GridSequences.CheckGroupCount(GridRows, GridColumns, wordData);
            }

            // If the grid is valid?
            if (GridSequences.GridWordDataErrorsDetected)
            {
                return(false);
            }
            else
            {
                return(true);
            }
        }