aboutsummaryrefslogtreecommitdiff
path: root/aoc-2022-dotnet/Day02/Program.fs
diff options
context:
space:
mode:
Diffstat (limited to 'aoc-2022-dotnet/Day02/Program.fs')
-rw-r--r--aoc-2022-dotnet/Day02/Program.fs8
1 files changed, 2 insertions, 6 deletions
diff --git a/aoc-2022-dotnet/Day02/Program.fs b/aoc-2022-dotnet/Day02/Program.fs
index 0546195..8568f9a 100644
--- a/aoc-2022-dotnet/Day02/Program.fs
+++ b/aoc-2022-dotnet/Day02/Program.fs
@@ -2,6 +2,7 @@
open System.IO
open FSharpPlus
+open Common
type Move =
| Rock
@@ -36,11 +37,6 @@ type Strategy =
| "Z" -> Z
| s -> failwithf "Invalid strategy: %s" s
-let splitToTuple sep str =
- match Seq.toList <| String.split [ sep ] str with
- | [ x; y ] -> x, y
- | _ -> failwith "Invalid string format!"
-
let scoreRound (enemy, player) =
let selectionScore =
match player with
@@ -70,7 +66,7 @@ let guide2 (enemy: Move) =
let parseRound guide roundStr =
let (enemy, strategy) =
roundStr
- |> splitToTuple " "
+ |> Util.splitStringToTuple " "
|> mapItem1 Move.parse
|> mapItem2 Strategy.parse