Difference between revisions of "UpdateScoreWithPenalty"
Line 9: | Line 9: | ||
</syntaxhighlight> | </syntaxhighlight> | ||
− | 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. | + | 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. |
Latest revision as of 13:35, 14 November 2017
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.