Open GoogleCodeExporter opened 9 years ago
Looks like I may have a solution:
original (if key is not found)
k.Word = GetWord(GetRandomKey())
change:
k.Current = GetRandomKey();
k.Previous = string.Empty;
k = GetWord(k);
Basically, this is re-initializing the key as was done on the first iteration
through the loop.
Which suggests we've got some common code.
Except that the three lines are split apart the first time they occur, with the
last being inside of a loop.
Plus, I'm uneasy with the potential for infinite recursion (should not happen,
since we get an existing key inside the function, then the function checks to
see if the key exists. Since it is an existing key, we can't fall into the
..else block that recurses.
But it still looks ugly to me.
Original comment by xraysmalevich
on 10 May 2012 at 2:46
Original issue reported on code.google.com by
xraysmalevich
on 18 Apr 2012 at 5:21