This year, I thought of participating in Advent of Code using Snap! I was wondering whether anyone else wanted to.
(Mods, can I share a link to a private leaderboard? No talk happens and the only thing it does is show who did first in the group instead of the global one.)
Yeah, me neither. Only time I got close to the global leaderboard (179 or something) was by hand :^) Just wandering if I could get some company, really.
Two things:
A) I am developing a simple Node server to fetch inputs without copy-paste
B) I just realized Snap is awfully slow! 2015 day one (that is, input is a long list of (s and )s and you either add or remove one to a counter based on the character) on 7000 chars took something along the line of 3 minutes.
Normally Snap! spends a lot of time updating displays and check to see if anything else wants to use the computer but it can be switched info fast mode when required
@bh I admire your defensive programming approach in not assuming the input just contains ( or )
Can I ask that even you yourself, use the Hide Details, so that future coders coming along don't see solutions unless they go digging
What's Advent of Code?
(btw, I don't have access to most websites so please don't try to explain with a single link...you can copy + paste the info...)
stack=Stack()
reverse={"(":")","[":"]","{":"}"}
for i in string:
if peek(stack)==reverse[i]:
ignore(pop(stack))
else:
push(stack,i)
end
end
return stack
A defensive approach like this is usually cool, but one thing to note is that AoC will never "fool" you, you are not working with input that needs to be sanitized/verified. Also yes, I forgot to warp
Oops!
I wasn't trying to be "defensive." It's just that all I had to go on was your very brief summary of the problem, so I didn't know what the input was supposed to be. And for that matter I wasn't trying to solve it, just to time it to make sure Snap! wasn't being as slow as you said. :~)
This is a thread purely about using Snap! (just Snap!) for the Advent of Code puzzles
As I asked, even if you post Snap! code - pleas hide it using Hide Details so that anyone who hasn't completed the puzzle doesn't see any solutions that would spoil the challenge for them