CheckWordIsInTiles

From TRCCompSci - AQA Computer Science
Revision as of 11:12, 14 November 2017 by Megan (talk | contribs) (Created page with " private static bool CheckWordIsInTiles(string Word, string PlayerTiles) { bool InTiles = true; string CopyOfTiles = PlayerTiles;...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search
       private static bool CheckWordIsInTiles(string Word, string PlayerTiles)
       {
           bool InTiles = true;
           string CopyOfTiles = PlayerTiles;
           for (int Count = 0; Count < Word.Length; Count++)
           {
               if (CopyOfTiles.Contains(Word[Count]))
               {
                   CopyOfTiles = CopyOfTiles.Remove(CopyOfTiles.IndexOf(Word[Count].ToString()), 1);
               }
               else
               {
                   InTiles = false;
               }
           }
           return InTiles;
       }