예제 #1
0
 internal void PutWordAtLocationInDirection(string word, LocationOnGrid location, DirectionInGrid direction)
 {
     foreach (char c in word)
     {
         PutCharAtLocation(c, location);
         location = location.AfterSoManyStepsInDirection(1, direction);
     }
 }
예제 #2
0
        public string GetWordOfLengthInDirectionAtLocation(int wordLength, DirectionInGrid direction, LocationOnGrid location)
        {
            string wordOut = "";

            for (int i = 0; i < wordLength; i++)
            {
                var c = CharAtLocation(location);
                wordOut += c.ToString();
                location = location.AfterSoManyStepsInDirection(1, direction);
            }

            return(wordOut);
        }
예제 #3
0
        private bool IsSpaceEnough(DirectionInGrid direction, LocationOnGrid location, string word, Puzzle puzzle)
        {
            var finalLoc = location.AfterSoManyStepsInDirection(word.Length, direction);

            return(finalLoc.IsValidLocationInPuzzle(puzzle, finalLoc));
        }