Advent of Code 2018
adventofcode.com
adventofcode.com
[0]http://nbviewer.jupyter.org/url/norvig.com/ipython/Advent%20...
[0] https://github.com/norvig/pytudes/blob/master/ipynb/Advent%2...
So for this year I've converted it to a browser extension, so it fetches the data automatically :) Available for both Firefox [2] and Chrome [3].
[1] https://github.com/amochtar/aoc-ranking [2] https://addons.mozilla.org/en-US/firefox/addon/aoc-ranking/ [3] https://chrome.google.com/webstore/detail/aoc-ranking/jbnlaf...
Last year I tried to solve at least the first few days in a bunch of different languages, doing Red/Green TDD so I could learn how to set up a basic project and do tests in languages I was less familiar with. Still trying to decide if I should take that approach again this year or focus on getting every day done in a single new language.
Not quite sure what language I'm going to do this year though
(Update) The "high contrast" CSS style they provide is more readable, but I'm sure it should be possible to create a dark style where readability doesn't suffer that much. That font is just not the best choice.
Stylus - https://add0n.com/stylus.html
- On a scale of 1-10, 1 being you could do it with your eyes closed, 10 being you thought it was nearly impossible, how difficult was this puzzle for you?
- Did you learn something new because of this puzzle? Could be something about your language or a library or a new algorithm that helped you solve it.
- What language(s) did you use to solve this puzzle?
It could let you compare yourself with other developers - if you thought it was hard and most others didn't then you would know you might need to practice something more. It might be something that would best be combined with some profile level questions - like their experience level and primary languages that they use day to day.
It could tell us that people who used python found this particular puzzle easy (maybe because of some built in function in the stdlib) but people using some other language didn't.
Year over year it would be awesome to compare the languages that people use. Nobody is doing this for their job supposedly so these are either languages that people enjoy or find practical. I bet you'd find some correlations though too between language and how many puzzles they complete in a year - ie people using language x tend to finish the whole year but language y tend to drop off after day 10.
I've joined similar initiatives in the past, but I always end up giving up because of not being able to keep up the pace of sitting down _every_ day.
Yeah one could just solve the problems with some offset delay, or just skip all missed problems, but then it's not fun any more, and I'd wager that the same could be done any other time of the year too...
But - I wasn't just trying to solve them, I was also trying to write tests and refactoring when I was done - so ymmv. I also wasn't ever attempting to compete for the leaderboard.
But, I'm slow, and I try to do it TDDish in a language I'm not so familiar with so there's that.
This year my aim is to finish all the problems by Nov 30th 2019 :) Even when I try go _as fast as I can_ (in ruby) I've only ever managed about 120th on the leaderboard. Now I just aim to have fun and learn as much as I can.
But to answer your actual question, if they're easy, within half an hour or less, hard ones, anywhere up to 5 or 6 hours (I'm slow, I'm OK with that :)
I still haven't solved all of 2017's, "some offset delay" indeed. I might not have solved all of 2016's for that matter - the closer it gets to Christmas, the less likely I am to touch a computer at all.
Probably 15-20 minutes a day on average (edit: yep, my data from 2017 supports that), but with large spikes (and the average goes up towards the end of the month). (But I'm pretty quick — I was on the global leaderboard the last few years in a row.)
Edit: real numbers from 2017:
Excluding outliers and days I was absent at the start of the challenge: average 12.5 minutes for part 1 and 19.5 minutes for part 2.
Only excluding days where I was absent at the start of the challenge: average 16.25 minutes for part 1 and 23 minutes for part 2.
Edit2: 2016 was similar: 19-25 minutes excluding outliers, 23-35 minutes excluding days I missed the puzzle release by several hours.
If you're going for speed / leaderboard, Python is usually your best bet. Suggested libraries to be familiar with include:
stdlib: binascii, collections (especially defaultdict), fractions (gcd), itertools (combinations, combinations_with_replacement, permutations, product, izip, chain), md5, re, os/sys.
Non-std: networkx (graphs and shortest path), sympy (isprime()), numpy (efficient representation of large arrays).
It's useful to have a canned exhaustive tree search prepared (breadth/depth/"best"-first search).
You can use complex numbers to represent 2-dimensional coordinates and direction; turning the unit vector left and right involves multiplying by 1j and -1j, respectively, and movement is addition.
Oh, and sometimes pypy is faster enough that it can make a Python solution viable where otherwise it would have been too slow.
2017 I solved in kotlin and got all the way to the end. I remember closing my laptop on Christmas Day and feeling elated/tired
Also, the input data for each problem is randomized per user, so you really do need a proper programmatic solution (i.e. simply copying another person's answer is unlikely to work).
(Please don't do this!)
Part of it is familiarity with the format, which of course assumes they keep things reasonably similar this year. Knowing the kinds of problems that appear (parsing, graphs, optimization, reverse engineering, etc.) helped me put together a little library of code that means I'm not spending time rewriting fundamental algorithms.
Reading problem statements is one of those skills I picked up from ACM programming competitions. The problem statements usually contain a lot of fluff - to speed-code you want to be able to pluck out the relevant bits quickly so you can start formulating the solution.
Anyway I’m sure I won’t ever encounter that spiral as long as I live but if I do, I have code prepped for it :D
Based on what I found online (which is abridged rewordings of the problem, something of a sequence sum?) I'd get lazy at that point and implement something that makes the spiral. Presumably, this shouldn't take to long, as the sequence grows rapidly so they can't give us a number that's too big…
Huh? Click [Events], click on the year, click on the day.
I have also made a discord bot to show the leaderboard, if anyone is interested : https://github.com/DylanMeeus/Advent_Of_Code_Bot
It is such a fun way to pick up new langs
Is there a list of frequencies I starring me in the face, that I am failing to see, which needs to apply to zero?
Am I supposed to suss out the pattern for how frequency change occur as a function of current frequency from the two examples?
Question: should I go with Racket or Chicken Scheme?
Going to do this in Scala, if anybody wants to join my email is in my bio.
- provide a password reset service
- find a way to send emails to this many people for low cost, it is a free service after all, so all of the confirmation/reset emails are an additional cost
- etc
I'm just curious about why this is billed as an Advent calendar, when really the only thing it has in common with an Advent calendar is that it terminates on Christmas.
Is there anything about it that has anything to do with Advent, i.e. the Christian liturgical season that precedes Christmas?
More here: https://www.creativebloq.com/web-design/advent-calendars-des...