File tree Expand file tree Collapse file tree 2 files changed +5
-4
lines changed Expand file tree Collapse file tree 2 files changed +5
-4
lines changed Original file line number Diff line number Diff line change @@ -8,7 +8,7 @@ namespace AdventOfCode.Y2018.Day24;
8
8
[ ProblemName ( "Immune System Simulator 20XX" ) ]
9
9
class Solution : Solver {
10
10
11
- ( bool immuneSystem , int units ) Fight ( string input , int boost ) {
11
+ ( bool immuneSystem , long units ) Fight ( string input , int boost ) {
12
12
var army = Parse ( input ) ;
13
13
foreach ( var g in army ) {
14
14
if ( g . immuneSystem ) {
@@ -112,21 +112,21 @@ List<Group> Parse(string input) {
112
112
class Group {
113
113
//4 units each with 9798 hit points (immune to bludgeoning) with an attack that does 1151 fire damage at initiative 9
114
114
public bool immuneSystem ;
115
- public int units ;
115
+ public long units ;
116
116
public int hp ;
117
117
public int damage ;
118
118
public int initiative ;
119
119
public string attackType ;
120
120
public HashSet < string > immuneTo = new HashSet < string > ( ) ;
121
121
public HashSet < string > weakTo = new HashSet < string > ( ) ;
122
122
123
- public int effectivePower {
123
+ public long effectivePower {
124
124
get {
125
125
return units * damage ;
126
126
}
127
127
}
128
128
129
- public int DamageDealtTo ( Group target ) {
129
+ public long DamageDealtTo ( Group target ) {
130
130
if ( target . immuneSystem == immuneSystem ) {
131
131
return 0 ;
132
132
} else if ( target . immuneTo . Contains ( attackType ) ) {
Original file line number Diff line number Diff line change 3
3
<OutputType >Exe</OutputType >
4
4
<TargetFramework >net6.0</TargetFramework >
5
5
<LangVersion >10</LangVersion >
6
+ <CheckForOverflowUnderflow >true</CheckForOverflowUnderflow >
6
7
</PropertyGroup >
7
8
<ItemGroup >
8
9
<PackageReference Include =" AngleSharp" Version =" 0.13.0" />
You can’t perform that action at this time.
0 commit comments