File tree Expand file tree Collapse file tree 2 files changed +20
-1
lines changed Expand file tree Collapse file tree 2 files changed +20
-1
lines changed Original file line number Diff line number Diff line change
1
+ const { loadInput } = require ( './helpers' )
2
+ const { Cave } = require ( './caves' )
3
+
4
+ const init = ( data ) => {
5
+ const cave = new Cave ( data )
6
+ while ( cave . outcome === null ) {
7
+ cave . advance ( )
8
+ }
9
+ // Get total hitpoints of winning army X the number of completed rounds
10
+ const answer = cave . rounds * cave . units . filter ( ( unit ) => unit . type === cave . outcome ) . reduce ( ( hp , unit ) => hp + unit . hp , 0 )
11
+
12
+ const answer2 = ''
13
+ console . log ( `-- Part 1 --` )
14
+ console . log ( `Answer: ${ answer } ` )
15
+ console . log ( `-- Part 2 --` )
16
+ console . log ( `Answer: ${ answer2 } ` )
17
+ }
18
+
19
+ loadInput ( init )
Original file line number Diff line number Diff line change 1
- require ( './2018/day-14 /solution' )
1
+ require ( './2018/day-15 /solution' )
You can’t perform that action at this time.
0 commit comments