Exemple #1
0
        public bool Check(WordEntry entry)
        {
            var  size   = new Point(Soup.Matrix.GetUpperBound(0), Soup.Matrix.GetUpperBound(1));
            var  origin = entry.AbsoluteOrigin();
            var  ending = entry.AbsoluteEnding();
            bool haveHorizontalSpace = origin.X >= 0 && ending.X <= size.X;
            bool haveVerticalSpace   = origin.Y >= 0 && ending.Y <= size.Y;

            return(haveHorizontalSpace && haveVerticalSpace);
        }
Exemple #2
0
        private bool IsOverlapped(WordEntry bigWord, WordEntry smallWord)
        {
            var  big      = bigWord.AbsoluteOrigin();
            var  small    = smallWord.AbsoluteOrigin();
            bool overlapp = false;

            if (bigWord.Direction.MovesHorizontal())
            {
                overlapp = small.X >= big.X && small.X + smallWord.Name.Length <= big.X + bigWord.Name.Length;
            }
            if (!overlapp && bigWord.Direction.MovesVertical())
            {
                overlapp = small.Y >= big.Y && small.Y + smallWord.Name.Length <= big.Y + bigWord.Name.Length;
            }
            return(overlapp);
        }