Difference between revisions of "Bonus points at end of game for longest and highest scored words"
(Created page with "Create four local variables in the main game class. <syntaxhighlight lang="C#"> private static int highestScoredWord = 0; private static string highestScoredWordByPlayer = St...") |
(No difference)
|
Revision as of 09:52, 24 May 2018
Create four local variables in the main game class.
private static int highestScoredWord = 0;
private static string highestScoredWordByPlayer = String.Empty;
private static int longestScoredWord = 0;
private static string longestScoredWordByPlayer = String.Empty;
Then in the Have Turn method, after the player has entered a valid choice
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) {
// Some Stuff Was Here
if (ValidWord) {
if (Choice.Length > longestScoredWord) {
longestScoredWord = Choice.Length;
longestScoredWordByPlayer = PlayerName;
}
if (GetScoreForWord(Choice, TileDictionary) > highestScoredWord) {
highestScoredWord = GetScoreForWord(Choice, TileDictionary);
highestScoredWordByPlayer = PlayerName;
}
// Some stuff is here
}
}