Difference between revisions of "If a player presses enter without typing a word it is an invalid move"

From TRCCompSci - AQA Computer Science
Jump to: navigation, search
(Created page with "<syntaxhighlight lang=csharp> private static void HaveTurn(string PlayerName, ref string PlayerTiles, ref int PlayerTilesPlayed, ref int PlayerScore, Dictionary<char, int> Til...")
 
Line 16: Line 16:
 
                     continue;
 
                     continue;
 
                 }  
 
                 }  
<syntaxhighlight>
+
</syntaxhighlight>
 
  * This code demonstrates what would happen if a user was to attempt entering a word that does not exist
 
  * This code demonstrates what would happen if a user was to attempt entering a word that does not exist
 
  * The part of the code used for this function can be found starting line 14, finishing on line 17
 
  * The part of the code used for this function can be found starting line 14, finishing on line 17
 
  * This means that if the user word is equal to nothing, it takes the user back to the choice screen
 
  * This means that if the user word is equal to nothing, it takes the user back to the choice screen
 
  * This code avoids potential accidents if a misclick occurs
 
  * This code avoids potential accidents if a misclick occurs

Revision as of 15:04, 14 November 2017

private static void HaveTurn(string PlayerName, ref string PlayerTiles, ref int PlayerTilesPlayed, ref int PlayerScore, Dictionary<char, int> TileDictionary, ref QueueOfTiles TileQueue, List<string> AllowedWords, int MaxHandSize, int NoOfEndOfTurnTiles)
        {
            Console.WriteLine();
            Console.WriteLine(PlayerName + " it is your turn.");
            DisplayTilesInHand(PlayerTiles);
            string NewTileChoice = "2";
            bool ValidChoice = false;
            bool ValidWord = false;
            string Choice = "";
            while (!ValidChoice)
            {
                Choice = GetChoice();
                if (Choice == "") 
                {
                    continue;
                }
* This code demonstrates what would happen if a user was to attempt entering a word that does not exist
* The part of the code used for this function can be found starting line 14, finishing on line 17
* This means that if the user word is equal to nothing, it takes the user back to the choice screen
* This code avoids potential accidents if a misclick occurs