<FromGitter>
<tenebrousedge> kay. It's 2005 hours. Do I keep coding?
<FromGitter>
<Daniel-Worrall> 4 hour break, start again when AoC drops
<FromGitter>
<tenebrousedge> kay
f1refly has joined #crystal-lang
<FromGitter>
<tenebrousedge> hmmm. Your solution today was short
f1refly- has quit [Ping timeout: 272 seconds]
<Andriamanitra>
kevinsjoberg: maybe you've figured it out by now but you can save a lot of performance if in part1 you start from the desired vertex rather than doing full dfs for every bag in the input (you'd need to modify the graph to allow traversing in that direction)
teardown has quit [Ping timeout: 240 seconds]
teardown has joined #crystal-lang
deavmi has quit [Read error: Connection reset by peer]
deavmi has joined #crystal-lang
f1refly has quit [Ping timeout: 256 seconds]
coderobe has quit [Quit: Ping timeout (120 seconds)]
coderobe has joined #crystal-lang
FromGitter has quit [Ping timeout: 260 seconds]
f1refly has joined #crystal-lang
oprypin has quit [Ping timeout: 264 seconds]
HumanG33k has quit [Remote host closed the connection]
HumanG33k has joined #crystal-lang
oprypin has joined #crystal-lang
f1refly has quit [Ping timeout: 264 seconds]
f1refly has joined #crystal-lang
_whitelogger has joined #crystal-lang
teardown_ has joined #crystal-lang
HumanG33k has quit [Ping timeout: 240 seconds]
teardown has quit [Ping timeout: 240 seconds]
f1refly has quit [Ping timeout: 264 seconds]
f1refly has joined #crystal-lang
HumanG33k has joined #crystal-lang
HumanG33k has quit [Remote host closed the connection]
<kevinsjoberg>
Andriamanitra: Yeah, realized it just before bed actually. I reversed the graph.
<kevinsjoberg>
Felt like todays problem was much easier than yesterdays. *shrugs*
<Andriamanitra>
yeah felt easier for sure, although i'm worried this is intcode v2
<Andriamanitra>
..so i'm determined to write the most robust overengineered interpreter i possibly can so i maybe don't need to start from scratch next time it comes up
<kevinsjoberg>
Haha, don't bring back those memories. Still haunts me.
<Andriamanitra>
search in the new crystal reference manual might need some love.. i typed in "while" and it says no matching documents
<Andriamanitra>
what's the ex.message.not_nil!.to_i about?
<f1reflyylmao>
I wanted a way to differentiate between regular "line doubled" acc output and "now we have reached the last line" acc output. Given that it tries to access a point after the array I thought raising an exception in that case may be dirty but functional
<f1reflyylmao>
That way I could use my loop searching function in my program repair function and saved a lot of work
<Andriamanitra>
oh i see now.. yeah that's certainly dirty :D
<f1reflyylmao>
Sometimes I think the rust guys may be onto something with their exceptionless language, but I just cant get myself to take a closer look
postmodern has quit [Quit: Leaving]
sorcus has quit [Quit: WeeChat 2.9]
f1reflyylmao has quit [Remote host closed the connection]
f1refly has joined #crystal-lang
<straight-shoota>
did anyone solve today's AoC part 2 _without_ brute force?
<kevinsjoberg>
nope, brute force all the way.
<yxhuvud>
no. Solver goes brr. I mean, it still takes like 0.006s.
<straight-shoota>
sure
<yxhuvud>
and that is before polishing.
<kevinsjoberg>
I had a list of candidates (all jmp and nop) and then just popped and flipped until it worked.
<straight-shoota>
just considering backtracking for academic reasons
<straight-shoota>
but it's hard also because every acc could be a target from any flipped nop
<f1refly>
I considered doing something clever for a moment, but it just didn't seem like it'd be worth it to me
<kevinsjoberg>
I was considering that initially, but decided not to pursue it in the end.
<Andriamanitra>
straight-shoota: yes, i did
<yxhuvud>
hmm. I have an idea that might work. Something to investigate tonight I think.
<Andriamanitra>
although not initially, i only implemented the smarter way afterwards
<f1refly>
You could probably make a finer selection of the list and consider only the nops that point to lines.size or the jumps that mask other jumps that point there
<Andriamanitra>
i went through the program once saving all the steps and the states at each step, then tried to continue from each state where the current instruction was either jmp or nop
<Andriamanitra>
funnily enough i first implemented the history just for debugging possible later problems and only then thought hey i can actually use this :p
<raz>
i don't even understand what the goal of that task is
<raz>
just run the thing and report the last value before it goes into a loop?
<Andriamanitra>
in part1, yeah
<Andriamanitra>
in part2 you want to find an input that takes you all the way through the code without looping
<raz>
ahh gotcha
<raz>
i wasn't logged in so only saw the first part
<raz>
i'm too lazy for these puzzles, but still curious :D
<Andriamanitra>
i do wonder if there's even less bruteforce method than mine, it's entirely possible there's some smart trick that lets you not even execute the code
<raz>
well my feeling is it's likely a play on the halting problem (so only brute force can solve it)
<raz>
but perhaps there's some algorithm hidden in the code that could make it predictable
<oprypin>
frojnd, yes quite interesting. in this case the compiler just never noticed that this method is broken because it never instantiated the method `verse_url(String, String)`, it only instantiated `verse_url(String, Time)`
<FromGitter>
<erdnaxeli:cervoi.se> did I found a bug?
<FromGitter>
<Blacksmoke16> prob something to do those two methods not returning the same thing
teardown has joined #crystal-lang
<FromGitter>
<Blacksmoke16> oh
<FromGitter>
<Blacksmoke16> no sure looks like a bug i think? it should know not to push the iterator stop value
<FromGitter>
<Blacksmoke16> :shrug: im not super familiar with iterators
<FromGitter>
<erdnaxeli:cervoi.se> yeah it's weird that it pushes the stop value
<FromGitter>
<erdnaxeli:cervoi.se> wel, that it tries
<FromGitter>
<Blacksmoke16> its part of how iterator is implemented
<FromGitter>
<Blacksmoke16> > To implement an Iterator you need to define a #next method that must return the next element in the sequence or Iterator::Stop::INSTANCE, which signals the end of the sequence (you can invoke #stop inside an iterator as a shortcut).
<FromGitter>
<erdnaxeli:cervoi.se> yeah i know, I would expect cons_pair et cons(2) to give the same result
<FromGitter>
<Blacksmoke16> needs updated but at this point im debating breaking it out into external docs as its quite long and changes too often to keep up with really :/
<FromGitter>
<RespiteSage> Just fell for one of the Crystal Classic Blunders: `while foo argument && other_condition`
<FromGitter>
<Blacksmoke16> rip
<FromGitter>
<RespiteSage> It had been just long enough since I fell for it the last time that I wasn't looking out for it.
<oprypin>
just use parentheses geez
<FromGitter>
<RespiteSage> I mean, yeah. Not using parens was the blunder.
<hightower4>
Hey, to run an idea here first. Often times, I do something like @x = Something.some_constructor(...), and then compiler says: "can't infer the type of instance variable ...". But as soon as Something is some non-built-in class, I often don't remember what the actual class will be. So...
<hightower4>
So the trick I use is I insert a known-invalid type, like @x : Int32 = Something.some_constructor(...)
<hightower4>
and by doing that I make the compiler tell me: instance variable '@db' of Abc must be Int32, not ( ClassInQuestion | Int32)
<FromGitter>
<Blacksmoke16> got an example?
<FromGitter>
<Blacksmoke16> but sounds like you should define the ivars outside of the constructor
<hightower4>
So, since it knows what the type is (ClassInQuestion), why not suggest to the user that it may be this class?
<hightower4>
here's an example:
<oprypin>
hightower4, that some_consutrctor should have a type annotation
mps has left #crystal-lang [#crystal-lang]
<raz>
oprypin: he complains about the error message not including what type it might be, tho
<hightower4>
Yes, no, I am suggesting a better error msg... let me finish the example
<hightower4>
I am looking at asterite's response. Did he misunderstand and think the issue asked for anything more but including the just-encountered type in error message text?
<hightower4>
Or he's saying that these two errors (one without type, one with) happen at different stages, and the type is not known in the first stage?
<raz>
no, i think he understands you but says the info isn't easily available in the problem case
<hightower4>
right,
<hightower4>
hm.. ok
<raz>
it sounds like the compiler could "pretend" a type was provided and figure it out that way, but that's probably an extra step
<hightower4>
Ah yes, yes, right
<hightower4>
To pretend it was NoReturn
<hightower4>
ok, got it
postmodern has joined #crystal-lang
Human_G33k has joined #crystal-lang
HumanG33k has quit [Remote host closed the connection]
<hightower4>
Hey Blacksmoke16, when using `assert` shard I got:
<hightower4>
(actually ok, needed a 'update')
<FromGitter>
<Blacksmoke16> That shard is deprecated as well in favor of the validator component