12 ms·
Advent of Code 2019
- dang 7y agoAlready discussed at https://news.ycombinator.com/item?id=21660423 https://news.ycombinator.com/item?id=21660423, but since it starts today we'll give it another go.
- GaryNumanVevo 7y agooh lord, I just started writing a GCODE motion planner, I forgot about AoC.
- evenh 7y agoAn alternative with daily articles across a range of topics: https://news.ycombinator.com/item?id=21675200 https://news.ycombinator.com/item?id=21675200
- Barrin92 7y agoAlways enjoy doing these but there was one last year that nearly broke me. I think it was day15. It was the worst combination of mind-numbing coding and horribly hard to debug special cases. It was purely convoluted with very little to think about which makes for the worst kind of puzzles
- wycy 7y agoDay 15 was terrible for me too. The edge condition I missed was that you could both move and attack in a single turn. It only changed the outcome for me in part 2. I was only able to finally debug it by comparing debug outputs every step with a known-good solution.
- m1kal 7y agoDay 15 took me about 8 months, but I finally discovered I had made one wrong assumption that corrupted my solution for special cases...
- cjauvin 7y agoI can totally relate about that particular one, I remember that it destroyed a good part of a weekend for me, and I wrote that about it on Twitter, back in January of this year: "I have thought about the particular challenges of this year's Advent of Code (which I greatly enjoyed once again, with some intermittent mixed feelings), and my conclusion is that some problems might very well be of similar difficulty levels, but with nevertheless very dissimilar frustration-inducing levels. And I think the frustration level is strongly correlated with the feedback signal one can use to debug. Case in point: Day 15, which was almost impossible to debug, once you had a working solution, versus Day 17, which was actually fun to debug, since the visual signal you could use was so strong."
- AdeptusAquinas 7y agoThat one wiped me out for a week too, and caused borderline psychological problems. Ultimately though I realised that if I followed the description word by word, and made no assumptions, then I got the right solution. Still, a nightmare: you could pass all the examples, or even some alternate real sample data, and still get it wrong if you got the ordering slightly incorrect.
- loeg 7y agoYeah, it's really frustrating when the text summary is vague and underspecified. It makes it hard to understand exactly the result the author is looking for, which isn't the fun kind of puzzle.
- AdeptusAquinas 7y agoI think the problem was it _felt_ vague and under specified. But when I read it closely enough, it actually was exactly specific.
- beardbandit 7y agoYeah. That sounds like work and me begging business side for better requirements.
- m000 7y agoI strongly disliked the puzzles that quickly devolved to correctly handling a ton of corner cases. 15 and 17 were both in this category. What's the fun in that? This is like the boring part of being a developer. Without the payment that goes with being a developer.
- mathw 7y agoI hit day 15 and stopped last year. There always seems to be one puzzle which is so irritating it no longer seems worthwhile when I could be playing some music or building something in Minecraft or just lazing around on the sofa with the cat.
- forrestthewoods 7y agoLast year was my first year and I loved every second of it. I strongly recommend using AoC as a tool to help learn a new language. Many people, myself included, use it to learn Rust. The best part about AoC is the community. Everyone is super helpful and kind. The daily Reddit thread has solutions in every language under the sun. My better half is a designer and is going to participate this year to help learn JavaScript.
- donatj 7y agoI always have a ton of fun with these sorts of things. I always wonder how they come up with these sorts of puzzles. That's not a skill I have.
- dazwah 7y agoThere's a great talk by Eric Wastl that describes how he does it: https://www.youtube.com/watch?v=bS9882S0ZHs https://www.youtube.com/watch?v=bS9882S0ZHs
- dross 7y agoThis is my first year. As I missed the start time I created an event to remind me and published it for anyone else who'd wish to subscribe. https://calendar.google.com/event?action=TEMPLATE&tmeid=M203MTA1Yjdib2RndHBrNm51ZWU0Njd2bWVfMjAxOTEyMDFUMDUwMDAwWiBkYWxlLnYucm9zc0Bt&tmsrc=dale.v.ross%40gmail.com&scp=ALL https://calendar.google.com/event?action=TEMPLATE&tmeid=M203... Looking forward to the fun, the stress and the eventual euphoria.
- WrtCdEvrydy 7y agoCould not find the requested event...
- devit 7y agoOne line bash solutions: https://pastebin.com/QnKJEXxt https://pastebin.com/QnKJEXxt
- threatofrain 7y agoSurprisingly readable.
- noname120 7y agoYou can do shorter in languages with functional constructs. For example Python: sum(map(lambda x: x // 3 - 2, numbers))
- skinnyasianboi 7y agoKotlin: numbers.sumBy { it / 3 - 2 }
- the-dude 7y agoWhy is that a double slash?
- michaelmarkell 7y agoIt rounds down the quotient
- the-dude 7y agoHow intuitive. But thanks anyway.
- jacobolus 7y agoIn Python 2, floor division is the default for integer arguments and exact (to within machine precision) division the default for floating point arguments, but this caused a lot of unnecessary confusion: new users were surprised that 3.0/2.0 == 1.5, but 3/2 == 1. Thus for Python 3 the new // operator was added for explicit floor division (which is often quite useful in its own right), leaving the / operator to always return an exact (to machine precision) floating point result, even with integer arguments. cf. https://en.wikipedia.org/wiki/Principle_of_least_astonishment https://en.wikipedia.org/wiki/Principle_of_least_astonishmen...
- nabraham 7y agoEric, the author, says he won't accept any puzzle submissions because of attribution and legal issues. This seems like the wrong outcome for people who want to make the site better but don't want credit, compensation, or attribution. Has anyone seen a site using an IP assignment agreement which is the equivalent of "take my work, I don't want credit, and it's just for your site"? The Creative Commons CC0 license comes closest, but one could scrape those puzzles and create a competing site, which I'd guess Eric wants to avoid.
- arve0 7y agoThe problem is trusting the submitter. How do you make sure derivate work is not submitted?
- tl 7y agoIt’s a preference in his case that cannot be solved with licensing. Eric doesn’t want even potential ideas to influence him, and he says he has more puzzle ideas than time to implement them. Personally, I suspect that he wants something that consumes so much of his free time to wholly be his, and I respect that.
- inerte 7y ago“your site” is really complicated. Who is “you”, person, website or the company? If it’s the person can they transfer the rights? What happens if they die? If they donate the estate? If they get hired or contracted? If the website expands scope or changes in any way?
- nabraham 7y ago"You" would be the company, and the submitter would assign all the rights to it. Interestingly, I looked and couldn't find any terms of service or company name.
- mjtlittle 7y agoMaybe he enjoys/benefits from the work, I feel like coming up with puzzle ideas would be somewhat fun/beneficial. I would definitely assume that if this were not the case he would outsource it or maybe even open source it.
- aquova 7y agoMany of the comments are about the event as a whole, but I'd like to commend the author for the day 1 puzzle, which I think is very cleverly written. Many people (including myself) use these as an opportunity to try out learning a new language, and the first puzzle does a good job of making sure you know enough basic operations for some of the puzzles coming up. The puzzle itself wasn't very difficult, you could do it by hand if you really wanted to, but it required you to know how to read and parse lines in a file, handle compound data structures, iterate through, and perform basic operations (floor, casting strings to ints, etc). I thought it was really well done, and creates the basic knowledge for the puzzles ahead.
- klemenk 7y agoYou can watch authors talk about how he prepares challenges and other challenges he had with AoC :D https://www.youtube.com/watch?v=gibVyxpi-qA&feature=emb_title https://www.youtube.com/watch?v=gibVyxpi-qA&feature=emb_titl...
- melling 7y agoLearning new environments can be painful so it’s good it starts off easy. I’m trying to solve them with Swift Playgrounds on the iPad, for example. And I can’t figure out how to create a simple text file for the data.
- melling 7y agoI solved the first part using the examples. Swift is nice. func calcFuel(_ mass:Int) -> Int {mass / 3 - 2} let z0 = massList.map(calcFuel).reduce(0, +) or simply ... let z1 = massList.map({$0 / 3 - 2}).reduce(0, +) Any idea how to read the data on the iPad?
- chii 7y agoi just copy/pasted the data into the source instead of dealing with IO.
- 7y ago
- sergiotapia 7y agoI’m finally going to attempt it this year. Using elixir here: https://github.com/sergiotapia/advent-of-code-2019-elixir https://github.com/sergiotapia/advent-of-code-2019-elixir
- ulucs 7y agoLast year I started out using elixir, but I got filtered due to the goblins...
- sergiotapia 7y agoWhat does this mean?
- Jtsummers 7y agoProbably Day 15 [0] from last year. It was challenging, especially because there were so many rules to implement (in a short time). A slight misreading of the rules would let you pass all the provided examples, but fail on the real input. [0] https://adventofcode.com/2018/day/15 https://adventofcode.com/2018/day/15
- tialaramex 7y agoIdiot-proofing is hard. Figuring out everything people will get wrong is the only reliable way to ensure people don't, but that takes more insight than is needed to set and solve problems correctly.
- Jtsummers 7y agoNo doubt. I wasn't really complaining, but that was the one that seemed to cause the most headaches last year. And the text had the problem fully specified, there really was no good way to make it better other than perhaps a different presentation (also a hard problem) or a few extra test cases to tease out those potential misreadings. But you can't catch every error for the participants, coming up with tests is part of the challenge.
- jammygit 7y agoThese are daily programming puzzles? How long do they take on average? Also, I know somebody who is just starting out at coding. Would it be too hard for them? They are brand new, learning about loops
- j1elo 7y agoI wondered the same, also thinking about people I know who are starting to program. In the end I think it's not a good fit, given that basic concepts are still being understood, and the mere task of reading a file and iterating over the lines, even the concept itself of what "iterating" is, is already a big challenge... Trying is free and won't hurt, though, so why not :)
- teraflop 7y agoI completed the whole thing last year; the problems start out very easy, but get dramatically more challenging over the course of the month. Check out the statistics for how many people completed each problem in 2018: https://adventofcode.com/2018/stats https://adventofcode.com/2018/stats The first few problems are approachable by pretty much anyone who understands how to do arithmetic, file I/O and basic flow control. Many of the later problems require advanced skills such as more sophisticated algorithms (graph theory, dynamic programming, etc.), reverse engineering, and careful debugging. For what it's worth, I would expect anyone who knows what a loop is to be able to get the first half of today's problem without much difficulty. The second half is a bit less trivial but also pretty easy to understand.
- ken 7y ago> Check out the statistics for how many people completed each problem in 2018 I suspect you'd see a dropoff like this regardless of whether the problems get more difficult or not. Going to the gym doesn't get any harder in February but they see the same effect.
- teraflop 7y agoTrue; I would be interested in seeing the number of logged-in users who viewed and/or attempted each problem.
- thethirdone 7y agoI was doing a little of catching up on older problems to improve my speed to get on the leaderboard and I found that the fastest way to finish one problem was to use oeis. After seeing the problem [0], I didn't immediately think to use oeis because the manhatten distance of a spiral is pretty easy to code or do by hand. The second stage has a harder sequence though. It prompted me to check oeis and I easily got the answer [2] within a minute of checking. Looking back at the first stage, I found a sequence for it [1] and PARI/GP code i could run to answer the question. If I had used oeis immediately I would have a solution to both phases in 2 minutes which would be the fastest on the old leaderboard for the problem [3]. [0]:https://adventofcode.com/2017/day/3 https://adventofcode.com/2017/day/3 [1]:https://oeis.org/A214526 https://oeis.org/A214526 [2]:https://oeis.org/A141481 https://oeis.org/A141481 [3]:https://adventofcode.com/2017/leaderboard/day/3 https://adventofcode.com/2017/leaderboard/day/3
- loeg 7y agoI had plenty of 20-20 hindsight about faster ways to have solved puzzles in the past. I don't know if I was ever #1 on any day on either star. I think I might've been top 10, on one star, of one day, once.
- coolreader18 7y agoWow, what a great distraction for students to have during finals season! ;)
- messe 7y agoSelf promotion, but as this is my first year doing advent of code I'm solving all of the problems using awk[1], the solutions will be published here[2] [1]: https://man.openbsd.org/awk https://man.openbsd.org/awk [2]: https://jo.ie/advent-of-awk-2019.html https://jo.ie/advent-of-awk-2019.html
- cfors 7y agoWith respect to the fact that 99% of my use of awk is done like this: > | awk '{print $<word>}' The solution to the first exercise looks surprisingly clean. It will be interesting to see how they continue as the challenges get harder. Bookmarked!
- bewuethr 7y agoI've used awk for one year of Advent of Code: https://github.com/bewuethr/advent-of-code/tree/master/2016 https://github.com/bewuethr/advent-of-code/tree/master/2016 Some problems feel like they were designed to be solved in awk, like the assembly style ones. Others, not so much... But it was great fun overall and I learned a lot about awk.
- mathw 7y agoAs someone using a completely mainstream and normal language (well, Rust), I salute you.
- malloreon 7y agoI like everything about this except the name. the word advent is religious.
- jimmyswimmy 7y agoThe name is reminiscent of an advent calendar, which traditionally has a labeled door behind which is a piece of candy, small toy or other trinket. These calendars are intended for young children to remind them of the period of advent. If you are religious, look upon this as a similar thing which reminds you of the season, building in anticipation of the final day. If you are not religious, it's just a word with no special meaning other than the time of year. Same goes if you are not of a Christian religion.
- bkromhout 7y agoThis is only true when it's used as a proper noun; in which case, yes, it refers one of two things in the context of Christianity. Otherwise, it's just a normal word which means "the arrival of a notable person, thing, or event".
- p1necone 7y agoAnd?
- malloreon 7y agoif this is a religious project, it should be clearly marked as such. if it's not, why not use a nonreligious word?
- mpcjanssen 7y agoBecause advent is a common term for the 4 weeks before Christmas even in non religious contexts. And that is how it's used in this non religious project.
- justin66 7y ago> if this is a religious project, it should be clearly marked as such. What an utterly strange proclamation. On every level: the notion that speech should not be free, the notion that users cannot be trusted to figure out what the project is about if it's not "clearly marked" in this way, the notion that there is some harm that can be done by such a "religious project" or a "religious word," whatever that even means.
- dom96 7y agoThis event is a really nice way to try out new programming languages. You can easily find many people doing the challenges in various languages and communities coming together to work through the problems together. It’s also very interesting seeing how each person solves the problem in their favourite language. For example, here is the Nim communities effort: https://forum.nim-lang.org/t/5588 https://forum.nim-lang.org/t/5588
- andonisus 7y agoHere is my solution to Day 1 Part 2 in Go: https://play.golang.com/p/SQsCdTXk_YH https://play.golang.com/p/SQsCdTXk_YH
- sircastor 7y agoI went to bed before trying it last night, but couldn't sleep. So I did the day one problem early this morning. It was fun, and went quicker than I thought. I guess I must've improved from last year.
- sidcool 7y agoDoes anybody know how the scoring system works for AoC?
- vpzom 7y agoSee https://adventofcode.com/2019/leaderboard https://adventofcode.com/2019/leaderboard
- qznc 7y agoI'm trying to use J and still struggle with the second part of day 1. Any other J users?
- macintux 7y agoIf you haven't already found the discussion, Reddit is very active and very helpful. Seems to be the primary water cooler for the event. https://www.reddit.com/r/adventofcode/ https://www.reddit.com/r/adventofcode/
- valec 7y agoI'd argue /g/ on 4chan is actually. 3-4 threads get filled a day (~300 replies each). It's honestly the only real reason to go on /g/ (or really 4chan in general) for me.
- JaumeGreen 7y agoI have found a solution someone posted [0] It looks similar to what I though I had to write, but I will have to reread it and the documentation to understand it well. And day 2 seems a bit too complex with my meager J knowledge. OTOH with the J interpreter for android and its terseness it seems the most suited language for programming on a phone, so I will probably stick to it. [0] https://www.reddit.com/r/adventofcode/comments/e4axxe/2019_day_1_solutions/f9dmskw/ https://www.reddit.com/r/adventofcode/comments/e4axxe/2019_d...
- qznc 7y agoI'm actually surprise how many J/APL/K/Q solutions get posted there already. It seems to be popular among golfers.
- ph2082 7y agoJeez, tension is real. Specially if you are thinking about cracking top 100. Competition is a b. Lot of fun though.
- mathw 7y agoThat's only possible if you live in the correct time zone, too.
- sunaden 7y agoIf someone is interested in the previous years of Advent of Code they are available as notebooks in Peter Norvig's pytudes repository: https://github.com/norvig/pytudes https://github.com/norvig/pytudes
- narimiran 7y agoThank you very much for this! I was aware of Norvig's 2016 AoC solutions, but I thought he never did any of the newer editions. I know what I'll be reading today :)
- janvdberg 7y agoAdvent of Code is a lot of fun! Last year I wrote a little bit about all the different languages/approaches people use to solve the challenges: https://j11g.com/2018/12/03/advent-of-code/ https://j11g.com/2018/12/03/advent-of-code/
- LandR 7y agoDay 2 part 2, what is it actually asking? I can't tell from the description what the actual puzzle is... Is it that I need to generate a program that generates the output 19690720 when run through the function that was written in part 1?
- eachro 7y agoIn the first problem they told you what numbers to put in position 1 and 2. In the second problem you want to find the specific numbers for position 1 and 2 that yield the desired output.
- LandR 7y agoAh ok, thanks! My reading comprehension obviously needs some work :P
- bsdnoob 7y agoyou need to find value of memory[1] & memory[2] where memory is the program from first part, which gets you 19690720
- LandR 7y agoThanks, five minutes to write the code and get an answer, half an hour staring at it wondering what on earth I was actually supposed to do.... Feel like a bit of an idiot.
- alanbernstein 7y agoSo, just like most days as a programmer?
- dbetteridge 7y agoWould appreciate feedback on my Go code! I'm sure theres a better way to approach some of these. https://danielbetteridge.com/advent-of-code-day-1/ https://danielbetteridge.com/advent-of-code-day-1/
- Kinrany 7y agoThe third puzzle mentions Halt and Catch Fire, a brilliant TV show about innovation and the lives of the (fictional) people behind it.
- daveFNbuck 7y agoIt actually references the thing that the show is named after. If you click on the link, it's not about the show.