UpdateScoreWithPenalty
Revision as of 11:58, 14 November 2017 by Cas massive (talk | contribs) (Created page with " private static void UpdateScoreWithPenalty(ref int PlayerScore, string PlayerTiles, Dictionary<char, int> tileDictionary) { for (int Count = 0; Cou...")
private static void UpdateScoreWithPenalty(ref int PlayerScore, string PlayerTiles, Dictionary<char, int> tileDictionary) { for (int Count = 0; Count < PlayerTiles.Length; Count++) { PlayerScore = PlayerScore - tileDictionary[PlayerTiles[Count]]; } }
The UpdateScoreWithPenalty they use a for loop to update the score. In the "for (int Count = 0; Count < PlayerTiles.Length; Count++)" increases the value of count by 1. In "PlayerScore = PlayerScore - tileDictionary[PlayerTiles[Count]];" this finds the value of the player tiles from the tileDictionary and takes them away from the player score to get the final sum of that round.