private void AddWordToValidWordsIfValid(string partialWord) { if (!DawgWithAlphabet.IsWordValid(partialWord)) { return; } HorizontalBoardWord wordTiles = BoardWordRetriever.GetHorizontalWordTilesAtCoordinates(StartingBoardTile.X, StartingBoardTile.Y); ValidWords.Add(wordTiles); //Debug.WriteLine(wordTiles.GetWord()); }
public List <BoardWord> GetPossibleMoves(BoardTile anchor, IPlayerRack playerRack) { ValidWords = new List <BoardWord>(); PlayerRack = playerRack; StartingBoardTile = anchor; BoardTilesAndTheirCrossChecks = new Dictionary <BoardTile, HashSet <char> >(); HorizontalBoardWord wordToTheLeftOfAnchor = BoardWordRetriever.GetHorizontalWordTilesAtCoordinates(StartingBoardTile.X, StartingBoardTile.Y - 1); string partialWord = wordToTheLeftOfAnchor?.GetWord() ?? ""; LeftPartIsAlreadyProvided = partialWord.Length > 0; BoardTilesAndTheirCrossChecks.Add(StartingBoardTile, BoardCrossCheckCollector.GetCrossChecksForBoardTile(StartingBoardTile)); BoardAnchorCollector boardAnchorCollector = new(); BoardTileCollection boardAnchors = boardAnchorCollector.GetAnchors(Board); DawgNode node = GetDawgNode(partialWord); BoardNonAnchorTileCounter boardNonAnchorTileCounter = new(Board); int limit = boardNonAnchorTileCounter.GetNumberOfNonAnchorTilesToTheLeftOfABoardTile(StartingBoardTile, boardAnchors); LeftPart(node, limit, anchor); return(ValidWords); }