This commit is contained in:
Smaug123
2023-12-07 22:32:30 +00:00
parent b5080bf7e1
commit e40bbf7203

View File

@@ -50,26 +50,26 @@ module Day7 =
type RankedHand = uint32 type RankedHand = uint32
[<Literal>] [<Literal>]
let fifteen = 14ul let fourteen = 14ul
[<Literal>] [<Literal>]
let fifteenFive = fifteen * fifteen * fifteen * fifteen * fifteen let fourteenFive = fourteen * fourteen * fourteen * fourteen * fourteen
[<Literal>] [<Literal>]
let fifteenFour = fifteen * fifteen * fifteen * fifteen let fourteenFour = fourteen * fourteen * fourteen * fourteen
[<Literal>] [<Literal>]
let fifteenThree = fifteen * fifteen * fifteen let fourteenThree = fourteen * fourteen * fourteen
[<Literal>] [<Literal>]
let fifteenTwo = fifteen * fifteen let fourteenTwo = fourteen * fourteen
let toInt (hand : Hand) (contents : HandContents) : RankedHand = let toInt (hand : Hand) (contents : HandContents) : RankedHand =
uint32 hand * fifteenFive uint32 hand * fourteenFive
+ uint32 contents.First * fifteenFour + uint32 contents.First * fourteenFour
+ uint32 contents.Second * fifteenThree + uint32 contents.Second * fourteenThree
+ uint32 contents.Third * fifteenTwo + uint32 contents.Third * fourteenTwo
+ uint32 contents.Fourth * fifteen + uint32 contents.Fourth * fourteen
+ uint32 contents.Fifth + uint32 contents.Fifth
let inline parseHand (tallyBuffer : ResizeArray<_>) (adjustJoker : bool) (s : ReadOnlySpan<char>) : RankedHand = let inline parseHand (tallyBuffer : ResizeArray<_>) (adjustJoker : bool) (s : ReadOnlySpan<char>) : RankedHand =