I think the background choice is fine, it's not like she has to ditch the tech because she left the city or anything. Just going a stroll, watching for bears.
I like the piece! I never heard of that game though. Sounds fun!
I think the background choice is fine, it's not like she has to ditch the tech because she left the city or anything. Just going a stroll, watching for bears.
I like the piece! I never heard of that game though. Sounds fun!
I love the old guy they quoted: we built tunnels to hide from the Americans, building one for a train shouldn't be hard! 🤣
Back in my day, we dug them out by hand, had no light, and had to haul the dirt back ourselves! You kids have it too easy!
I'm way behind, but I'm trying to learn F#.
I'm using the library Combinatorics in dotnet, which I've used in the past, generate in this case every duplicating possibility of the operations. I the only optimization that I did was to use a function to concatenate numbers without converting to strings, but that didn't actually help much.
I have parser helpers that use ReadOnlySpans over strings to prevent unnecessary allocations. However, here I'm adding to a C# mutable list and then converting to an FSharp (linked) list, which this language is more familiar with. Not optimal, but runtime was pretty good.
I'm not terribly good with F#, but I think I did ok for this challenge.
// in another file:
let concatenateLong (a:Int64) (b:Int64) : Int64 =
let rec countDigits (n:int64) =
if n = 0 then 0
else 1 + countDigits (n / (int64 10))
let bDigits = if b = 0 then 1 else countDigits b
let multiplier = pown 10 bDigits |> int64
a * multiplier + b
// challenge file
type Operation = {Total:Int64; Inputs:Int64 list }
let parse (s:ReadOnlySpan<char>) : Operation =
let sep = s.IndexOf(':')
let total = Int64.Parse(s.Slice(0, sep))
let inputs = System.Collections.Generic.List<Int64>()
let right:ReadOnlySpan<char> = s.Slice(sep + 1).Trim()
// because the Split function on a span returns a SpanSplitEnumerator, which is a ref-struct and can only live on the stack,
// I can't use the F# list syntax here
for range in right.Split(" ") do
inputs.Add(Int64.Parse(sliceRange right range))
{Total = total; Inputs = List.ofSeq(inputs) }
let part1Ops = [(+); (*)]
let execute ops input =
input
|> PSeq.choose (fun op ->
let total = op.Total
let inputs = op.Inputs
let variations = Variations(ops, inputs.Length - 1, GenerateOption.WithRepetition)
variations
|> Seq.tryFind (fun v ->
let calcTotal = (inputs[0], inputs[1..], List.ofSeq(v)) |||> List.fold2 (fun acc n f -> f acc n)
calcTotal = total
)
|> Option.map(fun _ -> total)
)
|> PSeq.fold (fun acc n -> acc + n) 0L
let part1 input =
(read input parse)
|> execute part1Ops
let part2Ops = [(+); (*); concatenateLong]
let part2 input = (read input parse) |> execute part2Ops
The Gen0 garbage collection looks absurd, but Gen0 is generally considered "free".
Method | Mean | Error | StdDev | Gen0 | Gen1 | Allocated |
---|---|---|---|---|---|---|
Part1 | 19.20 ms | 0.372 ms | 0.545 ms | 17843.7500 | 156.2500 | 106.55 MB |
Part2 | 17.94 ms | 0.355 ms | 0.878 ms | 17843.7500 | 156.2500 | 106.55 MB |
V2 - concatenate numbers did little for the runtime, but did help with Gen1 garbage, but not the overall allocation.
Method | Mean | Error | StdDev | Gen0 | Gen1 | Allocated |
---|---|---|---|---|---|---|
Part1 | 17.34 ms | 0.342 ms | 0.336 ms | 17843.7500 | 125.0000 | 106.55 MB |
Part2 | 17.24 ms | 0.323 ms | 0.270 ms | 17843.7500 | 93.7500 | 106.55 MB |
I'm way behind in AoC this year, but I thought I'd give some feedback. I haven't used gleam, but I'm using F# and this looks quite similar:
let new_pos = case guard.direction {
North -> #(-1, 0)
East -> #(0, 1)
South -> #(1, 0)
West -> #(0, -1)
}
I never thought of doing that to change points. thumbs up!
Overall your approach looks good.
Hol' up a minute
Oh this is actually a real thing I was rolling my eyes like "just show me the clicks and clucks in the code"
It was managed, just not for his benefit
(╯°□°)╯︵ ┻━┻
I don't really understand people saying it's not part of the lore. I did the expansions and everything. I got the ending, assuming that I remember correctly, where Ciri becomes a witcher. And in the expansions, Geralt just wanted to retire on a mountain vineyard in not-France.
One thing I was thinking of with the announcement is what would they do with the witcher powers, but from the electric punch in the preview, my guess is they're going to expand her psychic powers to take the place of witcher powers.
I'm looking foward to it. It looks kick ass.
Also - are there actually as many compaints as people make it out to be? Like I've never met anyone in real life who didn't like that a game featured a woman.
Nobody who says this has ever given housing to the poor or kept a poor family fed. Also, nice use of equating a conquering empire to your own government, as if those were anything closely equal.
I'll do Jesus' principals with my actions. You can stick to your platitudes.
Nitpick: eminent domain is not the means for publicizing a company, that's for land for public works
As one user posted, the best way is to do them manually. Proton has a spam filter, but their whole thing is not reading your email.