find valid words in randomly generated characters in c# unity
I have generated random characters at runtime and after generating I need to know the count of valid words formed with the listed characters. And that is not in a matrix form, it will show in a single line.
This is the code for generating random characters:
public void GenerateLettersAtStart() { for (int i = 0; i <= 6; i++) { wordRan.wordsStore.Clear(); a = UnityEngine.Random.Range(0,consonants.Length); availablesetConsonants [i].GetComponent ().text = consonants[a].ToString(); } for (int j = 0; j <= 2; j++) { wordRan.wordsStore.Clear(); b = UnityEngine.Random.Range(0, vowels.Length); availablesetVowels [j].GetComponent ().text = vowels[b].ToString(); } } its literally like permutations but the word should be meaningful. i have text document to compare i have load that through text asset.. it is a word scrambler game actually here i need to show the count of unscrambled valid words from the listed random letters –
void Awake() { string[] w = wordAsset.text.Split(new char[] { '\n', '\r' }, System.StringSplitOptions.RemoveEmptyEntries); allWords = new HashSet(w);
}
public void Start() { //RepeatedWordsCheck ();
} public void Update() {
}
public bool CheckWord(string wrd) { return allWords.Contains(wrd.ToLower());
} public void ClickFun() { Debug.Log ("acx"); bool Check = CheckWord (GameController.currentWord); if (Check == true ) { Debug.Log("correct word"); } }
Your answer