Advent of Code 2020

  1. Who created the thread? Me! :wink: That feels like pseudo code, or some pseudocode-like language. Totally ok, as long as it's easy to understand.
  2. Yeah, that'd be useful.

Python without Indentation

Is that like a separate language or just something you made up?

Something I made up.

How is it going for day 1?
Does anyone have a combinatorics library for Snap?

It's live now :slight_smile:

Remember - PLEASE don't publish solutions/spoilers in plain view - hide them using the Hide details or just post a link to your project :slight_smile:

#TopTip Make sure your code deals with all the examples correctly before running it on the big input.

Not actually started on it yet - I'll have to google "combinatroics" to find out what than means :slight_smile:

The branch of mathematics that studies the ways stuff can be arranged (said very brutally)

I've started :slight_smile:

No big spoiler as its just my first block :slight_smile:

Start

image

:slight_smile:

Took about 60 secs with a simple brute force approach

Part 1 took 6s for me but part 2 about ten minutes (albeit while in videolessons)

I didn't warp or anything - just a loop inside a loop

I got my part 2 to run in 1.5 seconds while in turbo mode

Code

AoC 2020 1 script pic
https://snap.berkeley.edu/snap/snap.html#present:Username=legoman3.14&ProjectName=AoC%202020%201&editMode&noRun

Mine took ages - I had to leave it running overnight!

I think I'd better improve it before I start puzzle two today! :slight_smile:

Puzzle 1 Part 2

image

Nice exercise just doing the input parsing

Puzzel 2 Part 1 input parsing

image

When I do it in Snap! I'll miss them regexes

Is a "regex" more than a standard regular expression? Because the latter are equivalent to finite state machines, and an FSM can't solve this problem in general, only up to a fixed depth.

I've never got my head around regex parsing.

Its very powerful but so obtuse

It doesn't solve the whole problem, it just is an easy way to extract input that is in the form number-number letter: word

js regex for that

/(\d+)-(\d+) (\w): (\w+)/

Some things are really hard but I managed to understand the basics pretty easily