Now I am working on a set of game games as a learning tool (and to recreate some of my favorite word games!) With the help of the "actual" learned friend-programmer, we implemented a good permutation method in one of my classes. He finds all permutations of 3 letters or more and compares them with lists of strings, which contain, in fact, a list of words from the Scrabble tournament.
Here is the background, here is my current problem: now I have all the permutations and compare them with existing words and created a new List with all possible combinations of words on this line. However, when I present this line to the user, I need it to be scrambled. I found several C # implementations in Shuffle from Fisher-Yates, but I was not able to adapt them to accept a single line (EDIT problem: Fisher-Yates resolved using the char [] array). Then I had the idea to hack a bit - why not use one of the permutations with the same length, but this! = Source word.
Unfortunately, every time my conditional statement returns a word back. Not so difficult for the end user to figure out :) Here is my code for scrambling:
String strScrambled= "";
foreach (List<string> listWords in permWords.Values)
{
foreach (string word in listWords)
{
if (word.Length == strWord.Length && word != strWord)
{
strScrambled = word;
}
}
}
strScrambled = word + 1, , . , "" ; , - .
, Fisher-Yates char, , - , , - , . , ; .