Exemplo n.º 1
0
func findWords(w *word.Word, row, col int) {
	if isValidWord(w.Word()) {
		foundWords[w.Word()] = true
	}

	validCoordsForWord := getValidCoords(w, row, col)
	for _, coords := range validCoordsForWord {
		if d.ContainsPrefix(w.Word() + b.Letter(coords[0], coords[1])) {
			newWord := word.NewFromWord(w)
			newWord.AddLetter(b.Letter(coords[0], coords[1]), coords[0], coords[1])
			findWords(newWord, coords[0], coords[1])
		}
	}
}