Main Section 2018
static void Main(string[] args)
{
List<String> AllowedWords = new List<string>();
Dictionary<Char, int> TileDictionary = new Dictionary<char, int>();
int MaxHandSize = 20;
int MaxTilesPlayed = 50;
int NoOfEndOfTurnTiles = 3;
int StartHandSize = 15;
string Choice = "";
Console.WriteLine("++++++++++++++++++++++++++++++++++++++");
Console.WriteLine("+ Welcome to the WORDS WITH AQA game +");
Console.WriteLine("++++++++++++++++++++++++++++++++++++++");
Console.WriteLine("");
Console.WriteLine("");
LoadAllowedWords(ref AllowedWords);
CreateTileDictionary(ref TileDictionary);
while (Choice != "9")
{
DisplayMenu();
Console.Write("Enter your choice: ");
Choice = Console.ReadLine();
if (Choice == "1")
{
PlayGame(AllowedWords, TileDictionary, true, StartHandSize, MaxHandSize, MaxTilesPlayed, NoOfEndOfTurnTiles);
}
else if (Choice == "2")
{
PlayGame(AllowedWords, TileDictionary, false, 15, MaxHandSize, MaxTilesPlayed, NoOfEndOfTurnTiles);
}
}
}
The main method initialises any default values, loads the allowed-words from a local static method (GetAllowedWords) & creates the tile directory. Then it starts a continual loop until the players enters the option '9' on the home-screen. Here an if/else statement seperates two function calls to the same method with the only different parameters being a boolean (randomstart) and the size of the StartHand.