Fix a performance issue in _find_solutions.

WordTwist successors can take you in circles (scare > stare > scare),
so check for this condition to avoid generating overly many potential
solutions.
This commit is contained in:
Mike Mueller 2012-03-02 17:04:21 -08:00
parent 17d1f91f8c
commit a443d66473
1 changed files with 2 additions and 0 deletions

View File

@ -277,6 +277,8 @@ class WordChain(BaseGame):
else:
words = self._get_successors(seed[-1])
for word in words:
if word in seed:
continue
if word == self.solution[-1]:
self.solutions.append(seed + [word])
else: