internal List <RowColPair> getLetterLocationsRelativeHorizontally(string candidate, RowColPair cell) { RowColPair uniqueLoc = null; //if (uniqueLetters[curWord] != null) // getLocationByID(uniqueLetters[curWord].id); List <RowColPair> locs = new List <RowColPair>(); for (int row = 0; row < dim; ++row) { for (int col = -1; col < 2; ++col) { int candRow = row; int candCol = cell.Col + col; if (candRow >= 0 && candRow < dim && candCol >= 0 && candCol < dim && board[candRow, candCol] != null && board[candRow, candCol].c.Equals(candidate)) { //if (uniqueLoc == null || closeEnoughToUniqueLetter(uniqueLoc, candRow, candCol)) locs.Add(new RowColPair(candRow, candCol)); } } } return(locs); }
internal List <RowColPair> getLetterLocations(string letter) { RowColPair uniqueLoc = null; //if (uniqueLetters[curWord] != null) // getLocationByID(uniqueLetters[curWord].id); List <RowColPair> locs = new List <RowColPair>(); for (int row = 0; row < dim; ++row) { for (int col = 0; col < dim; ++col) { if (board[row, col] != null && board[row, col].c.Equals(letter)) { locs.Add(new RowColPair(row, col)); } } } return(locs); }
internal static Board GetNewBoardState(Board board, RowColPair item, bool newWord = false) { //Make a copy of the board we can manipulate Board b = board.copy(); //Remove the first letter and add it to the solve order b.words[0] = board.words[0].Remove(0, 1); var cell = board.getCell(item.Row, item.Col); b.solveOrder.Add(cell.id); if (b.solveOrder.Count > Board.maxSolveLength) { Board.maxSolveLength = b.solveOrder.Count; } //Make curCell point to location of letter we just processed b.curCell = item; return(b); }