Skip to content

Commit 21d3378

Browse files
committed
Add CheckForOverflowUnderflow to csproj
1 parent cf7450f commit 21d3378

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

2018/Day24/Solution.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ namespace AdventOfCode.Y2018.Day24;
88
[ProblemName("Immune System Simulator 20XX")]
99
class Solution : Solver {
1010

11-
(bool immuneSystem, int units) Fight(string input, int boost) {
11+
(bool immuneSystem, long units) Fight(string input, int boost) {
1212
var army = Parse(input);
1313
foreach (var g in army) {
1414
if (g.immuneSystem) {
@@ -112,21 +112,21 @@ List<Group> Parse(string input) {
112112
class Group {
113113
//4 units each with 9798 hit points (immune to bludgeoning) with an attack that does 1151 fire damage at initiative 9
114114
public bool immuneSystem;
115-
public int units;
115+
public long units;
116116
public int hp;
117117
public int damage;
118118
public int initiative;
119119
public string attackType;
120120
public HashSet<string> immuneTo = new HashSet<string>();
121121
public HashSet<string> weakTo = new HashSet<string>();
122122

123-
public int effectivePower {
123+
public long effectivePower {
124124
get {
125125
return units * damage;
126126
}
127127
}
128128

129-
public int DamageDealtTo(Group target) {
129+
public long DamageDealtTo(Group target) {
130130
if (target.immuneSystem == immuneSystem) {
131131
return 0;
132132
} else if (target.immuneTo.Contains(attackType)) {

adventofcode.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
<OutputType>Exe</OutputType>
44
<TargetFramework>net6.0</TargetFramework>
55
<LangVersion>10</LangVersion>
6+
<CheckForOverflowUnderflow>true</CheckForOverflowUnderflow>
67
</PropertyGroup>
78
<ItemGroup>
89
<PackageReference Include="AngleSharp" Version="0.13.0" />

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy