use GetValueOrDefault
continuous-integration/drone/push Build is passing Details

This commit is contained in:
Ben Harris 2021-12-23 13:50:48 -05:00
parent 9edb557cd9
commit 5c32a53ad3
Signed by: ben
GPG Key ID: 4E0AF802FFF7960C
1 changed files with 2 additions and 7 deletions

View File

@ -109,13 +109,8 @@ public sealed class Day21 : Day
for (var x = 1; x <= 3; x++)
for (var y = 1; y <= 3; y++)
for (var z = 1; z <= 3; z++)
{
var total = x + y + z;
if (!_possibleRollOutComes.ContainsKey(total))
_possibleRollOutComes[total] = 1;
else
_possibleRollOutComes[total]++;
}
_possibleRollOutComes[x + y + z] =
_possibleRollOutComes.GetValueOrDefault(x + y + z, 0ul) + 1ul;
RollDiracDie(0, 0, _player1, _player2, 1, 1);