Stop going insane
Some checks failed
ci/woodpecker/push/build Pipeline was successful
ci/woodpecker/push/all-checks-complete Pipeline was successful
ci/woodpecker/pr/build Pipeline failed
ci/woodpecker/pr/all-checks-complete unknown status

This commit is contained in:
Smaug123
2023-12-07 23:26:56 +00:00
parent e40bbf7203
commit 92c46cda5b
3 changed files with 43 additions and 9 deletions

View File

@@ -2,6 +2,7 @@ namespace AdventOfCode2023
open System
open System.Globalization
open AdventOfCode2023.ResizeArray
type Hand =
| Five = 6
@@ -72,7 +73,7 @@ module Day7 =
+ uint32 contents.Fourth * fourteen
+ uint32 contents.Fifth
let inline parseHand (tallyBuffer : ResizeArray<_>) (adjustJoker : bool) (s : ReadOnlySpan<char>) : RankedHand =
let parseHand (tallyBuffer : ResizeArray<_>) (adjustJoker : bool) (s : ReadOnlySpan<char>) : RankedHand =
let contents =
{
First = toByte adjustJoker s.[0]
@@ -94,14 +95,13 @@ module Day7 =
0, -1
else
let mutable jokerCount = 0
let mutable jokerPos = -1
for i = 0 to tallyBuffer.Count - 1 do
let card, tally = tallyBuffer.[i]
let mutable jokerPos = 0
while jokerPos < tallyBuffer.Count && jokerCount = 0 do
let card, tally = tallyBuffer.[jokerPos]
if card = joker then
jokerCount <- tally
jokerPos <- i
else
jokerPos <- jokerPos + 1
jokerCount, jokerPos
@@ -171,8 +171,8 @@ module Day7 =
let parse (adjustJoker : bool) (s : string) : ResizeArray<RankedHandAndBid> =
use mutable lines = StringSplitEnumerator.make '\n' s
let result = ResizeArray ()
let tallies = ResizeArray 5
let result = ResizeArray.create 4
let tallies = ResizeArray.create 5
while lines.MoveNext () do
if not lines.Current.IsEmpty then