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.)

PS what category should this fall in?

I'm planning on doing it and I've been practising using some previous years puzzles.

But I'm not planning on racing anyone

Just in it to see if I've learnt enough Snap! to be able to do them

Might not get them finished before Christmas 2021

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.

I guess so. Even though I hate competitions on principle.

I'm wondering if we can use the forum hidden details feature so we can compare solutions without spoilers for other people who haven't done them yet

Example below

SPOILER ALERT - may contain hints/solutions for solving puzzles

Hopefully the code doesn't show up unless you click on the arrow

To use it click on the cog

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.

I love it because it's not much of a competition, more like "hey, I can see you did it, can you give some tips?"

Anyways, here is the code: 656800-de6769b8. Use it in the Private Leaderboard page.

Did you WARP your code? Takes me well under a second on my super slow computer:

my solution

Of course if I make a random string of 7000 open and close parens, the count always comes out zero:

It also just takes a blink of an eye if you shift click on the Green flag to switch snap into Turbo mode

Or use this block at beginning of your script and one at the end to turn it off again

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

Oops! Sorry, fixed.

(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...)

Here's a quote from their website:

Oh, okay :)

reminds me of bitcoin, lol

stack=Stack()
reverse={"(":")","[":"]","{":"}"}
for i in string:
if peek(stack)==reverse[i]:
ignore(pop(stack))
else:
push(stack,i)
end
end
return stack


This does other parens(brackets?) too.

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. :~)

Yeah, sorry. That was more of a tip to those who are participating, I just used your solution for brevity.

1. This is a thread purely about using Snap! (just Snap!) for the Advent of Code puzzles

2. 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