2023-12-04 12:42:23 +01:00
|
|
|
import std/[cmdline, math, sequtils, strformat]
|
2023-12-04 09:39:35 +01:00
|
|
|
|
2023-12-04 12:42:23 +01:00
|
|
|
import common
|
2023-12-04 11:36:45 +01:00
|
|
|
|
2023-12-04 12:42:23 +01:00
|
|
|
var fn = if paramCount() > 0: paramStr(1) else: "input_04.txt"
|
2023-12-04 11:36:45 +01:00
|
|
|
|
2023-12-04 12:42:23 +01:00
|
|
|
var cards = parseInput(readFile(fn))
|
|
|
|
var result = sum(cards.mapIt(it.points))
|
2023-12-04 11:36:45 +01:00
|
|
|
echo &"Cards processed: {cards.len}"
|
2023-12-04 09:39:35 +01:00
|
|
|
echo &"Result: {result}"
|
|
|
|
|
|
|
|
case fn:
|
|
|
|
of "input_04.txt":
|
|
|
|
assert result == 18519
|
|
|
|
of "sample_input_04.txt":
|
|
|
|
assert result == 13
|